[OpenLayers-Users] scale dependent layers

Linda Rawson linda.rawson at gmail.com
Mon Dec 10 10:48:03 EST 2007


I accomplish this on the "moveend" event.

map.events.register('moveend', map, function (e)
{
 var mapScale = this.getScale();
 if (mapScale < 55568034)
        {
          markerLayer.setVisibility(true);
        }
        else
        {
          markerLayer.setVisibility(false);
        }
}

I also would like this layer not to fire until it is between the min and max
scale settings.  It still goes out and retrieves the url and causes
performance problems.  But it is my understanding that this will come in a
future release.

Thanks,
Linda Rawson

On Dec 7, 2007 2:36 PM, Bart van den Eijnden (OSGIS) <bartvde at osgis.nl>
wrote:

> That's true, but since I have the scales array set on the Map, the layer
> also has scales. And if scales is not null, it will never reach the code
> block where minScale and maxScale are applied.
>
> Best regards,
> Bart
>
> Eric Lemoine schreef:
> > On Dec 7, 2007 3:53 PM, Bart van den Eijnden (OSGIS) <bartvde at osgis.nl>
> wrote:
> >
> >> Hi list,
> >>
> >> I am trying to make one of my WMS layers scale dependent (only visible
> >> between 0 and 1:25000, units: m), but I cannot get it done.
> >>
> >> My map is constructed with an array of scales and a maxExtent.
> >>
> >> On my layer I use minScale 25000 and maxScale 0.
> >>
> >> But since the code in InitResolutions of Layer.js falls back on the map
> >> object, the Layer's scales array will be set using the Map's scales
> array,
> >> and the code for minScale and maxScale will never be reached.
> >>
> >
> > When I look at the code, I see the opposite. minScale, maxScale and
> > friends are taken from the map object *only* if they're not specified
> > at the layer level.
> >
> > <
> http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer.js#L411
> >
> > <
> http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer.js#L604
> >
> >
> > Am I missing something here?
> >
> > --
> > Eric
> >
> >
> >
>
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> bartvde at osgis.nl
> http://www.osgis.nl
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20071210/195b7279/attachment.html


More information about the Users mailing list