We have a client that wants a store locator on their website. I've been asked to find a webservice that will allow us to send a zipcode as a request and have it return locations within x radius. We found this, but it's maintained by a single person, and doesn't look like it gets updated or supported very well. We're looking for something commercial, ideally that updates their zipcode database at least once per quarter, and that has a well-documented API with PHP accessibility. I won't say price isn't an object, but right now we just want some ideas, and my google-fu has failed me.

1 Answer 1


We wanted a similar service in Australia, but we gave up and rolled our own.

Doing basic geospatial searching is fairly easy. We're fortunate that our national postal service provides a list of every single postcode in the country. Google Maps API was able to return the lat/long of each and every postcode in the country.

From there, against each store we kept its exact lat/long, and then using back-end magic we located every single store within x km radius, and then just plotted those on a Google Map, and populated a store list underneath the map.

You can fetch the lat/long of any address via http://maps.google.com/maps/geo?q=ADDRESS&output=csv&oe=utf8&sensor=false&gl=AU&key=APIKEY. The only hard bit is working with lat/longs as distance on earth is not constant with lat/longs. For example, 1km in latitude is approx 1/111 and 1km in longitude is approximately 1/71. But as you move north and south, east and west this fraction changes - but it was close enough for our work (Australia is as large as America and we had plots all over the country, so in some parts it was actually wildly inaccurate, but nobody has complained)

If you do decide to roll your own, the people over at Geographic Stack Exchange may be of great assistance. I wish they had existed when we did our own.

  • Thanks. Unfortunately US postal codes change a lot as rezoning occurs, so we're really looking for a service that will maintain the database of postal codes and all the updates necessary. I'm keeping this answer for future reference, though, and definitely taking a look at Geo Stack Exchange - I didn't know that existed!
    – EmmyS
    Oct 22, 2010 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.