I'm so confused. I'm finally getting around to needing to do a 'store
locator' thing.
I procured myself some zip/lat/long databases from various places. Then I
noticed that for the same zip code, I got different values in different
databases??!!!
So for a sanity check, I decided to look "online" and punch in some to see
what the "real" lat/long should be. Well, different sites give different
values, and not only are they "slightly" off, but sometimes they're
_positive_ or _negative_!? UGH!
http://www.zipinfo.com/cgi-local/zipsrch.exe?ll=ll&zip=98119&Go=Go
Seattle WA 98119 47.6388 122.3700
http://www.census.gov/cgi-bin/gazetteer?city=&state=&zip=98119
Location: 47.637917 N, 122.364272 W
http://www.csgnetwork.com/cgi-bin/zipcodes.cgi?Zipcode=98119
http://www.myzipdb.com/mzdb_demo.php
http://www.nearby.org.uk/coord.cgi?p=98119
City Seattle
State Abbreviation WA
State Washington
Latitude 47.638770
Longitude -122.366941
So I try the east coast:
http://www.zipinfo.com/cgi-local/zipsrch.exe?ll=ll&zip=14526&Go=Go
Penfield NY 14526 43.1532 77.4485
http://www.census.gov/cgi-bin/gazetteer?city=&state=&zip=14526
Location: 43.139638 N, 77.456043 W
http://www.csgnetwork.com/cgi-bin/zipcodes.cgi?Zipcode=14526
http://www.nearby.org.uk/coord.cgi?p=14526&f=full
City Penfield
State Abbreviation NY
State New York
Latitude 43.145342
Longitude -77.458499
Please help me to understand WTF is going on?
Which lat/long do I need?
How does the negatives effect the magic formulas to calculate distances?
(I'm no trig wiz).
I assume that the more precise the numbers, the better the results will be.
To what decimal point should I be concerned with?
---------------------
Use the value in degrees and decimals of degrees, not minutes, seconds,
etc...
For the Western longitude, use the negative value.
For instance the longitude and latitude of my zip code is -111.64338 and
33.436767.
There is already a PHP Class to do that job, never tested it, but I
programmed this already for SQL Server, I am sure that doing it for MySQL
would not be that complicated.
It does not matter if you are not 100% accurate, you are usually off by one
mile or two, but it gives an idea.