Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps URL with pushpin and satellite basemap

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

Map with pushpin

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

Satellite map with no pushpin

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:

Satellite map with pushpin

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.

like image 389
gkubed Avatar asked Oct 31 '17 14:10

gkubed


1 Answers

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.

like image 160
robinCTS Avatar answered Sep 23 '22 06:09

robinCTS