[OpenLayers-Dev] zoomToMaxExtent doesn't honor map bounds
Adrian Popa
adrian_gh.popa at romtelecom.ro
Wed Jul 14 09:29:55 EDT 2010
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
More information about the Dev
mailing list