Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move a LatLng 5 meters towards another LatLng

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.

like image 983
zafrani Avatar asked Oct 27 '14 18:10

zafrani


1 Answers

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

like image 164
alpinescrambler Avatar answered Oct 06 '22 03:10

alpinescrambler