MapUtil
Method Overview
| Name | Description | Return |
|---|
| createPoint() | สร้าง Point โดยสามารถกำหนด SpatialReference ได้ | Point |
| createSpatialReference() | สร้าง SpatialReference | SpatialReference |
| createPointFromUTM() | สร้าง Point โดนสามารถกำหนด WKID ได้ | Point |
| createPointFromLatLong() | สร้าง Point จาก Latitude Longitude | Point |
| createPointFromWebMercator() | สร้าง Point Web Mercator | Point |
| project() | project Geometry โดยสามารถกำหนด SpatialReference ได้ | Geometry |
| projectToLatLong() | project Geometry โดย SpatialReference คือ SPATIALREF_WGS84 | Geometry |
| projectToMercator() | project Geometry โดย SpatialReference คือ SPATIALREF_WEBMER | Geometry |
| projectToUTM() | project Geometry โดย SpatialReference คือ SPATIALREF_WGS47 | Geometry |
| convertPointToString() | สร้าง WKTEXT รูปแบบ Point | String |
| convertStringToPoint() | แปลง String เป็น Point โดยมี SpatialReference คือ SPATIALREF_WGS47 หรือจะ กำหนดตาม WKID | Point |
| convertStringToPolygon() | แปลง String เป็น Polygon | Polygon |
| convertStringToPolyline() | แปลง String เป็น Polyline | Polyline |
| convertPolylineToString() | แปลง Polyline เป็น String WKTEXT | StringBuilder |
| convertPolygonToString() | แปลง Polygon เป็น String WKTEXT | StringBuilder |
| convertJsonObjectToGeometry() | แปลง JsonObject ที่เป็น Geometry ไปเป็น Geometry | Geometry |
| convertPointToWgs84() | แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS84 | Point |
| convertPointToLatLong() | แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_4326 | Point |
| convertPointToWebMercator() | แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMER | Point |
| convertIndianPointToWebMercator() | แปลง Indian Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMER | Point |
| convertPointToIndian47() | แปลง Point ให้ Point มี SpatialReference คือ WKID_24047 | Point |
| convertPointToIndian48() | แปลง Point ให้ Point มี SpatialReference คือ WKID_24048 | Point |
| convertPointToWgs47() | แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS47 | Point |
| convertPointToWgs48() | แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS48 | Point |
| convertPointToSketchEditorSpatial() | แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_3857 | Point |
| convertPolylineToWgs84() | แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS84 | Polyline |
| convertPolylineToWebMercator() | แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMER | Polyline |
| convertIndianPolylineToWebMercator() | แปลง Indian Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMER | Polyline |
| convertPolylineToIndian47() | แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24047 | Polyline |
| convertPolylineToIndian48() | แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24048 | Polyline |
| convertPolylineToWgs47() | แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS47 | Polyline |
| convertPolylineToWgs48() | แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS48 | Polyline |
| convertPolylineToSketchEditorSpatial() | แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_3857 | Polyline |
| convertPolygonToWgs84() | แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS84 | Polygon |
| convertPolygonToWebMercator() | แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMER | Polygon |
| convertIndianPolygonToWebMercator() | แปลง Indian Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMER | Polygon |
| convertPolygonToIndian47() | แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24047 | Polygon |
| convertPolygonToIndian48() | แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24048 | Polygon |
| convertPolygonToWgs47() | แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS47 | Polygon |
| convertPolygonToWgs48() | แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS48 | Polygon |
| convertPolygonToSketchEditorSpatial() | แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_3857 | Polygon |
| createPointDrawableGraphic() | สร้าง Graphic จาก Drawable ID ใน res | Graphic |
Method Details
fun createPoint(x: Double, y: Double, spatialReference: SpatialReference): Point
สร้าง Point โดยสามารถกำหนด SpatialReference ได้
Parameters
| Name | Description | Type |
|---|
| x | ค่า x ของพิกัด | Double |
| y | ค่า y ของพิกัด | Double |
| spatialReference | SpatialReference ของ Point | SpatialReference |
Returns
| Type | Description |
|---|
| Point | Return Point ที่มี SpatialReference ตามที่กำหนด |
fun createSpatialReference(wkid : Int) : SpatialReference
สร้าง SpatialReference
Parameters
| Name | Description | Type |
|---|
| wkid | WKID ของ SpatialReference | Int |
Returns
| Type | Description |
|---|
| SpatialReference | Return SpatialReference ที่มี WKID ตามที่กำหนด |
fun createPointFromUTM(x: Double, y: Double, wkid: Int = WKID_32647): Point
สร้าง Point โดนสามารถกำหนด WKID ได้
Parameters
| Name | Description | Type | Default |
|---|
| x | ค่า x ของพิกัด | Double | |
| y | ค่า y ของพิกัด | Double | |
| wkid | WKID ของ SpatialReference | Int | WKID_32647 |
Returns
| Type | Description |
|---|
| Point | Return Point ที่มี WKID ตามที่กำหนด |
fun createPointFromLatLong(lat: Double, long: Double): Point
สร้าง Point จาก Latitude Longitude
Parameters
| Name | Description | Type |
|---|
| lat | ค่า lat ของพิกัด | Double |
| longy | ค่า long ของพิกัด | Double |
Returns
| Type | Description |
|---|
| Point | Return Point ที่มี Latitude Longitude ตามที่กำหนด |
fun createPointFromWebMercator(x: Double, y: Double): Point
สร้าง Point Web Mercator
Parameters
| Name | Description | Type |
|---|
| x | ค่า x ของพิกัด | Double |
| y | ค่า y ของพิกัด | Double |
Returns
| Type | Description |
|---|
| Point | Return Point Web Mercator |
fun project(geometry: Geometry, spatialReference: SpatialReference): Geometry
project Geometry โดยสามารถกำหนด SpatialReference ได้
Parameters
| Name | Description | Type |
|---|
| geometry | geometry ที่ต้องการ | Geometry |
| spatialReference | SpatialReference ที่ต้องการ | SpatialReference |
Returns
| Type | Description |
|---|
| Geometry | Return Geometry โดยมี SpatialReference ที่กำหนด |
fun projectToLatLong(geometry: Geometry): Geometry
project Geometry โดย SpatialReference คือ SPATIALREF_WGS84
Parameters
| Name | Description | Type |
|---|
| geometry | geometry ที่จะ project | Geometry |
Returns
| Type | Description |
|---|
| Geometry | Return Geometry โดยมี SpatialReference SPATIALREF_WGS84 |
fun projectToMercator(geometry: Geometry): Geometry
project Geometry โดย SpatialReference คือ SPATIALREF_WEBMER
Parameters
| Name | Description | Type |
|---|
| geometry | geometry ที่จะ project | Geometry |
Returns
| Type | Description |
|---|
| Geometry | Return Geometry โดยมี SpatialReference SPATIALREF_WEBMER |
fun projectToUTM(geometry: Geometry): Geometry
project Geometry โดย SpatialReference คือ SPATIALREF_WGS47
Parameters
| Name | Description | Type |
|---|
| geometry | geometry ที่จะ project | Geometry |
Returns
| Type | Description |
|---|
| Geometry | Return Geometry โดยมี SpatialReference SPATIALREF_WGS47 |
fun convertStringToPoint(text: String): Point
แปลง String เป็น Point โดยมี SpatialReference คือ SPATIALREF_WGS47
Parameters
| Name | Description | Type |
|---|
| text | WKTEXT ที่จะแปลง | String |
Returns
| Type | Description |
|---|
| Point | Return Point โดยมี SpatialReference คือ SPATIALREF_WGS47 |
fun convertStringToPoint(text: String , wkid: Int): Point
แปลง String เป็น Point โดยมี SpatialReference กำหนดตาม WKID
Parameters
| Name | Description | Type |
|---|
| text | WKTEXT ที่จะแปลง | String |
| wkid | WKID ที่ต้องการ | Int |
Returns
| Type | Description |
|---|
| Point | Return Point โดยมี SpatialReference ตาม WKID |
fun convertStringToPolygon(text: String): Polygon
แปลง String เป็น Polygon รองรับ MultiPolygon
Parameters
| Name | Description | Type |
|---|
| text | WKTEXT ที่จะแปลง | String |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon |
fun convertStringToPolygon(text: String , wkid: Int): Polygon
แปลง String เป็น Polygon รองรับ MultiPolygon
Parameters
| Name | Description | Type |
|---|
| text | WKTEXT ที่จะแปลง | String |
| wkid | WKID ที่ต้องการ | Int |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon โดยมี SpatialReference ตาม WKID |
fun convertStringToPolyline(text: String): Polyline
แปลง String เป็น Polyline
Parameters
| Name | Description | Type |
|---|
| text | WKTEXT ที่จะแปลง | String |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline |
fun convertStringToPolyline(text: String, wkid: Int?): Polyline
แปลง String เป็น Polyline
Parameters
| Name | Description | Type |
|---|
| text | WKTEXT ที่จะแปลง | String |
| wkid | WKID ที่ต้องการ ถ้าใส่ null จะ ตั้งต้นที่ค่า WKID_24047 | Int? |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline โดยมี SpatialReference ตาม WKID |
fun convertPolylineToString(polyline: Polyline): StringBuilder
แปลง Polyline เป็น String WKTEXT
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| StringBuilder | Return String โดยมีรูปแบบ WKTEXT |
fun convertPolygonToString(polygon: Polygon, isPolygon: Boolean): StringBuilder
แปลง Polygon เป็น String WKTEXT รองรับ MultiPolygon
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
| isPolygon | true คือ Polygon false คือ MultiPolygon | Boolean |
Returns
| Type | Description |
|---|
| StringBuilder | Return String รูปแบบ WKTEXT |
fun convertJsonObjectToGeometry(geometryJsonObject: JsonObject, geometryType: String): Geometry
แปลง JsonObject ที่เป็น Geometry ไปเป็น Geometry
Parameters
| Name | Description | Type |
|---|
| geometryJsonObject | geometryJsonObject ที่จะแปลง | JsonObject |
| geometryType | type ที่ต้องการจะแปลง เช่น Point , Polyline | String |
Returns
| Type | Description |
|---|
| Geometry | Return Geometry ที่แปลงแล้วตาม geometryType |
fun convertPointToWgs84(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS84
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS84 |
fun convertPointToLatLong(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_4326
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_4326 |
fun convertPointToWebMercator(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMER
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER |
fun convertIndianPointToWebMercator(point: Point): Point
แปลง Indian Point ให้ Point มี SpatialReference คือ SPATIALREF_WEBMER
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER |
fun convertPointToIndian47(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ WKID_24047
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24047 |
fun convertPointToIndian48(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ WKID_24048
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24048 |
fun convertPointToWgs47(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS47
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS47 |
fun convertPointToWgs48(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_WGS48
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS48 |
fun convertPointToSketchEditorSpatial(point: Point): Point
แปลง Point ให้ Point มี SpatialReference คือ SPATIALREF_3857
Parameters
| Name | Description | Type |
|---|
| point | Point ที่จะแปลง | Point |
Returns
| Type | Description |
|---|
| Point | Return Point ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_3857 |
fun convertPolylineToWgs84(polyline: Polyline): Polyline
แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS84
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS84 |
fun convertPolylineToWebMercator(polyline: Polyline): Polyline
แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMER
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER |
fun convertIndianPolylineToWebMercator(polyline: Polyline): Polyline
แปลง Indian Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WEBMER
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER |
fun convertPolylineToIndian47(polyline: Polyline): Polyline
แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24047
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24047 |
fun convertPolylineToIndian48(polyline: Polyline): Polyline
แปลง Polyline ให้ Polyline มี SpatialReference คือ WKID_24048
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24048 |
fun convertPolylineToWgs47(polyline: Polyline): Polyline
แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS47
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS47 |
fun convertPolylineToWgs48(polyline: Polyline): Polyline
แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_WGS48
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS48 |
fun convertPolylineToSketchEditorSpatial(polyline: Polyline): Polyline
แปลง Polyline ให้ Polyline มี SpatialReference คือ SPATIALREF_3857
Parameters
| Name | Description | Type |
|---|
| polyline | Polyline ที่จะแปลง | Polyline |
Returns
| Type | Description |
|---|
| Polyline | Return Polyline ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_3857 |
fun convertPolygonToWgs84(polygon: Polygon): Polygon
แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS84
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS84 |
fun convertPolygonToWebMercator(polygon: Polygon): Polygon
แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMER
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER |
fun convertIndianPolygonToWebMercator(polygon: Polygon): Polygon
แปลง Indian Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WEBMER
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WEBMER |
fun convertPolygonToIndian47(polygon: Polygon): Polygon
แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24047
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24047 |
fun convertPolygonToIndian48(polygon: Polygon): Polygon
แปลง Polygon ให้ Polygon มี SpatialReference คือ WKID_24048
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ WKID_24048 |
fun convertPolygonToWgs47(polygon: Polygon): Polygon
แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS47
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS47 |
fun convertPolygonToWgs48(polygon: Polygon): Polygon
แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_WGS48
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_WGS48 |
fun convertPolygonToSketchEditorSpatial(polygon: Polygon): Polygon
แปลง Polygon ให้ Polygon มี SpatialReference คือ SPATIALREF_3857
Parameters
| Name | Description | Type |
|---|
| polygon | Polygon ที่จะแปลง | Polygon |
Returns
| Type | Description |
|---|
| Polygon | Return Polygon ที่แปลงแล้วโดยมี SpatialReference คือ SPATIALREF_3857 |
fun createPointDrawableGraphic(context: Context , point: Point , drawableName : Int , markerOffsetY : Float = 3f): Graphic
สร้าง Graphic จาก Drawable ID ใน res
Parameters
| Name | Description | Type | Default |
|---|
| context | context ของ Fragment หรือ Activity ที่จะแสดง Graphic | Context | |
| point | Point ที่ต้องการแสดง Graphic | Point | |
| drawableName | Drawable ID ใน res เช่น R.drawable.xxx | Int | |
| markerOffsetY | ตำแหน่ง Graphic ณ จุดนั้น ว่าให้สูงขึ้นมาจากจุดนั้น | Float | 3f |
Returns
| Type | Description |
|---|
| Graphic | Return Graphic ที่แสดงสัญลักษณ์จาก drawable ที่เรากำหนด |