Find your nearest place by postcode?

I need to "find the nearest place" on our website.

When a visitor enters their zip code, they are redirected to a specific web page for our nearest location. We have forty places in the USA and Canada.

How can I build something like this? Can I do this using the Google Maps API? I already have a custom map on Google Maps. It is in our places. It would be nice to send the Google Maps team to say "what is our closest place in ________".

Any suggestions?

+7
php mysql google-maps
source share
4 answers

Check out our proximity search here:

Using PHP / MySQL with Google Maps

You will need to geocode your zip codes into coordinates (also possible using the Google Maps API, but it is probably preferable to do with the full address), then you can run a proximity search, described in detail in the tutorial.

+7
source share

if you have the longitudes and latitudes of each zipcode (search google), you can use the Haversin Formula to calculate the nearest neighbors.

http://www.codecodex.com/wiki/Calculate_Distance_Between_Two_Points_on_a_Globe

+4
source share

You need a database of zip codes with longitude and latitude from which you can calculate the distance.

+3
source share

Google Maps has restrictions for use for business purposes, so you can consider these (restrictions) in advance. From my previous experience, I would suggest the MapQuest API. Details can be found here: http://developer.mapquest.com/ and a quick start guide here http://www.mapquest.com/features/developer_tools_oapi_quickstart

MapQuest cards are better when it comes to business deals. In any case, check their T&C before performing it in the manufacturing process.

They have JavaScriopt, and I think the usual WS is for decoding a geographic location.

Relations Konrad

0
source share

All Articles