Google Maps URL with pushpin and satellite basemap

落花浮王杯 提交于 2020-08-19 04:16:10

问题


Background Information

I can form a simple valid Google Maps URL that has a pushpin on a coordinate like so using the query parameter:

https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393

Direct link

Similarly, I can form a URL with a satellite image of the same location using the center and basemap parameters:

https://www.google.com/maps/@?api=1&map_action=map&center=47.5951518,-122.3316393&zoom=17&basemap=satellite

Direct link

Desired End Result

What I'd like to have is a satellite image like in the second URL with a pushpin. The result of this can be seen by using the first URL and pressing the 'Satellite' button on the bottom left of the map. From what I can tell, the basemap and query parameters may not be used together like below, but I'd love to be proven wrong.

https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393&basemap=satellite

Desired end result:

Direct link

I need to be able to construct the URL with a dynamic set of coordinates. I haven't found a way to manipulate the parameters in order to accomplish this.

Note: the final URL I included is an "unpacked" URL generated by Google Maps and not constructed by hand. I haven't found a way to manipulate it the way I want, and even if I could, I'm sure it's not the correct way to solve this problem.


回答1:


You are right in that this can't be done with the new Google Maps APIs. The "Search" URL scheme allows pinning but no satellite view, whilst the "Display a map" scheme allows satellite views but no pinning.

However, it is possible get both pinning and satellite views by using this old, no-official-documentation, scheme:

http://maps.google.com/maps?t=k&q=loc:47.5951518+-122.3316393

The t parameter used to work with a number of different values but only two seem to currently still work:

  • t=m - Normal map view
  • t=k - Satellite view

Note that unofficial documentation for the other parameters can be found here. Some of these may also still work.



来源:https://stackoverflow.com/questions/47038116/google-maps-url-with-pushpin-and-satellite-basemap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!