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

Barend K ö bben kobben at itc.nl
Mon Jun 4 11:18:05 EDT 2007


First, I am not suprised
> map.setCenter(new OpenLayers.LonLat(lat, lon), zoom);
or 
> map.setCenter(new OpenLayers.LonLat(543443,255213), 7);
doesn't work, as RD does not use latlon, but meters in a cartesian system.

For me in RD this works:

      function init() {
        var bounds = new OpenLayers.Bounds(248500,464700,263900,478600);
        var map = new OpenLayers.Map( 'map', {maxExtent: bounds,
projection:"EPSG:28992", minScale: 100000, units: "m" } );
        var baseMap = new OpenLayers.Layer.WMS("enscadparcels",
"http://geoserver.itc.nl/cgi-bin/mapserv.exe?map=D:/Inetpub/geoserver/mapser
ver/pg_config.map&",
              {layers: "enscadparcels"}
            );
            map.addLayers([baseMap]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.zoomToMaxExtent();
        }

Note that is use units as 'm', and I specify a MinScale (100000). It might
be that the extent you're trying to set, which covers much more than the
actual Netherlands, causes some overflow somewhere...

But as OpenLayers is really good at many things, but not at Documentation,
it's not easy to find why mine works and yours not....

Sterkte!

__ 
Barend Köbben
International Institute for Geo-information
Sciences and Earth Observation (ITC)
PO Box 6, 7500AA Enschede (The Netherlands)
ph: +31 (0)53 4874253; fax: +31 (0)53 4874335



On 04-06-2007 15:15, "Arjen de Korte" <arjendk at gmx.net> wrote:

> Tom, list,
> 
> Thanks for your comments.
> 
> I've tweaked some of the options, like adding and removing the
> isBaseLayer and resolutions options. I keep getting the same error.
> 
> Any other suggestions?
> 
> Arjen.
> 
> 
> 
> On Mon, 4 Jun 2007 13:17:37 +0100, "Tom" <tom at ukbassline.co.uk> said:
>> 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
>> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list