[OpenLayers-Users] Fixed Scales & minScale problem

Alexandre Dube adube at mapgears.com
Tue Aug 26 16:34:30 EDT 2008


I saw this in Layer.js at line 690 ( OL 2.6 )

// Do not use the scales/resolutions at the map level if
// minScale/minResolution and maxScale/maxResolution are
// specified at the layer level

Ok ?  But I want to use both.  I don't understand why we can't set a 
minScale to a layer at the same time we specify our own scale ranges.  I 
mean, I work for some of my layers and other not...  I'm confused !

Is there a way around ?

Alexandre

Alexandre Dube wrote:
> Hi everybody,
>
>   I've got a strange behavior in my OL application.  I've got some 
> layers with simple params like minScale/maxScale like the following :
>
> // layer
>         olWFSRoads = new OpenLayers.Layer.WFS(
>             "Routes - WFS", sMSURL,
>             { typename: "BDGA_ROUTE_L_ARC", map: sBDGAMapPath },
>             { extractAttributes: true, minScale: 25000,
>               typename: "BDGA_ROUTE_L_ARC", styleMap: oStyleMap
>             }
>         );
> // ----------------------------------------
>
>   I use the following map options :
>
> // old way
>         var oMapOptions = {
>             controls: [],
>             units: 'm',
>             maxResolution: 156543.0339,
>             maxExtent: new OpenLayers.Bounds(
>                 -1192709.604,
>                 -204908.6926,
>                 1172293.7082,
>                 2338511.3665
>             ),
>             projection: new OpenLayers.Projection("EPSG:32198")
>         };
> // ----------------------------------------
>
>   I want to use more rounded scale numbers, like the following :
>
> // new way
>
>         var oMapOptions = {
>             controls: [],
>             units: 'm',
>             maxResolution: 156543.0339,
>             maxExtent: new OpenLayers.Bounds(
>                 -1192709.604,
>                 -204908.6926,
>                 1172293.7082,
>                 2338511.3665),
>             projection: new OpenLayers.Projection("EPSG:32198"),
>             numZoomLevels: 11,
>             scales:  [13000000, 8000000, 4000000, 2000000, 
> 1000000,                   // <---------------
>                       500000, 250000, 100000, 50000, 25000, 10000]
>         };
> // ----------------------------------------
>
> The problem is, some of my layer loses their minScale value ( like the 
> one above, olWFSRoads ).  It's changed to 13000000 as soon as it's added 
> to the map !  I have an other WMS layer that does the same thing, and 
> some others don't...  But they have the same params.
>
> Is this a bug or I'm missing something new when I set scales : [...] as 
> a new map option ?
>
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list