[OpenLayers-Dev] setOptions overrules maxExtent

Christopher Schmidt crschmidt at metacarta.com
Fri Dec 7 12:18:19 EST 2007


On Fri, Dec 07, 2007 at 05:08:40PM +0100, Richard wrote:
> 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()

Just set the restrictedExtent when you create your map:

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, 512j],
  'restrictedExtent': new OpenLayers.Bounds(-1,-1,1,1)
}
);


> 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??

Yep, I'd say that's a bug. Feel free to file it in trac. 
"setOptions overrides maxExtent, theme properties set on the map" sounds
like a good description.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list