MapUtil

MapUtil

Method Overview

NameDescriptionReturn
createPoint()สร้าง Point โดยสามารถกำหนด SpatialReference ได้Point
createSpatialReference()สร้าง SpatialReferenceSpatialReference
createPointFromUTM()สร้าง Point โดนสามารถกำหนด WKID ได้Point
createPointFromLatLong()สร้าง Point จาก Latitude LongitudePoint
createPointFromWebMercator()สร้าง Point Web MercatorPoint
project()project Geometry โดยสามารถกำหนด SpatialReference ได้Geometry
projectToLatLong()project Geometry โดย SpatialReference คือ SPATIALREF_WGS84Geometry
projectToMercator()project Geometry โดย SpatialReference คือ SPATIALREF_WEBMERGeometry
projectToUTM()project Geometry โดย SpatialReference คือ SPATIALREF_WGS47Geometry
convertPointToString()สร้าง WKTEXT รูปแบบ PointString
convertStringToPoint()แปลง String เป็น Point โดยมี SpatialReference คือ SPATIALREF_WGS47 หรือจะ กำหนดตาม WKIDPoint
convertStringToPolygon()แปลง String เป็น PolygonPolygon
convertStringToPolyline()แปลง String เป็น PolylinePolyline
convertPolylineToString()แปลง Polyline เป็น String WKTEXTStringBuilder
convertPolygonToString()แปลง Polygon เป็น String WKTEXTStringBuilder
convertJsonObjectToGeometry()แปลง JsonObject ที่เป็น Geometry ไปเป็น GeometryGeometry
convertPointToWgs84()แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS84Point
convertPointToLatLong()แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_4326Point
convertPointToWebMercator()แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMERPoint
convertIndianPointToWebMercator()แปลง Indian Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMERPoint
convertPointToIndian47()แปลง Point ให้ Point มี SpatialReference คือ WKID_24047Point
convertPointToIndian48()แปลง Point ให้ Point มี SpatialReference คือ WKID_24048Point
convertPointToWgs47()แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS47Point
convertPointToWgs48()แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS48Point
convertPointToSketchEditorSpatial()แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_3857Point
convertPolylineToWgs84()แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS84Polyline
convertPolylineToWebMercator()แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMERPolyline
convertIndianPolylineToWebMercator()แปลง Indian Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMERPolyline
convertPolylineToIndian47()แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24047Polyline
convertPolylineToIndian48()แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24048Polyline
convertPolylineToWgs47()แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS47Polyline
convertPolylineToWgs48()แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS48Polyline
convertPolylineToSketchEditorSpatial()แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_3857Polyline
convertPolygonToWgs84()แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS84Polygon
convertPolygonToWebMercator()แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMERPolygon
convertIndianPolygonToWebMercator()แปลง Indian Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMERPolygon
convertPolygonToIndian47()แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24047Polygon
convertPolygonToIndian48()แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24048Polygon
convertPolygonToWgs47()แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS47Polygon
convertPolygonToWgs48()แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS48Polygon
convertPolygonToSketchEditorSpatial()แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_3857Polygon
createPointDrawableGraphic()สร้าง Graphic จาก Drawable ID ใน resGraphic

Method Details

fun createPoint(x: Double, y: Double, spatialReference: SpatialReference): Point

สร้าง Point โดยสามารถกำหนด SpatialReference ได้

Parameters

NameDescriptionType
xค่า x ของพิกัดDouble
yค่า y ของพิกัดDouble
spatialReferenceSpatialReference ของ PointSpatialReference

Returns

TypeDescription
PointReturn Point ที่มี SpatialReference ตามที่กำหนด
fun createSpatialReference(wkid : Int) : SpatialReference

สร้าง SpatialReference

Parameters

NameDescriptionType
wkidWKID ของ SpatialReferenceInt

Returns

TypeDescription
SpatialReferenceReturn SpatialReference ที่มี WKID ตามที่กำหนด
fun createPointFromUTM(x: Double, y: Double,  wkid: Int = WKID_32647): Point

สร้าง Point โดนสามารถกำหนด WKID ได้

Parameters

NameDescriptionTypeDefault
xค่า x ของพิกัดDouble
yค่า y ของพิกัดDouble
wkidWKID ของ SpatialReferenceIntWKID_32647

Returns

TypeDescription
PointReturn Point ที่มี WKID ตามที่กำหนด
fun createPointFromLatLong(lat: Double, long: Double): Point

สร้าง Point จาก Latitude Longitude

Parameters

NameDescriptionType
latค่า lat ของพิกัดDouble
longyค่า long ของพิกัดDouble

Returns

TypeDescription
PointReturn Point ที่มี Latitude Longitude ตามที่กำหนด
fun createPointFromWebMercator(x: Double, y: Double): Point

สร้าง Point Web Mercator

Parameters

NameDescriptionType
xค่า x ของพิกัดDouble
yค่า y ของพิกัดDouble

Returns

TypeDescription
PointReturn Point Web Mercator
fun project(geometry: Geometry, spatialReference: SpatialReference): Geometry

project Geometry โดยสามารถกำหนด SpatialReference ได้

Parameters

NameDescriptionType
geometrygeometry ที่ต้องการGeometry
spatialReferenceSpatialReference ที่ต้องการSpatialReference

Returns

TypeDescription
GeometryReturn Geometry โดยมี SpatialReference ที่กำหนด
fun projectToLatLong(geometry: Geometry): Geometry

project Geometry โดย SpatialReference คือ SPATIALREF_WGS84

Parameters

NameDescriptionType
geometrygeometry ที่จะ projectGeometry

Returns

TypeDescription
GeometryReturn Geometry โดยมี SpatialReference SPATIALREF_WGS84
fun projectToMercator(geometry: Geometry): Geometry

project Geometry โดย SpatialReference คือ SPATIALREF_WEBMER

Parameters

NameDescriptionType
geometrygeometry ที่จะ projectGeometry

Returns

TypeDescription
GeometryReturn Geometry โดยมี SpatialReference SPATIALREF_WEBMER
fun projectToUTM(geometry: Geometry): Geometry

project Geometry โดย SpatialReference คือ SPATIALREF_WGS47

Parameters

NameDescriptionType
geometrygeometry ที่จะ projectGeometry

Returns

TypeDescription
GeometryReturn Geometry โดยมี SpatialReference SPATIALREF_WGS47
fun convertStringToPoint(text: String): Point

แปลง String เป็น Point โดยมี SpatialReference คือ SPATIALREF_WGS47

Parameters

NameDescriptionType
textWKTEXT ที่จะแปลงString

Returns

TypeDescription
PointReturn Point โดยมี SpatialReference คือ SPATIALREF_WGS47
fun convertStringToPoint(text: String , wkid: Int): Point

แปลง String เป็น Point โดยมี SpatialReference กำหนดตาม WKID

Parameters

NameDescriptionType
textWKTEXT ที่จะแปลงString
wkidWKID ที่ต้องการInt

Returns

TypeDescription
PointReturn Point โดยมี SpatialReference ตาม WKID
fun convertStringToPolygon(text: String): Polygon

แปลง String เป็น Polygon รองรับ MultiPolygon

Parameters

NameDescriptionType
textWKTEXT ที่จะแปลงString

Returns

TypeDescription
PolygonReturn Polygon
fun convertStringToPolygon(text: String , wkid: Int): Polygon

แปลง String เป็น Polygon รองรับ MultiPolygon

Parameters

NameDescriptionType
textWKTEXT ที่จะแปลงString
wkidWKID ที่ต้องการInt

Returns

TypeDescription
PolygonReturn Polygon โดยมี SpatialReference ตาม WKID
fun convertStringToPolyline(text: String): Polyline

แปลง String เป็น Polyline

Parameters

NameDescriptionType
textWKTEXT ที่จะแปลงString

Returns

TypeDescription
PolylineReturn Polyline
fun convertStringToPolyline(text: String, wkid: Int?): Polyline

แปลง String เป็น Polyline

Parameters

NameDescriptionType
textWKTEXT ที่จะแปลงString
wkidWKID ที่ต้องการ ถ้าใส่ null จะ ตั้งต้นที่ค่า WKID_24047Int?

Returns

TypeDescription
PolylineReturn Polyline โดยมี SpatialReference ตาม WKID
fun convertPolylineToString(polyline: Polyline): StringBuilder

แปลง Polyline เป็น String WKTEXT

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
StringBuilderReturn String โดยมีรูปแบบ WKTEXT
fun convertPolygonToString(polygon: Polygon, isPolygon: Boolean): StringBuilder

แปลง Polygon เป็น String WKTEXT รองรับ MultiPolygon

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon
isPolygontrue คือ Polygon false คือ MultiPolygonBoolean

Returns

TypeDescription
StringBuilderReturn String รูปแบบ WKTEXT
fun convertJsonObjectToGeometry(geometryJsonObject: JsonObject, geometryType: String): Geometry

แปลง JsonObject ที่เป็น Geometry ไปเป็น Geometry

Parameters

NameDescriptionType
geometryJsonObjectgeometryJsonObject ที่จะแปลงJsonObject
geometryTypetype ที่ต้องการจะแปลง เช่น Point , PolylineString

Returns

TypeDescription
GeometryReturn Geometry ที่แปลงแล้วตาม geometryType
fun convertPointToWgs84(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS84

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS84
fun convertPointToLatLong(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_4326

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_4326
fun convertPointToWebMercator(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMER

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER
fun convertIndianPointToWebMercator(point: Point): Point

แปลง Indian Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMER

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER
fun convertPointToIndian47(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ WKID_24047

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24047
fun convertPointToIndian48(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ WKID_24048

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24048
fun convertPointToWgs47(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS47

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS47
fun convertPointToWgs48(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS48

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS48
fun convertPointToSketchEditorSpatial(point: Point): Point

แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_3857

Parameters

NameDescriptionType
pointPoint ที่จะแปลงPoint

Returns

TypeDescription
PointReturn Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_3857
fun convertPolylineToWgs84(polyline: Polyline): Polyline

แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS84

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS84
fun convertPolylineToWebMercator(polyline: Polyline): Polyline

แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMER

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER
fun convertIndianPolylineToWebMercator(polyline: Polyline): Polyline

แปลง Indian Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMER

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER
fun convertPolylineToIndian47(polyline: Polyline): Polyline

แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24047

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24047
fun convertPolylineToIndian48(polyline: Polyline): Polyline

แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24048

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24048
fun convertPolylineToWgs47(polyline: Polyline): Polyline

แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS47

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS47
fun convertPolylineToWgs48(polyline: Polyline): Polyline

แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS48

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS48
fun convertPolylineToSketchEditorSpatial(polyline: Polyline): Polyline

แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_3857

Parameters

NameDescriptionType
polylinePolyline ที่จะแปลงPolyline

Returns

TypeDescription
PolylineReturn Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_3857
fun convertPolygonToWgs84(polygon: Polygon): Polygon

แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS84

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS84
fun convertPolygonToWebMercator(polygon: Polygon): Polygon

แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMER

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER
fun convertIndianPolygonToWebMercator(polygon: Polygon): Polygon

แปลง Indian Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMER

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER
fun convertPolygonToIndian47(polygon: Polygon): Polygon

แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24047

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24047
fun convertPolygonToIndian48(polygon: Polygon): Polygon

แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24048

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24048
fun convertPolygonToWgs47(polygon: Polygon): Polygon

แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS47

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS47
fun convertPolygonToWgs48(polygon: Polygon): Polygon

แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS48

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS48
fun convertPolygonToSketchEditorSpatial(polygon: Polygon): Polygon

แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_3857

Parameters

NameDescriptionType
polygonPolygon ที่จะแปลงPolygon

Returns

TypeDescription
PolygonReturn Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_3857
fun createPointDrawableGraphic(context: Context , point: Point , drawableName : Int , markerOffsetY : Float = 3f): Graphic

สร้าง Graphic จาก Drawable ID ใน res

Parameters

NameDescriptionTypeDefault
contextcontext ของ Fragment หรือ Activity ที่จะแสดง GraphicContext
pointPoint ที่ต้องการแสดง GraphicPoint
drawableNameDrawable ID ใน res เช่น R.drawable.xxxInt
markerOffsetYตำแหน่ง Graphic ณ จุดนั้น ว่าให้สูงขึ้นมาจากจุดนั้นFloat3f

Returns

TypeDescription
GraphicReturn Graphic ที่แสดงสัญลักษณ์จาก drawable ที่เรากำหนด