Jump to content

Zip Code Locator


kipper

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

Link to comment
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!)

Link to comment
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.