How to Validate the coordinates from .net web-services with my device?

Go To StackoverFlow.com

0

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 ????

2012-04-04 07:12
by Crishnan


3

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);
}
2012-04-04 07:17
by user1293140
@pjumble ... how u define this"const Int32 R = 6371; " you did any deceleration Like contstants.. i mean while i was writing this line in ECLIPSE its getting error on declaration - Crishnan 2012-04-12 11:34
i'm not getting const Int32 R = 6371; what kind of decleration it is. - Crishnan 2012-04-12 12:24
It is C# code, you can use int or Integer in place of Int32 here in JAV - user1293140 2012-04-20 10:24
Ads