Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-11-2011, 03:15 PM   PM User | #1
stv2011
New to the CF scene

 
Join Date: Nov 2011
Location: USA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
stv2011 is an unknown quantity at this point
How to implement a "smart" search by city, state and/or zip

I am working on a job board site and would like a similar search like the big sites. I.e. when you search a job by zip code and proximity (miles) it will bring up all jobs within that proximity according to zip code radius. And it should do the same for city.

What would I need to do this?
stv2011 is offline   Reply With Quote
Old 11-11-2011, 04:44 PM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Is this U.S. only?

And how many jobs will be in your database list?

Google has a free API for this, but there are limits to
how many distance requests per hour, per day, etc.

Zipcode is easiest, but covers too large an area,
so you'll need to resolve it down to address.

If you were to use a Google map, you could populate that
map with markers (locating each job). Then, the user only
enters their location, and the map centers on their location.
They visually see the markers and can pan/zoom, etc.

To not use a map, but search your database would require a
"fetch" for each one to compare to user's location. That's where
the limits of usage come into play.

And another question ... how large of an area does your jobs database cover?
Is this for a particular city, or the whole U.S.?


.
mlseim is offline   Reply With Quote
Old 11-11-2011, 06:00 PM   PM User | #3
myfayt
Senior Coder

 
Join Date: Apr 2010
Posts: 1,156
Thanks: 46
Thanked 95 Times in 94 Posts
myfayt can only hope to improve
Take a look at this.

http://www.zipcodestogo.com/php-radius-search.htm
__________________
Been a sign maker for 5 years. My business:
American Made Signs
myfayt is offline   Reply With Quote
Old 11-11-2011, 06:08 PM   PM User | #4
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
But here's the problem with just zipcodes.

If I live in St. Paul, Minnesota, there might be 1000
jobs within my zipcode. No way to narrow that down
unless I change that resolution to street address.

You could utilize the "latitute" and "longitude" data that
they provide, but you would still need to convert your
street address to GPS location. So, you purchased the
zipcode database, and you still need to use Google or
Yahoo to do the address -> GPS conversion.


.
mlseim is offline   Reply With Quote
Old 11-11-2011, 10:10 PM   PM User | #5
stv2011
New to the CF scene

 
Join Date: Nov 2011
Location: USA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
stv2011 is an unknown quantity at this point
Is this U.S. only?
Yes, only in the US.

And how many jobs will be in your database list?
Initially, probably about 1k to 5k jobs.

Google has a free API for this, but there are limits to
how many distance requests per hour, per day, etc.
Thought about that, but want to implement something without any limits.

Zipcode is easiest, but covers too large an area,
so you'll need to resolve it down to address.
I agree. I want the site to also search by proximity by miles (10, 25, 50 miles.. etc.)

If you were to use a Google map, you could populate that
map with markers (locating each job). Then, the user only
enters their location, and the map centers on their location.
They visually see the markers and can pan/zoom, etc.
I want to have a straight forward list of jobs that come up after the user searches, similar to indeed, and monster.com.

To not use a map, but search your database would require a
"fetch" for each one to compare to user's location. That's where
the limits of usage come into play.

And another question ... how large of an area does your jobs database cover?
Is this for a particular city, or the whole U.S.?
The whole US. Any employer who signs up will be able to post a job as long as the job is in the US.

How do sites like indeed.com and monster go about this? Do they purchase a database of zips and cities like the link myfayt posted?
stv2011 is offline   Reply With Quote
Old 11-11-2011, 10:34 PM   PM User | #6
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
They have their own huge servers, and probably a lot of custom/proprietary programming.
Probably not PHP, but C++ or Windows server with ASP.net

How much money are you willing to spend on this?
Maybe you can subscribe to a service to handle the distances without limits.
mlseim is offline   Reply With Quote
Old 11-11-2011, 10:37 PM   PM User | #7
myfayt
Senior Coder

 
Join Date: Apr 2010
Posts: 1,156
Thanks: 46
Thanked 95 Times in 94 Posts
myfayt can only hope to improve
Quote:
These scripts contain code for both radius searches and distance calculations.
Meaning you can set them up to be 10 miles, 25 miles, etc
__________________
Been a sign maker for 5 years. My business:
American Made Signs
myfayt is offline   Reply With Quote
Old 11-11-2011, 10:39 PM   PM User | #8
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
myfayt ...

But how does the script know where the user is located.
They can't just enter a zipcode.

My zipcode covers 10 miles in several directions.


.

Last edited by mlseim; 11-11-2011 at 10:43 PM..
mlseim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:36 PM.


Advertisement
Log in to turn off these ads.