Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible, in the Google Maps API v3, to restrict the zoom to specific levels (eg 16 and 7)?

In my case I wish to show city points at a global scale, then show suburb polygons when zoomed in - but I only want those 2 levels of zoom rather than the full 20 levels.

Thanks

share|improve this question
    
    
@mapperz thanks –  Stephen Lead Nov 18 '11 at 21:55

1 Answer 1

up vote 4 down vote accepted

Yes, but not directly. If you needed a range, you could use map.setOptions() and set the min/maxZoom. As you aren't looking for a range, I suggest listening for zoom events on the map, and restricting the zoom levels in the event handlers. I've done it with other APIs before, and its worked fine. There's an example on StackOverflow about doing something similar: Limit Viewable Area in GMaps v3 Oh, and you'll probably want to disable the zoom control to minimize/avoid user confusion.

share|improve this answer
    
thanks for that - looks like a good workaround –  Stephen Lead Nov 18 '11 at 21:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.