[OpenLayers-Users] Google Maps map does not reflect zoom level change

Andreas Hocevar ahocevar at opengeo.org
Mon Jul 6 03:56:52 EDT 2009


On Fri, Jul 3, 2009 at 11:19 PM, Axel Müller<axel.mueller at avanux.de> wrote:
> Based on some parameters I change the zoom level using
> map.setCenter(lonlat, zoom).
> This works perfectly for OSM Mapnik layer but not for Google layer where
> the pan zoom bar reflects the new zoom level but the map itself still
> shows the previous zoom level. Am I missing something?
> osmLayer = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
> gMapLayer = new OpenLayers.Layer.Google("Google Maps", {numZoomLevels:
> 20, isBaseLayer: true });

Using Google layers like this only works in a few use cases. You have
to use Spherical Mercator to make it behave like you are expecting.
See http://docs.openlayers.org/library/spherical_mercator.html for
explanation, tutorial and howto.


Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

More information about the Users mailing list