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

Tom tom at ukbassline.co.uk
Mon Jun 4 08:17:37 EDT 2007


Arjen,

This is what I use for British National Grid and it works fine.


<script type="text/javascript">
var map;
function init()
{
var options = {isBaseLayer:true,resolutions:[72,36,18,9.6,4.8,2.4,1.2,0.6,
0.3,0.15,0.125], maxExtent:new OpenLayers.Bounds(0,0,2000000,2000000),
maxResolution:'auto', units:'meters', projection:'EPSG:27700', controls:[]};

map = new OpenLayers.Map( $('map'), options );
var layer0= new OpenLayers.Layer.WMS('Mastermap', '
http://somewhere/script.asp?',{layers:'topo_area,carto_text<http://somewhere/script.asp?%27,%7Blayers:%27topo_area,carto_text>',
format:'image/jpeg'});

map.addLayers(layer0);

map.setCenter(new OpenLayers.LonLat(543443,255213), 7);
}
</script>

cheers,

Tom


On 6/4/07, Arjen de Korte <arjendk at gmx.net> wrote:
>
> 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.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070604/28da1ea2/attachment.html


More information about the Users mailing list