[OpenLayers-Users] zoom to scale, revisited

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Feb 13 03:51:39 EST 2007


Hi Christopher, list,

I am trying your approach to zoom to a scale but it does not work for me.

I am trying the following:

<html>
<script src="common/openlayers/OpenLayers.js"
type="text/javascript"></script>
<body>
<div id="map" style="position:absolute; width:600px; height:600px;"></div>
<script>
var map = new OpenLayers.Map( $('map'), { controls: [], 'projection':
'EPSG:28992', 'units':'m', 'maxExtent': new OpenLayers.Bounds(-80000,
300000, 370000, 615000) , 'maxResolution':'auto'});

baselayer0 = new OpenLayers.Layer.WMS.Untiled( "Provincies",
"http://www.rijkswaterstaat.nl/services/geoservices/overzichtskaartnl?",
{layers: 'NL-prov', 'format':'image/gif', 'transparent':'true'},
{'numZoomLevels': 7, 'ratio':1, isBaseLayer: true} );

map.addLayer(baselayer0);

if (!map.getCenter()) map.zoomToMaxExtent();

baselayer0.resolutions = [OpenLayers.Util.getResolutionFromScale(20000)];
map.zoomTo(1);
map.zoomTo(0);

</script>
</body>
</html>

But I get a javascript error:

bounds has no properties
http://test.intranet.rijkswaterstaat.nl/apps/geoservices/kaartenonline/common/openlayers/OpenLayers.js
Line 68

Using 2.3RC2. Any ideas what could be wrong?

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl








More information about the Users mailing list