[OpenLayers-Users] Changing map max extent on the fly

strk strk at keybit.net
Wed Feb 10 05:41:51 EST 2010


Hi all,
is there a way to change a map's max extent on the fly ?
I've tried with setOption with no success
The goal is to change whole projection, but that also isn't working.
So first thing first (extent):

 // Coming from:
 console.log(map.getMaxExtent()); ---> left-bottom=(-180,-90) right-top=(180,90)

 // Trying to set new extent:
 var newext = new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508.34);
 console.log(newext) -> left-bottom=(-20037508,-20037508) right-top=(20037508,20037508.34)
 map.setOptions( { maxExtent : newext } );

 // Nothing changed:
 console.log(map.getMaxExtent()); ---> left-bottom=(-180,-90) right-top=(180,90)

Is it expected ?

-- 

  ()   Free GIS & Flash consultant/developer
  /\   http://foo.keybit.net/~strk/services.html



More information about the Users mailing list