How do I get the lat/long of point X which is 1KM north to lat/long point Y (such as 39.777012,-105.068951)?
In Java CODE please! No external links (I don't read math). Thanks..
How do I get the lat/long of point X which is 1KM north to lat/long point Y (such as 39.777012,-105.068951)?
In Java CODE please! No external links (I don't read math). Thanks..
Use the answer you posted in your code, UnitConstants.DegreesToRadians
is defined as follow:
double DegreesToRadians = Math.PI / 180.0;
You could also use Math.toRadians
to do the conversion (Thanks to @Hovercraft Full Of Eels for pointing this out)
Calculating such a distance is done using some mathematical formulas that use radians not degrees and that's why all angles need to be transformed to radian by applying the UnitConstants.DegreesToRadians
factor, more info here
Call the method defined in the previous link I have provided like this:
LatLonAlt dest= CalculateDerivedPosition(source, 1000, 0);
source
being the source point, 1000
is 1KM to the destination point and 0
degrees (or radians) as the destination point is on the north compared to the source point.
Not to repeat the information, have a look at this SO answer. Have a look at this article as well, it will definitely help you out.