Distance calculation between two points on the map is not as straightforward as you would think, here approximation in C#, using Equirectangular approximation, which is good if you need performance loosing some of the accuracy:

`````` public static double RadianConversion = Math.PI / 180;

public static double GetDistanceInKilometers(this IGeoCoords fromPoint, IGeoCoords toPoint)
{
if (fromPoint == null || toPoint == null)
{
return 0;
}

var long2 = (double)fromPoint.Longitude * RadianConversion;
var long1 = (double)toPoint.Longitude * RadianConversion;
var lat2 = (double)fromPoint.Latitude * RadianConversion;
var lat1 = (double)toPoint.Latitude * RadianConversion;

// The formula is an approximation
// Accuracy is somewhat complex: along meridians there are no errors, otherwise they depend on distance, bearing, and latitude, but are small enough for many purposes.
var x = (long2 - long1) * Math.Cos((lat1 + lat2) / 2d);
var y = lat2 - lat1;
var d = Math.Sqrt((x * x) + (y * y)) * 6371; // 6371 - earth radius in km

return d;
}
``````