Blog Index > General > Google Maps Store Locator

Google Maps Store Locator

At the minute I'm working on a store locator service using the Google Maps API. I found a really helpful page on Creating a store locator with PHP, MySQL and Google Maps, and I'm going to use this, but convert the code into c# and run from a MS SQL2008 database store. Relatively simple to do really, with the slight complication that you have to store lattitude and longitude coordinates in the database. The system I am building is designed for clients to update their own list of shops, so the lat and lng values will need to be interpreted from the postcode before they are stored in the database. All this happens behind the scenes, so the client does not have to worry about finding geo coordinates for locations, they just type in the post code. The admin system will have an option to tweak the coordinates if they are out slightly - again, this is not something the client will have to do manually, they will use a google map UI to reposition the markers.

I'll be posting the code for this system in the scripts database when it is completed.

*** Update 11/8/2011 ****

I've now posted the Google Maps Store Finder code. This page contains all the code required to create a store finder in c# / ASP.net.

If you are interested in building a store finder with vclassic ASP, PHP or Java, then you can use pretty much the same sort of procedure, and convert the code into the required language.

It is also possible to create the store finder facility using just client side code by writing the store locations as XML files and then use Ajax to load the store coordinates into a javascript array. Then you can create an associated array of calculated distances, and sort the results based on the distance from your selected location. Alternatively, you could just write the coordinates into a javascript include file and run the system that way - it reduces some of the overheads of loading the XML file. I've not posted the code to do that on the store locator page, but the fomula for calculating the distances is the same as that used in the SQL query.

 

 

Categories: General08 July 2011Log in to add new posts