...

View Full Version : How to implement a "smart" search by city, state and/or zip



stv2011
11-11-2011, 04:15 PM
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?

mlseim
11-11-2011, 05:44 PM
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.?


.

myfayt
11-11-2011, 07:00 PM
Take a look at this.

http://www.zipcodestogo.com/php-radius-search.htm

mlseim
11-11-2011, 07:08 PM
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.


.

stv2011
11-11-2011, 11:10 PM
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?

mlseim
11-11-2011, 11:34 PM
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.

myfayt
11-11-2011, 11:37 PM
These scripts contain code for both radius searches and distance calculations.

Meaning you can set them up to be 10 miles, 25 miles, etc

mlseim
11-11-2011, 11:39 PM
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.


.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum