[OpenLayers-Dev] zoomToMaxExtent doesn't honor map bounds

Vito Tafuni vito at vitotafuni.com
Wed Jul 14 10:10:33 EDT 2010


add this option

restrictedExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),

works for me!
and i've just read the api doc! ;-p


-Vito-


--
-----------
Tafuni Vito
vito at vitotafuni.com
---------------------------------------------
"Verba volant, scripta manent... data corrupted"


2010/7/14 Adrian Popa <adrian_gh.popa at romtelecom.ro>

> Hello,
>
> I have a map with a specific projection system, with the view limited
> between some bounds, but when I do map.zoomToMaxExtent() I get sent back
> to the world map, centered on (0,0).
> Here's my map definition:
>
> var lonlat = new OpenLayers.Projection("EPSG:4326");
> var sphericalMercator = new OpenLayers.Projection("EPSG:900913");
> var res =
>
> [2445.9849046875,1222.99245234375,611.496226171875,305.7481130859375,152.87405654296876,76.43702827148438,38.21851413574219,19.109257067871095,9.554628533935547,4.777314266967774,2.388657133483887,1.1943285667419434,0.597164283];
> var options = { projection: sphericalMercator, displayProjection:
> lonlat, units: "m", numZoomLevels: 12, maxResolution: 2445.9849046875,
> maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
> 20037508.34, 20037508.34), resolutions: res};
> map = new OpenLayers.Map( 'map', options);
> var wms = new OpenLayers.Layer.WMS( 'OpenLayers/Metacarta',
> 'http://labs.metacarta.com/wms/vmap0', {layers: 'basic'} );
> map.addLayers([wms]);
>
> If I click on the globe icon from the zoom-pan bar (which does a
> map.zoomToMaxExtent()) I get a zoom seeing the world, instead of seeing
> just Romania (the map's bounds).
>
> Is this a bug in Openlayers or is there something wrong with my code?
>
> Thanks,
> Adrian
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100714/a60af9ed/attachment.html


More information about the Dev mailing list