dvint1
dvint1

Reputation: 86

Google Static Map API how to specify max zoom level

We have a report that shows where 2 markers are on a map, works great except when the markers are next to each other it zooms in to the highest level of zoom.

We want the min zoom to be open, but set the max zoom to a certain level. I have looked through the Google Static Map documentation, and cant see where to do it.

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

Cheers.

Upvotes: 5

Views: 4184

Answers (5)

Ε Г И І И О
Ε Г И І И О

Reputation: 12371

Well it is sort of not straight forward to get it with static maps. You can omit specifying the zoom and hope google will choose what it thinks best.

Anyway this is how I got rid of it. I had my own zoom up / zoom down buttons to show up next to the map image. Upon click, I increase or decrease the current zoom value and reload the map image.

I know it's not pretty, but it gets the job done.

Upvotes: 2

petrpokorny
petrpokorny

Reputation: 71

Google does not have that feature in place. Here is a feature request:

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

Please vote!

Upvotes: 4

kwicher
kwicher

Reputation: 2082

I have not tried that for static maps but it works for me in 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 am limiting both max and min zoom.

Hope it helps

K

Upvotes: -1

Codier
Codier

Reputation: 2160

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 listener, you could do document.onload(function() { map.setZoom(8));

Upvotes: -2

Related Questions