[OpenLayers-Users] scale dependent layers

Pierre GIRAUD bluecarto at gmail.com
Fri Dec 7 11:16:37 EST 2007


Does it work correctly using minResolution and maxResolution instead ?

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.
>
> I also tried putting in scales: null or scales: [] to the Layer constructor
> but this did not help.
>
> Any ideas? TIA.
>
> My idea would be to pass in an empty scales array (scales: []), and to
> change the following:
>
> // First off, we take whatever hodge-podge of values we have and
> //  calculate/distill them down into a resolutions[] array
> //
> if ((confProps.scales != null) || (confProps.resolutions != null)) {
>
> to:
>
> if (((confProps.scales != null) && (confProps.scales.length > 0)) ||
> ((confProps.resolutions != null) && (confProps.resolutions.length > 0))) {
>
> so it becomes possible to overrule the scales or resolutions array on the
> layer.
>
> Best regards,
> Bart
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list