Page 1 of 1

Location

Posted: Mon Jul 31, 2006 12:39 am
by 4Boredom
I want my users to be able to search for users close to them.. I see some sites do it by zip code (for US users) but I have no idea how to do that....

I could do it by state if I cant figure out this.... but zip codes seem to do distance best....

My only question... Is there a resource somewhere that helps calculate this or do you have to do it manually?

Posted: Mon Jul 31, 2006 12:48 am
by daedalus__
I'm pretty sure I ran across a list of every zip code in the US the other day, if that helps.

Posted: Mon Jul 31, 2006 12:52 am
by RobertGonzalez
You would probably be well served to search these forums for 'zip codes'. There are a ton of resources already about this topic, as well as links to free Zip Code data dumps and prebuilt zip code proximity scripts. I know for a fact that astions and Burrito have posted about this fairly recently.

Posted: Sun Sep 30, 2007 2:29 pm
by MicahCarrick
I also posted a free PHP script and MySQL database for this: PHP Zip Code Range and Distance Calculation

Posted: Sun Sep 30, 2007 5:37 pm
by RobertGonzalez
That is pretty sweet. I will certainly be paying that a read soon.

Posted: Mon Oct 01, 2007 5:01 am
by s.dot
if you have a search for my name on here and 'zip', some solutions will come up. i've done this with the help of people on this forum a long time ago.

Posted: Mon Oct 01, 2007 6:23 am
by ayvah
Out of curiousity, do any of the listed options include support for zip/postcodes in any non-US countries?

Posted: Mon Oct 01, 2007 9:15 am
by Maugrim_The_Reaper
Doubtful - not every country even has a postcode system...;).

Posted: Mon Oct 01, 2007 12:23 pm
by Christopher
I usually use Google to do this because you get back exact long/lat for the address, not the postal code. That makes a big difference when the distances are close.

Posted: Mon Oct 01, 2007 1:28 pm
by Kieran Huggins
The Google Maps API is quite good, but obviously not perfect. The strongest case to use it is that is accepts free-form address input, which is the only way to collect international addresses with any accuracy.

Also, I hear Google has routing built in to their API now, so you might be able to get the driving distance as well as the "as the crow flies" distance.

Posted: Mon Oct 01, 2007 1:34 pm
by s.dot
ayvah wrote:Out of curiousity, do any of the listed options include support for zip/postcodes in any non-US countries?
Canada and Mexico, that I know of. I believe England and some other European countries, too, but I cannot say that with certainty.