I have a point A (52.132781727864, -106,63492619991302). From point A i would like to get the lat, long of point B which is 5 km South from point A.
How can I get the the lat long of point B? I'm coding in Java.
Edit: If the point is in South-East what should I do?
5km in angles = ((5 / (6371 * pi)) * 180) = 0.0449660803. This number should be subtracted from the latitude. Longitude remains same.
PS. Thanks to Carlos Heuberger for correction.
http://en.wikipedia.org/wiki/Great-circle_distance
I highly recommend using GeoTools for earth surface geometry, as it factors in the earth as an ellipsoid (the earth is not a perfect sphere). In particular take a look at GeodeticCalculator where you set the starting position and direction (azimuth and distance) and then get the destination position.
Extending the question to "How can I find lat long of a point with a given lat long value, distance and direction", here an approximation for shorter distances (less than about 1000 km)
d = dist / 111.12 (1)
dlat = d * cos(dir)
latm = lat1 + dlat / 2
dlon = d * sin(dir) / cos(latm)
lat2 = lat1 + dlat
lon2 = lon1 + dlon
Where:
- lat1
and lon1
- the starting coordinates (North and East are positive)
- dist
- the distance in kilometers
- dir
- the starting direction (2)
- lat2
and lon2
- the resulting coordinates
(1) assuming the spherical earth model
(2) dir = 135°
for South-East
based on Astrosail - Mittelbreitenverfahren
I had the same problem a little time along. Since in my case the original data was in UTM, the product only had to work in a given zone, and the distance to add was not very big, all I had to do was calculating sinus and cosinus and adding easting and northing to the initial poing