Jump to content

Archived

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

kipper

Zip Code Locator

Recommended Posts

Hi there, this is a request for code snippet.

 

I was looking to find the best way to create a zip code locator? As we have all seen as a store locator. For example, like http://www.bestbuy.com/site/olspage.jsp?id=cat12090&type=page.

 

I don't need to search by the address, just the zip code. I have a number of stores, where I have the latitude and longitude. In my application, when I add a store, it inputs the lat and long in the database.

 

Now, my challenge, is for a user to enters their zip code, it would show all the stores in a 50 mile radius. Or whatever radius I decide on.

 

This is where I ask your feedback. I can buy a database with all the zip codes in the US. ( just USA), and do some sort of calculation based on the lat and long.

 

OR

 

Use an API. Perhaps Google. I would lean towards this one.

 

I don't need the map to show up. I would start with a very basic list of the stores. Just like the Best Buy example, I only want to return the list of stores.

 

Which way????

 

Thanks

Kip

Share this post


Link to post
Share on other sites

This is a pretty common question. You can see here for more info:

http://www.phpfreaks.com/forums/faqcode-snippet-repository/finding-a-location-within-x-mileskm-of-an-postal-code/

 

For if you should do your own DB/API - depends on the usage I guess. If it is smaller use the API, its update often & a lot less work. If you're in need of a larger solution that may outgrow the limits of the API, then take a look at the zipcode database in the topic I linked above (it's free!)

Share this post


Link to post
Share on other sites

I would be happy to hear from others on this. I see this is dated from 2008. Some of the code doesn't work and  it requires one to pay for one of the services.

 

So, if I have a database with a table of all the zip codes.

I have store location with the zip codes.

 

What is the best way to have a form, where an end user enters their zip code and it pulls up a 30 mile radius, of stores in that 30 mile radius.

Share this post


Link to post
Share on other sites

×

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.