Hi
Please go through he following article covering different way to implement Store Locator:
Link:- http://theoryapp.com/store-locator-using-java/
//Store Locator using Java
The basic idea is as below:
- Design a Store class, and load all data into an ArrayList of Stores.
- Ask the user for an address, and find its geographical location.
- Scan through the ArrayList of all stores to find the closest one.
First, we define the Location class with the following attributes and methods:
- String address
- double latitude
- double longitude
- public Location(String addr, double lat, double lng)
- double distanceTo(Location loc): computes the distance to loc
- String toString(): displays the location
Now we define a tool class LocationTool. It has the following methods:
- ArrayList loadData(String urlString): reads data from the url
- Location makeLocation(String addr): creates a location object from an address. We use Google’s geocoding services to find the latitude and longitude of an address string.
Finally we build the main program Locator with a main method. As the program starts, it loads the data; then it asks for an input address, finds its geographical location, and searches for the closet store.
Link:- https://github.com/googlemaps/js-store-locator
The library provides the following features:
- Pluggable data source – display stores from a data source of your choosing
- HTML5 Geolocation – determines a good initial viewport for the user
- Info window – shows details about a store
- Street View
- Extensible – customise your own markers, info windows, etc.
- Fully-featured side panel, providing:
- Feature filtering
- Autocomplete search
- List of nearby stores
- Directions
Demo:-
- panel.html – A simple store locator, including panel. Data is fetched from a static CSV file.
- dynamic.html – Same as above, except stores are fetched dynamically from a JSONP web service.
- gme.html – Same as above, except stores are fetched dynamically from Google Maps Engine.
Link :- https://www.pcapredict.com/support/articles/article/how-to-implement-a-store-locator
// Insert this JS in your code, rest all would be cater by this third party app.
I hope this would help you.
Thanks and Regards
Kautuk Sahni