[OpenLayers-Users] JavaScript error: bounds has no properties

Arjen de Korte arjendk at gmx.net
Mon Jun 4 07:47:35 EDT 2007


Hi all,

I'm trying to view a WMS running on my local computer with OpenLayers. The WMS-layers are in Dutch RD coordinates (EPSG:28992). I'm using the code below. However, I get a JavaScript error "bounds has no properties" on the line
"map.setCenter".

    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
        function init(){
            map = new OpenLayers.Map("map", 
            { maxExtent: new OpenLayers.Bounds(0, 300000, 300000, 600000),
              maxResolution: "auto",
              units: 'meters',
              projection: "EPSG:28992"
            });

            // It works with this one:
            //map = new OpenLayers.Map( $('map') );
            //layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
            //        "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );

            //See: http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#Projections
            layer = new OpenLayers.Layer.WMS( "VMap0", "http://localhost/mapserver/mapserv.exe?map=c:/Inetpub/test/demo.map",
            { request: 'GetMap',
              layers: 'water',
              srs: 'EPSG:28992',
              format: 'image/png',
              transparent: true
            } );
            map.addLayer(layer);
            map.addControl(new OpenLayers.Control.Permalink());
            // This doesn't work: "JS error: bounds has no properties":
            map.setCenter(new OpenLayers.LonLat(lat, lon), zoom);
            // This doesn't work either: "JS error: bounds has no properties":
            //map.zoomToMaxExtent();
        }
        // -->
    </script>

Does anyone have an idea how this can be solved? Can it be it has to do with the fact that I'm trying to use the EPSG:28992 SRS? The basic example with the OpenLayers WMS (commented above) works fine.

A similar problem has been posted earlier: http://openlayers.org/pipermail/users/2007-February/000695.html, but I found no responses.

Best regards,
Arjen.



More information about the Users mailing list