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

Bart van den Eijnden bartvde at osgis.nl
Wed Feb 10 05:49:23 EST 2010


Hi strk,

maybe you can look at:

http://dev.openlayers.org/sandbox/elemoine/reproject/examples/reproject-map.html

There are some OL tickets opened up by elemoine that should make reprojection easier, but I don't have the numbers by hand right now.

Best regards,
Bart

On Feb 10, 2010, at 11:41 AM, strk wrote:

> 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
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 




More information about the Users mailing list