Move a LatLng 5 meters towards another LatLng

我与影子孤独终老i 提交于 2019-12-21 04:42:31

问题


What algorithm/formula can I use to calculate a LatLng point 5 meters closer to another LatLng point? I'm trying to write a function with 2 LatLng parameters and have it return a LatLng that is 5 meters from the first LatLng and in the direction of the second LatLng.


回答1:


Have a look at Android Map Utils library, specifically the SphericalUtil class.

1.) Call the method computeHeading to obtain your heading from first to second

2.) Call the method computeOffset to solve for the location 5 meters from your first point

Hope this helps



来源:https://stackoverflow.com/questions/26594445/move-a-latlng-5-meters-towards-another-latlng

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!