从 Android 中的 myLocationOverlay 获取坐标值
我有一个应用程序,它使用地图来显示某个固定的位置。在下一次更新中,我想显示从用户当前位置到该固定点的路线。我已经设法通过 myLocationOverlay 获取用户位置。
据我所知,我需要将坐标发送到 Google 地图,接收包含这些点的 .kml 文件,并从中绘制路线。如何从 myLocationOverlay 获取纬度和经度值,或者有更好的方法来做我想做的事情吗?
TIA
I have an app that uses a map to show a certain, fixed, location. With the next update I'd like to show the route from the users current location to this fixed point. I already managed to get the users location via myLocationOverlay.
As far as I see it I need to send the coordinates to Google Maps, receive a .kml file with the points and draw the route from that. How can I get the values for latitude and longitude from myLocationOverlay or is there a better way to do what I want to do?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 从
MyLocationOverlay
获取我的位置。然后,您需要将GeoPoint
转换为其各自的纬度和经度。以下是 的参考Geo.java 包含一些可用于将
GeoPoint
转换为其相应的纬度和经度的函数。特别是你想使用这两个:和
You can use getMyLocation from
MyLocationOverlay
. You then need to convert theGeoPoint
into its respective degree for lat and long.Here is a reference for Geo.java that contains some of the function that you could use to convert the
GeoPoint
to its corresponding lat and longitude. In particular you want to use these two:And