Page 1 of 1

distance between zip codes

Posted: Tue Apr 25, 2006 6:54 pm
by hjones21
Does anyone know how i can determine the distance between zip codes.
So for example, right now i have a list of zip codes that get pulled from a mysql dbase upon the users entry.
I would like to put the distances between each zip code in miles .

Any ideas?

Thanks

Posted: Tue Apr 25, 2006 6:59 pm
by alex.barylski
You need a zipcode database (Canada isn't free, but I believe you can get the USA postal code database for free)...

The databases usually include latitude/longitude coordinates for a zipcode center.

Using these coordinates it's becomes quite trvial to calculate a great circle...aka the distance your after...

Poke around these forums, as I'm sure this question has been asked before and I recall someone having written a class which performs the calculation for you...which is easy to implement, but not trivial by any means...

Cheers :)