Re: Finding nearby zip codes (or maybe area codes) programatically
- From: The Natural Philosopher <a@xxx>
- Date: Sun, 21 Dec 2008 17:27:00 +0000
Bill H wrote:
On Dec 21, 10:32 am, sheldonlg <sheldonlg> wrote:try crating an index on latitude and longitude so that enquires that are within a certain range of lat and long can be quickly accessed.houghi wrote:Bill H wrote:This won't work! Mileage differences between the same two longitudesSure. It's about 5 years old so I may be missing a few zip codes butPut it on a website in zip. If you are unable to do that, just mail it
it is better than entering everything in by hand. How would I do that
on here, it is a text file but about 1.6mb in size?
to me and I will put it on my website. That way anybody can use that
file.
I am wondering if the following would work:
1) make a list with difference in Latitude
2) make a list with difference in Longitude
are different depending upon the latitude. For example, the mileage
difference between any two longitudes is zero at a latitude of 90
degrees north or south. It works for latitude because all longitudes
are great circles. All latitudes, however, are parallel circles with
varying radii.
3) See what the code it on both list with the lowest in both lists- Show quoted text -
houghi- Hide quoted text -
Actually it does work in this specific situation for US zip codes. If
you have a field that contains how far north of the equator a zip code
is, and the data is then sorted on this field before being placed into
the table.
Then when you get the record for the zip code you are looking at, all
data before it in the table is closer to the equator, all data after
it is farther. If you pull out a block of the data that is within 100
miles of your zips distance then you need only check the actual
distance of these records to see if they are within 100 miles of the
zip code. Using this eliminates checking zip codes that are no where
near what you are looking for and only checking those that may be.
Jerry - I went back and read your post about creating a box containing
all the zips within a certain distance and then never having to
calculate the distance again. This is a great idea if you have a fixed
distance and I was actually going to do this. But if you have multiple
distances or a variable one, I think this method works. Also I totally
understand you proint about how this should be discussed in the mysql
group, but my feelings (and I could be wrong) is that php is used so
much for database access (at least based on what I have been reading
in this group) that it should be discussed here.
Bill H
then you can process those to find a better selection.
.
- Follow-Ups:
- References:
- Finding nearby zip codes (or maybe area codes) programatically
- From: Anthony Papillion
- Re: Finding nearby zip codes (or maybe area codes) programatically
- From: Charles Polisher
- Re: Finding nearby zip codes (or maybe area codes) programatically
- From: Bill H
- Re: Finding nearby zip codes (or maybe area codes) programatically
- From: houghi
- Re: Finding nearby zip codes (or maybe area codes) programatically
- From: Bill H
- Re: Finding nearby zip codes (or maybe area codes) programatically
- From: houghi
- Re: Finding nearby zip codes (or maybe area codes) programatically
- From: sheldonlg
- Re: Finding nearby zip codes (or maybe area codes) programatically
- From: Bill H
- Finding nearby zip codes (or maybe area codes) programatically
- Prev by Date: Re: Finding nearby zip codes (or maybe area codes) programatically
- Next by Date: Re: Problem with PHP5 session module
- Previous by thread: Re: Finding nearby zip codes (or maybe area codes) programatically
- Next by thread: Re: Finding nearby zip codes (or maybe area codes) programatically
- Index(es):
Relevant Pages
|
Loading