[OpenLayers-Dev] setOptions overrules maxExtent

Richard rdmailings at duif.net
Fri Dec 7 11:08:40 EST 2007


Hi List,

first time trying to use 'restrictedExtent' I copied some code from:
http://www.openlayers.org/dev/examples/restricted-extent.html
to be more precise:
map.setOptions({restrictedExtent: mxExt });
into the init()

After using this, all kind of strange errors appeared in my map which is
initialized something like:

map = new OpenLayers.Map('map', {
controls: []
, 'projection': 'EPSG:28992'
, 'units':'m'
, 'maxExtent': mxExt
, 'resolutions':[1, 2.5, 5, 7.5, 10, 30, 50, 100, 175, 256, 512]
}
);

some line below:
map.setOptions({restrictedExtent: mxExt });


Looking at the implementation of setOptions in Map.js:

setOptions: function(options) {
...
     this.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
..
},

it appears that my own maxExtent (in 28992) is reset??

Shouldn't there be some check around this, eg to check if there is already
a maxextent defined for this map?
What is the reason maxExtent is set hardcoded (4326)?
Or am I using setOptions the wrong way (is it to be used as a
'replaceOptions'?

Regards,
Richard Duivenvoorde





More information about the Dev mailing list