[OpenLayers-Users] Min/MaxScale problem
Damiano ALBANI
damiano.albani at gmail.com
Thu Mar 21 03:33:35 PDT 2013
Hello,
On Wed, Mar 20, 2013 at 1:36 PM, gabriel <gpetricek at gmail.com> wrote:
>
> i got this problem. Im trying dynamically change min and maxscale for
> layers.
>
Here's what I would do:
layer.setVisibility(false);
// wipe everything related to resolution / scale
layer.minScale = layer.maxScale
= layer.minResolution = layer.maxResolution
= layer.numZoomLevels = layer.resolutions
= layer.scales = undefined;
// set new values
layer.options.minScale = 15000;
layer.options.maxScale = 500000;
// trigger calculation with new values
layer.initResolutions();
layer.setVisibility(true);
layer.redraw(); // necessary ??
I haven't tested but it should work.
--
Damiano ALBANI
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130321/2eb7022e/attachment-0001.html>
More information about the Users
mailing list