Building a Store Locator ASP.NET Application Using Google Maps API (Part 2)
Last week’s article, Building a Store Locator ASP.NET Application Using Google Maps API (Part 1), was the first in a multi-part article series exploring how to add store locator-type functionality to your ASP.NET website using the free Google Maps API.
Part 1 started with an examination of the database used to power the store locator, which contains a single table named Stores with columns capturingthe store number, its address and its latitude and longitude coordinates.
Next, we looked at using Google Maps API’s geocoding service to translate a user-entered address, such asSan Diego, CA or 92101 into its latitude and longitude coordinates.
Knowing the coordinates of the address entered by the user, we then looked at writing a SQLquery to return those stores within (roughly) 15 miles of the user-entered address.
These nearby stores were then displayed in a grid, listing the store number, thedistance from the address entered to each store, and the store’s address.
While a list of nearby stores and their distances certainly qualifies as a store locator, most store locators also include a map showing the area searched, with markersdenoting the store locations.
This article looks at how to use the Google Maps API, a sprinkle of JavaScript, and a pinch of server-side code to add such functionality toour store locator.
View the Original article