GMap: map.setZoom

Just a quick note…

If you have a map with multiple markers you may be using “map.setZoom((map.getBoundsZoomLevel(bounds)));” to rezoom the map then “map.setCenter(bounds.getCenter());” to center it.

Sometimes this means that although the ‘point’ is in view the marker gets pushed off the top of the screen.

So, a quick fix: “map.setZoom((map.getBoundsZoomLevel(bounds))*-1*);” this simply sets the zoom level one level lower for you so all your points (and their context) are in view.

Tags

gmap,map.setZoom,map.setCenter,bounds google maps

Comments

Commenting is closed for this article.