>want to find out how far certain churches are from where they live.
For instance, display results for churches that are within 25 miles of
where the person lives?
Some web sites ask for a Zip code (assuming this is in the USA) and
translate this to a set of coordinates for the center of that Zip
code. Then you calculate the distance between that point and the
known coordinates of the churches to select the close ones.
It may be to your advantage to precalculate some of this, especially
if the radius is ALWAYS 25 miles. For each church, calculate a
list of Zip codes with a center point within 25 miles. Populate
the database with that info, and you don't have to do any distance
calculations once you've set up the data. Just look up the churches
close to the zip code in question.
You can use any coordinate system you want. For a large radius
(like 1000 miles), you may need to use latitude/longitude degrees
and the appropriate distance formula. For a smaller radius, where
the curvature of the Earth is not relevant, coordinates on any map
grid and the usual distance formula:
r = (x2-x1)**2 + (y2-y1)**2
is fine.
I have heard rumors of a Zip-code-to-coordinates database. I think
the info in the Bureau of the Census TIGER data could be used to
derive one, but it's really too detailed for direct use (but it
could possibly be used to translate street addresses to coordinates
at the street block level, but it likely requires a very clever
parser). TIGER data for some of the larger counties in Texas is
2-4 megabytes of .zip file.
Gordon L. Burditt