【问题标题】:Android ESRI map how to get the latitude longitude from screen pointAndroid ESRI地图如何从屏幕点获取纬度经度
【发布时间】:2020-08-26 06:40:47
【问题描述】:

我知道我们可以使用这个从 ESRI 地图上的触摸位置获取screenPoint

val screenPoint = android.graphics.Point(motionEvent.x.roundToInt(), motionEvent.y.roundToInt())

我们也可以使用这个从screenPoint 获取mapPoint

val mapPoint = mapView?.screenToLocation(screenPoint)

现在我如何从这些screenPointmapPoint 获取纬度和经度

【问题讨论】:

    标签: esri-maps arcgis-android-api


    【解决方案1】:

    你可以得到CoordinateFormatter如下

    val mapPoint = mapView?.screenToLocation(screenPoint)
                val toLatitudeLongitude = CoordinateFormatter.toLatitudeLongitude(mapPoint, CoordinateFormatter.LatitudeLongitudeFormat.DECIMAL_DEGREES, 4)
                val point = CoordinateFormatter.fromLatitudeLongitude(toLatitudeLongitude, spatialReference)
                val latitude = point.x
                val longitude = point.y
    

    参考:https://developers.arcgis.com/android/latest/java/sample-code/format-coordinates/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-21
      • 1970-01-01
      • 2013-07-24
      • 1970-01-01
      • 2010-12-02
      • 1970-01-01
      相关资源
      最近更新 更多