Google Maps Embed API Current Location as starting point with iframe

Benedetto picture Benedetto · Oct 5, 2016 · Viewed 9k times · Source

What i'm trying to do is set an address as destination and as the origin (starting point) I would like to put the current location of the device, but i cannot find anything on line that works with the iframe, all i found is to key current location as origin, but it doesn't seem to work, i also tried my location, current address and as i'm in italy i also tried with italian language, but all the same, any one know what's the correct command to put as origin so it will automatically get the user location as starting point

Answer

Anatoly Sukhanov picture Anatoly Sukhanov · Oct 6, 2016

You can get the current position using Geolocation API and then use it in latitude,longitude format.

For instance, it could look like https://www.google.com/maps/embed/v1/directions?origin=40.871579,14.2878583&destination=Rome