Google Static Map API, how to specify the maximum zoom level

We have a report that shows where 2 markers are on the map, it works fine, except when the markers are next to each other, it approaches the maximum zoom level.

We want the min zoom to be open, but set the maximum zoom to a certain level. I have looked at the Google Static Map documentation and cannot see where to do this.

Does anyone know if this is possible using a static api map?

Greetings.

+4
source share
5 answers

Google does not have this feature. Here is the function request:

Issue 3909 http://code.google.com/p/gmaps-api-issues/issues/detail?id=3909

Please vote!

+4
source

Well, it’s not so easy to get it with static maps. You can omit the scaling task and hope that Google chooses what it considers the best.

In any case, this is how I got rid of it. I had my own zoom in / out buttons to display next to the map image. After a click, I increase or decrease the current zoom value and load the map image.

I know this is not very, but he is doing his job.

+1
source

I have not tried this for static maps, but it works for me in a normal map:

google.maps.event.addListener($map, 'zoom_changed', function(){ if($map.getZoom()<4){$map.setZoom(4);} if($map.getZoom()>14){$map.setZoom(14);} }); 

Here I limit the maximum and minimum scaling.

Hope this helps

TO

0
source

I found the following code from this URL: http://code.google.com/apis/maps/documentation/javascript/events.html

google.maps.event.addListener (marker, 'click', function () {map.setZoom (8);});

Instead of adding a listener, you can execute document.onload (function () {map.setZoom (8));

-1
source

Source: https://habr.com/ru/post/1346852/


All Articles