i'm getting coordinates on my devices but i need to validate this coordinates with server coordinates , like both are different or same else if i set some range 100meters ,it was in the range or not like dat.
Any way i need to validate both coordinates ,any one suggests me ????
private static Double FindDistance(Double lat1, Double lon1, Double lat2, Double lon2)
{
const Int32 R = 6371; // km
Double dLat = (lat2 - lat1) / (180 / Math.PI);
Double dLon = (lon2 - lon1) / (180 / Math.PI);
Double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +
Math.Cos(lat1 / (180 / Math.PI)) * Math.Cos(lat2 / (180 / Math.PI)) *
Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
Double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
return (R * c);
}