Location

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

Location

Post 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?
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

I'm pretty sure I ran across a list of every zip code in the US the other day, if that helps.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
MicahCarrick
Forum Newbie
Posts: 23
Joined: Sat Apr 09, 2005 5:40 pm

Post by MicahCarrick »

I also posted a free PHP script and MySQL database for this: PHP Zip Code Range and Distance Calculation
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

That is pretty sweet. I will certainly be paying that a read soon.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
ayvah
Forum Newbie
Posts: 4
Joined: Sun Sep 30, 2007 12:43 am
Location: Australia

Post by ayvah »

Out of curiousity, do any of the listed options include support for zip/postcodes in any non-US countries?
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Doubtful - not every country even has a postcode system...;).
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post 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.
(#10850)
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply