Distance Between Two Postcodes


I am just wondering if someone can help me please. I have requirements to develop a form for sales reps where they could populate a post code and radius and upon pressing a button all customers under the radius of that postcode could appear in that form.

I have populated longitude and latitude for each postcode in postcode table. Can someone help me in writing formula in AX 2012 R2 which could calculate the distance between two postcodes using longitude and latitude or any other way of doing this ?


The formula is nothing specific to AX; you can easily find it on internet.

Nevertheless I wouldn’t try to invent the wheel, I would simply call GeoCoordinate.GetDistanceTo() through .NET Interop.

Thank you very much Martin. It solved my problem.