Can anyone help me get started on putting together the building
blocks for the kind of cgi known as a zip code locator?
Is there a relatively simple algorhythm one can use to match people
with particular stores and such near them? Or do you really need to
populate a database with every single zip in the US and match people
by brute force?
I'd really appreciate a bit of insight from those of you who've
attempted or completed this kind of project.
Thanks!
Blake
--
________________________ ___________
LONDON - Former students at two British schools, judged
by government inspectors as failing their pupils, are ------------
suing [the schools] for their poor education. REUTERS B. Kritzberg
: Is there a relatively simple algorhythm one can use to match people
: with particular stores and such near them? Or do you really need to
: populate a database with every single zip in the US and match people
: by brute force?
well, you already need a database of stores and their addresses. you could
build an inverted index for all the zip codes present in the database, then
show the user the stores with the zip code closest to the one that s/he
entered.
somewhere out there is a web page that takes your address and tells you
who your congressman is. don't recall the address or the name, but they
might be able to help :)
In article <5augma$1...@Holly.aa.net>, krit...@ucsub.Colorado.EDU (Blake
Kritzberg) wrote:
.
: Is there a relatively simple algorhythm one can use to match people
: with particular stores and such near them? Or do you really need to
: populate a database with every single zip in the US and match people
: by brute force?
Unfortunately, there is no algorithm that you can use to determine distance
between two zipcodes based on their numerical similarity. While it is
generally true that closer locations will tend to share more zip codes
digits (counting from the left), this is an extremely unreliable indicator
of distance. For instance, you may have two zip codes that share 3 digits
that are 200 miles apart, while two that only share 1 or 2 digits may be 2
miles apart (especially, but not only, at state boundaries). The best way
to do this accurately is to use the latitude and longitude coordinates of
the zipcodes and then use a formula to calculate the distance between them.
The correct formula is:
miles = 3963.0 * acos(sin(zip1.lat) * sin(zip2.lat) + cos(zip1.lat) *
cos(zip2.lat) * cos(zip2.lon - zip1.lon))
In this equation, the latitude and longitude are in radians rather than
degrees in order to make the distance calculations simpler. If you need to
convert them from degrees, simply multiply by PI (3.14159) and divide by
180.
Note:
zip1.lat means the latitude (in radians) of zip code 1.
You can find a web site that does this at http://link-usa.com/zipcode/
Hope this helps,
Dave Belote
da...@link-usa.com