Reputation: 105
I'm creating a mobile webshop, where the users can see the location (address etc.) of some of the physical stores. What I want is that, since it is a mobile website, when a user clicks on an image belonging to a specific store, a route from his location to the store will be shown using Google Maps.
I've already got an API key for it. I've read the documentation of the API and tried to understand some of it (https://developers.google.com/maps/documentation/javascript/directions), but this only uses a specific starting location and a specific destination. I can't find how to input the current location of the user using GPS, and then create a route from that location to a specific destination.
Could someone create a simple route to a destination using a GPS location as the starting point?
Kind regards.
Upvotes: 0
Views: 825
Reputation: 3965
You can use navigator.geolocation
http://dev.w3.org/geo/api/spec-source.html on browsers that support it.
On others, you can fall back to google.loader.ClientLocation
from https://developers.google.com/loader/
Upvotes: 1