Postal codes within a radius
My hobby MVC website allows people to place adverts. When searching for adverts I would like the user to be able to specify a UK postal code and radius to filter the adverts down to ones within travelling distance. The trick to this was to record a list of UK postal codes and their latitude/longitude. The first step is to write a routine which will give a straight line distance between to coordinates: public static class MathExtender { public static double GetDistanceBetweenPoints(double sourceLatitude, double sourceLongitude, double destLatitude, double destLongitude) { double theta = sourceLongitude - destLongitude; double distance = Math.Sin(DegToRad(sourceLatitude)) * Math.Sin(DegToRad(destLatitude)) + Math.Cos(DegToRad(sourceLatitude)) * Math.Cos(DegToRad(destLatitud...