[nycphp-talk] distances between two zip codes
John Campbell
jcampbell1 at gmail.com
Fri Dec 7 00:09:39 EST 2007
> I want to program php to calculate the distance between two zip codes.I
> only have zip codes,nothing else.How to do it?I'm completely lost.
You need to calculate the distance between the centroids of the zip
codes. Zip codes centroids (lat,lng pairs) are free and published.
(Search for "zip code centroid")
1) import the zip code data into your database
2) Use a formula to calculate the distance between the lat,lng pairs.
(just google for "haversine formula")
I assume you can fill in the rest, but let me know if that is not enough.
Regards,
John Campbell
More information about the talk
mailing list