Google map zoom parameter in url not working

后端 未结 3 484
一生所求
一生所求 2020-12-15 21:13

Why doesn\'t google map z (zoom) parameter work inside the url? I\' ve searched over so I got few solutions for sending zoom parameter in google map url but based on the old

3条回答
  •  天命终不由人
    2020-12-15 21:37

    For those who do not want to read, this works (z range:[1-20]):

    https://maps.google.com/?q=38.6531004,-90.243462&ll=38.6531004,-90.243462&z=3

    There is no documentation that covers this problem. However, there are few hacks.

    The link that you have provided,

    URL (stackoverflow):What parameters should I use in a Google Maps URL to go to a lat-lon?

    Will not help you with getting the desired google maps zoom level inside a url

    The following examples which have been working for quite a while DO NOT WORK anymore (they work but without getting the desired zoom level)

    Examples:

    • http://maps.google.com/?q=38.6531004,-90.243462&z=3
    • http://maps.google.com/?q=38.6531004,-90.243462&zoom=3
    • http://maps.google.com/maps?q=Scottish+Rite+Hamilton+ON&loc:43.25911+-79.879494&z=15

    Instead, you can get the zoom level easily by trying the following examples:

    • https://www.google.com/maps/@38.6531004,-90.243462,9z
    • https://maps.google.com/?ll=40.7060471,-74.0088901&z=3

    (Note: after clicking on google maps you will get a gray marker which appears and quickly disappears)

    However the above URL's will not give you a static pinpoint for the specified lat&long.

    There is a "hack" on how to get a fixed pinpoint (red marker pin) and that is by giving the q attribute (represents the search query) and the II attribute(latitude and longitude of the map centre point) along with the z (zoom attribute)

    Example (with the OP coordinates):

    https://maps.google.com/?q=38.6531004,-90.243462&ll=38.6531004,-90.243462&z=3

    If you want to change the zoom level just change the value of 'z'.

    After searching the web I found that only this website: https://moz.com/blog/new-google-maps-url-parameters deals with google maps parameters/attributes/arguments, where things actually still work. If anyone want's more functionalities within the url, then this is the site to check.

    Zoom intervals explained (https://developers.google.com/maps/documentation/static-maps/intro#Zoomlevels):

    The following list shows the approximate level of detail you can expect to see at each zoom level:

    • 1: World
    • 5: Landmass/continent
    • 10: City
    • 15: Streets
    • 20: Buildings

提交回复
热议问题