Google maps link produces slightly moved marker wh

2019-05-10 04:20发布

I am building a web app which contains a Google Maps link that can be opened by the native phone Maps app (iPhone/Android).

The link has the form: http://maps.google.com/?q="+startCooLat+','+startCooLng; and I have also tried the: http://maps.google.com/?q=loc:"+startCooLat+'+'+startCooLng;

However in the native app the marker is positioned in the nearest street and not in the exact coordinates that I am giving. Is there a solution or another parameter to set so as to overcome this issue?

1条回答
Explosion°爆炸
2楼-- · 2019-05-10 04:53

Instead of questioning (q=.....) google maps for the location, in which it returns what it thinks is the nearest human address to the location (somewhat annoying I think) you can pass a lat lng location where you want the center of the map to be. For example:

http://maps.google.co.uk/?ll=53.385517,-1.865315

Instead of:

http://maps.google.co.uk/?q=53.385517,-1.865315

I had this problem my self, and on my Android device at least this works. The second example simply puts the map on a road, the first is in the middle of the moors on the device in the maps app.


The full link from the comments:

http://maps.google.com/maps?ll=53.385517,-1.865315&q=loc:53.385517,-1.865315&t=m

This one seems to work at adding a marker for the standard maps app whilst still adding a marker.


After receiving a recent answer to an old Android Google Maps question I had, I have found another solution to this question, which I thought would be useful for others. Original Question - and credit to Captain Charmi for pointing me in the direction.

Instead of using the link above which will create a marker at the given location, trouble is, the maker is pretty meaningless, just the coordinates. If you use the following link, you can add either a title to the marker and show the coordinates:

http://maps.google.com/maps?q=53.385517,-1.865315+(My Random Location)

Or you can instead of adding a title, you can supply text to go inside the marker:

http://maps.google.com/maps?q=A pot of gold at the end of a rainbow@53.385517,-1.865315

As you can see, Google now drops the marker in the correct place due to being supplied the info for the marker. I hope this helps.

查看更多
登录 后发表回答