# |FAQ| Zip code related questions

#### Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
Q: How to find the distance between two zip codes/cities?
Q: How to find list of cities/zip codes that are with in the particular

A: In spherical trigonometry, we have haversine formula, which provides
relationship between the radius of the sphere and any two points on the
sphere (longitude and latitude of the points). So, if we take the earth
as a sphere and have longitude and latitude of any two cities, we can
find the distance approximately.

Developed countries like U.S. have census data that contains the zip
code, longitude and latitude of a particular city (along with
population data); this in turn helped a lot to find the distance
between any two cities or any two zip codes using the database. Not to
mention, even many commercial zip code databases are available for that
purpose.

Once we have the Zip code database, it's merely a calculation over the
data.

Refer:
1. http://www.census.gov/cgi-bin/geo/gisfaq?Q5.1 (Down now, alternative
is http://www.movable-type.co.uk/scripts/GIS-FAQ-5.1.html )
2. http://en.wikipedia.org/wiki/Haversine_formula haversine formula
3. http://www.census.gov/geo/www/gazetteer/places2k.html 2000 U.S.
Gazetteer
4. http://www.phpclasses.org/phpziplocator
5. http://www.phparchitect.com/sample.php?disc_show=316&mid=9

++++
@todo Grammar fix

## Re: |FAQ| Zip code related questions

ZIP Code Database with Latitude and Longitude
http://www.zipcodeworld.com

Free PHP Sample Codes
http://www.zipcodeworld.com/developers.htm