Is it possible to send two lat long points to google to calculate the distance between the two?
And the distance cal in c#:
// this returns the distance in miles. for km multiply result: * 1.609344
public static double CalculateDistance(double lat1, double lon1, double lat2, double lon2)
{
double t = lon1 - lon2;
double distance = Math.Sin(Degree2Radius(lat1)) * Math.Sin(Degree2Radius(lat2)) + Math.Cos(Degree2Radius(lat1)) * Math.Cos(Degree2Radius(lat2)) * Math.Cos(Degree2Radius(t));
distance = Math.Acos(distance);
distance = Radius2Degree(distance);
distance = distance * 60 * 1.1515;
return distance;
}
private static double Degree2Radius(double deg)
{
return (deg * Math.PI / 180.0);
}
private static double Radius2Degree(double rad)
{
return rad / Math.PI * 180.0;
}