Search code examples
google-mapsurlgoogle-maps-markersgoogle-maps-static-api

Zoom Controls in google maps URL


I am building Google Map URL that will point few locations in the map

I want to add Zoom control to the map so users can zoom in and out

all the examples i saw were for java script and coding maps

is there any parameter i can add to the url to get the zooming control

I tried

&callback=initMap

&gestureHandling=cooperative

but non worked

any one know what i have to add to get scrolling and zooming controls?

my current URL looks like this

https://maps.googleapis.com/maps/api/staticmap?zoom=13&gestureHandling=cooperative&size=1200x800&maptype=roadmap&key=AIza***********************&markers=label:1%7C-33.87277000,151.21408000&markers=label:2%7C-33.87257000,151.21520000

Solution

  • Based on the URL request that you have included in your question, I can tell that you are not using Maps URL. Instead, you are using Static Maps API. From the word Static itself, its characterized by a fixed or stationary condition.

    Once the map is loaded using Static Maps API, the map will be rendered as an image, therefore, no interactions can be done with the map after loading. You may only adjust the zoom level by adjusting the parameter zoom in the URL.

    If you want to be able to dynamically move around the map after loading, then you should opt to using Google Maps Javascript API.

    But it seems to me that you are trying to avoid using codes. If this is the case and you just want to load the map using url, then you may use Google Maps URL

    https://www.google.com/maps/search/?api=1&query=pizza+seattle+wa
    

    If you want to embed a map to a webpage, then you should use Google Maps Embed API. You do not need an to use javascript codes for this one, just an HTML iframe.

    <iframe
      width="600"
      height="450"
      frameborder="0" style="border:0"
      src="https://www.google.com/maps/embed/v1/place?key=YOUR_API_KEY
        &q=Space+Needle,Seattle+WA" allowfullscreen>
    </iframe>
    

    Hope this helps!