[OpenLayers-Users] maxResolution, minResolution and resolutions in OpenLayers

Esben Taudorf eta at le34.dk
Wed Jul 21 05:48:36 EDT 2010


Hi again. 

 

I just found a solution to my problem.  The Layer.initResolutions has been rewritten in the nightly build and now it checks if maxResolution and minResolution is a number. So when I remove the quotation marks from maxResolution and minResolution in my map options like below the map works fine again:

 

var mapOptions = 

{

    projection: 'EPSG:25832',

    units: 'm',

    maxExtent: new OpenLayers.Bounds(100000,6000000,1000000,6500000),

    minResolution: 0.125,

    maxResolution: 768,

    restrictedExtent: new OpenLayers.Bounds(100000,6000000,1000000,6500000),

    controls: 

    [

    ]

};

 

maxResolution and minResolution can be set to 'auto' so I assumed it could only be a string. My mistake... 

 

 

 

Fra: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] På vegne af Esben Taudorf
Sendt: 21. juli 2010 11:17
Til: users at openlayers.org
Emne: [OpenLayers-Users] maxResolution,minResolution and resolutions in OpenLayers

 

Hi everybody.

 

 

In OpenLayers 2.9.1 my map options is defined with a maxResolution, minResolution and a MaxExtent like below:

 

var mapOptions = 

{

    projection: 'EPSG:25832',

    units: 'm',

    maxExtent: new OpenLayers.Bounds(100000,6000000,1000000,6500000),

    minResolution: '0.125',

    maxResolution: '768',

    restrictedExtent: new OpenLayers.Bounds(100000,6000000,1000000,6500000),

    controls: 

    [

    ]

};

 

This works fine in OpenLayers 2.9.1 but doesn't work with the nightly build (version 19-07-2010 and 14-06-2010)

In the nightly build I get this error in firebug when adding the first layer to the map:

this.resolutions is undefined: zoom = Math.max(0, Math.min(zoom, this.resolutions.length - 1)); (Layer.js (line 1061))

 

 

When I define the resolutions in my map options like below the map works fine again:

 

var mapOptions = 

{

    projection: 'EPSG:25832',

    units: 'm',

    maxExtent: new OpenLayers.Bounds(100000,6000000,1000000,6500000),

    minResolution: '0.125',

    maxResolution: '768',

    restrictedExtent: new OpenLayers.Bounds(100000,6000000,1000000,6500000),

    resolutions: [768, 384, 192, 96, 48, 24, 12, 6, 3, 1.5, 0.75, 0.375, 0.185],

    controls: 

    [

    ]

};

 

I can see that there are some issues with the resolutions: 

http://trac.openlayers.org/ticket/2427

 

My question is now do I always need to add the resolutions in map options or can I use maxResolution, minResolution and a MaxExtent?

 

 

Regards Esben

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100721/2bb27ffa/attachment.html


More information about the Users mailing list