Resmi Satish

Resmi Satish

  • NA
  • 110
  • 75.2k

Calculate distance using GetDistanceTo for GeoCoordinate

May 29 2014 6:30 AM
I have to calculate the distance between 2 places using latitude and longitude.


Here I am calculating distance between Delhi and Gurgaon.

refer :http://www.mapcrow.info/Distance_between_Delhi_IN_and_Gurgaon_IN.html

using System.Device.Location;
{
GeoCoordinate distanceFrom=new GeoCoordinate();
GeoCoordinate distanceTo=new GeoCoordinate();

distanceFrom.Latitude = 77.2167;
distanceFrom.Longitude = -28.6667;

distanceTo.Latitude = 77.0333;
distanceTo.Longitude = -28.4667;

double distance = distanceFrom.GetDistanceTo(distanceTo);
}

However I don't know  in what unit the value is return(kilometer or miles).
And also I  am not sure whether the value return is correct or not.

Please help me to sort out the issue.

Answers (3)