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

Adrian Popa adrian_gh.popa at romtelecom.ro
Thu Jul 15 07:15:02 EDT 2010


Thank you for your reply Vito!

I hadn't noticed that option in the map definition. Also, I've just 
noticed that I have a problem with my Bounds (it's wrong) :)

Thanks again!

On 07/14/2010 05:10 PM, Vito Tafuni wrote:
> 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 <mailto:vito at vitotafuni.com>
> ---------------------------------------------
> "Verba volant, scripta manent... data corrupted"
>
>
> 2010/7/14 Adrian Popa <adrian_gh.popa at romtelecom.ro 
> <mailto: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 <mailto:Dev at openlayers.org>
>     http://openlayers.org/mailman/listinfo/dev
>
>


-- 
---
Adrian Popa
NOC Division
Network Engineer
Divizia Centrul National de Operare Retea
Departament Transport IP&  Metro
Compartiment IP Core&  Backbone
Phone: +40 21 400 3099

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100715/931829e1/attachment.html


More information about the Dev mailing list