Forum Discussion
How to Calculate Distance on map from one Postcode to Another Postcode
- 6 years ago
Greg_Deckler Wow this is fantastic, let me have a good look at it tomorrow so I can accept the solution , I'll let you know, but definitely amazing...
Right so your basic formula for short distances is:
dlon = lon2 - lon1
dlat = lat2 - lat1
a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2
c = 2 * atan2( sqrt(a), sqrt(1-a) )
d = R * c (where R is the radius of the Earth)
So you could do it (with lots of caveats in terms of the accuracy of the output of the above formula since the Earth isn't a perfect sphere) if you had the longitudes and latitudes of those zip codes.
Greg_Deckler Thanks for the update, any chance you can have at the look at the PBix file updated with (hyperlink) as see how will be the best way to add the calculation based on the data. Much appreciated in advance.