I have used the algorithm on http://www.movable-type.co.uk/scripts/latlong.html to find the distance between two points.
My two points are
long1 = 51.507467;
lat1 = -0.08776;
long2 = 51.508736;
lat2 = -0.08612;
According to Movable Type Script the answer is 0.1812km
My application gives the result (d
) as 0.230km
// Haversine formula: (http://www.movable-type.co.uk/scripts/latlong.html)
double R = 6371; // earth’s radius (mean radius = 6,371km)
double dLat = Math.toRadians(lat2-lat1);
double dLon = Math.toRadians(long2-long1);
a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
double d = R * c;