[OpenLayers-Dev] problem with updateSize
Bart van den Eijnden (OSGIS)
bartvde at osgis.nl
Wed Dec 12 07:11:35 EST 2007
Hi list,
we've encountered a potential problem with updateSize in OL 2.5.
The updateSize function causes all invisible baselayers to request an image
from their WMS service. At least for WMS untiled, I haven't checked other
types.
I've created an example which can be used to reproduce, the easiest is to
watch the Net console of Firebug.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 400px;
height: 500px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function resize() {
document.getElementById('map').style.width = '600px';
document.getElementById('map').style.height = '800px';
map.updateSize();
}
function init(){
OpenLayers.DOTS_PER_INCH = 90.714;
map = new OpenLayers.Map( 'map', { 'projection': 'EPSG:28992',
'units':'m', 'maxExtent': new
OpenLayers.Bounds(0,300000,300000,600000),'scales': [2000000, 1500000,
1000000, 750000, 500000, 375000, 250000, 100000, 50000, 25000, 10000, 5000,
2500, 1000]});
var layer = new OpenLayers.Layer.WMS( "Provincies",
"http://www.rijkswaterstaat.nl/services/geoservices/overzichtskaartnl?",
{layers: 'NL-prov,bebouwing', 'format':'image/gif', 'transparent':'TRUE'},
{'ratio':1, singleTile: true, isBaseLayer: true} );
map.addLayer(layer);
var layer = new OpenLayers.Layer.WMS( "Dijkringgebieden",
"http://www.rijkswaterstaat.nl/services/geoservices/basispakket/grenzen?",
{layers: 'AAA205', 'format':'image/gif', 'transparent':'TRUE'}, {'ratio':1,
singleTile: true, isBaseLayer: true, visibility: false} );
map.addLayer(layer);
if (!map.getCenter()) map.zoomToMaxExtent();
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<a href="javascript:resize()">Resize</a>
<body onload="init()">
<div id="map"></div>
</body>
</html>
TIA.
Best regards,
Bart
--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl
More information about the Dev
mailing list