MZH
MZH

Reputation: 1514

Google Map direction lon/lat params

I m searching for the parameter which I can open a map window directly by putting lon/lat as the source param and get my location itself.

something like this and and draw direction on map

https://maps.google.com/maps?from=37.4219720,-122.0841430&to=GET_MY_LOCATION

Thank u

Upvotes: 0

Views: 203

Answers (2)

BingeBoy
BingeBoy

Reputation: 2981

Easy! There is a param for autodection of your location assuming your browser supports geolocation and you haven't blocked it, as with all geolocation calls.

I'm assuming you want to pass a link directly or through an "a href" tag and not use gmaps api.

https://maps.google.com/maps?saddr=52.5191,13.4060&daddr=current%20Location

A better method would to run a test and verify geolocation is support and turned on. Check out this gist: https://gist.github.com/bingeboy/5519841 If the success callback fires then you know the URL will work.

Upvotes: 0

Dr.Molle
Dr.Molle

Reputation: 117314

There is no parameter for a automatic detection of your location, you must detect it on your own using e.g: navigator.geolocation

The correct parameters are not from, to or anything else, they are saddr and daddr.

Example:

https://maps.google.com/maps?saddr=52.5191,13.4060&daddr=52.4244,13.7497

Upvotes: 1

Related Questions