esri-maps - Android ESRI地图如何从屏幕点获取纬度经度
问题描述
我知道我们可以screenPoint
使用这个从 ESRI 地图上的触摸位置获取
val screenPoint = android.graphics.Point(motionEvent.x.roundToInt(), motionEvent.y.roundToInt())
我们也可以mapPoint
从screenPoint
使用这个
val mapPoint = mapView?.screenToLocation(screenPoint)
现在我如何从这些screenPoint
或mapPoint
解决方案
你可以得到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/
推荐阅读
- sql - 从 SQL Server 中的字符串转换日期和/或时间
- mysql - 在 WHERE 语句列名中使用变量
- html - 即使在静音和遵守不同的浏览器规则后,自动播放也不适用于 html 视频
- perl - perl中拆分语法中缺少表达式
- python - 如何将实例绑定描述符作为引用参数传递给函数?
- xcode - 如何在不使用 Xcode 的情况下导出 Apple Developer Id 证书
- java - Java cucumber IllegalArgumentException 路径不一致
- php - 表查询,从table1中选择数据,但前提是table2中的用户设置设置为特定值
- javascript - 从胡须模板 Moodle 3.7 中获取数据
- internationalization - 全球分数的 PageSpeed Insights