[OpenLayers-Dev] preserving scale on base layer switching

Tim Schaub tschaub at opengeo.org
Tue Feb 2 20:22:08 EST 2010


Currently, when a new base layer is set, we determine the new resolution 
based on the previous map extent.  An alternative would be to determine 
the new resolution based on the previous scale.  Preserving center and 
scale makes better sense to me.  I'm curious what others think.

The resolution based on extent method breaks down when extents are not 
well defined.  E.g. with an extent that wraps the date line.  To see 
this break-down in action, follow these steps:

1) open http://openlayers.org/dev/examples/google.html
2) click to zoom all the way out (you'll see multiple worlds)
3) open the switcher and change base layers

You should see the scale change.

Apply the patch for http://trac.openlayers.org/ticket/2457 and you 
should see better behavior.

Thanks for any feedback.

Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.

More information about the Dev mailing list