Jump to content

Understanding zip/post code searches


graham23s

Recommended Posts

Hi Guys,

 

i am trying to do some homework on this befoire i start to program it, i have 15 countries zip/post codes in .csv format, to be able to search against them i take it i need to store ALL countries zips into mysql would that be right?

 

this is some random US codes

 

601,18.181171,-66.749854,PR
602,18.364202,-67.182976,PR
603,18.449494,-67.112922,PR
604,18.501813,-67.1365,PR
606,18.172947,-66.944111,PR
610,18.293884,-67.130136,PR
612,18.399442,-66.711296,PR
616,18.401685,-66.666454,PR

 

 

im not to sure what the digits mean can anyone explain to me?

 

thanks guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/97528-understanding-zippost-code-searches/
Share on other sites

it is hard to guess that the longitude and latitude are the coordinates of the CENTER of the zip code, and how far from the center you have to go to get to the NEXT zip code.

as in

601,18.181171,-66.749854,PR

602,18.364202,-67.182976,PR

you are in zip code 601 if you are standing at 18.181171,-66.749854

but if you move halfway towards 18.364202,-67.182976

does that mean you have just crossed the boundary into zip code 602?

PR means something but what?

 

I tackled this problem a while back the trick is

1) User inputs a zip code

2) Search a table of Zip codes for that zip codes long/lat position (mysql query it)

3) Take the results of the query and develop a range (1 degree of long = 86 miles) so a 50 mile range is like +/- 3/4 of a degree

4) Then query your zip Table again for Zip codes in the range of that +/- the result

5) Then take the array of valid zips for use in you query of your dataset initially intended to be queried with other criteria.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.