How to find distance from the latitude and longitude of two locations?

The Haversine formula assumes a spherical earth. However, the shape of the earh is more complex. An oblate spheroid model will give better results. If such accuracy is needed, you should better use Vincenty inverse formula. See http://en.wikipedia.org/wiki/Vincenty’s_formulae for details. Using it, you can get a 0.5mm accuracy for the spheroid model. There is no … Read more

Java, convert lat/lon to UTM [closed]

No Library, No Nothing. Copy This! Using These Two Classes , You can Convert Degree(latitude/longitude) to UTM and Vice Versa! private class Deg2UTM { double Easting; double Northing; int Zone; char Letter; private Deg2UTM(double Lat,double Lon) { Zone= (int) Math.floor(Lon/6+31); if (Lat<-72) Letter=”C”; else if (Lat<-64) Letter=”D”; else if (Lat<-56) Letter=”E”; else if (Lat<-48) Letter=”F”; … Read more

Getting distance between two points based on latitude/longitude

Update: 04/2018: Vincenty distance is deprecated since GeoPy version 1.13 – you should use geopy.distance.distance() instead! The answers above are based on the Haversine formula, which assumes the earth is a sphere, which results in errors of up to about 0.5% (according to help(geopy.distance)). Vincenty distance uses more accurate ellipsoidal models such as WGS-84, and … Read more