[OpenLayers-Users] maxExtent has no properties

Tom tom at ukbassline.co.uk
Thu May 31 04:33:59 EDT 2007


It seems that the error actually comes from map.setCenter() and if a layer
is added first all is well, while the addOptions() function seems to apply
to layers rather than the map.  I added that option to the map constructor
and it made no difference.  My problem now is just that I can get this to
work but only after a layer has been added but ideally I need to know the
origin before a layer is added.  Maybe I can add a dummy layer?  Apparently
Geoserver now uses OpenLayers for it's demos and they use exactly what I'm
trying to achieve so I'm going to have a look into how they've done it...

thanks all.

On 5/31/07, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:
>
> Tom wrote:
> > Hi all,
> >
> > I'm currently trying to get the co-ordinates of the origin of the map in
> > order to utilise the geoserver meta tiler extension to WMS see:
> > http://docs.codehaus.org/display/GEOSDOC/WMS+vendor+parameters  These
> > co-ordinates must be included in the WMS URL so I'm doing the following:
>
> I ran into this error the other night and found that I had forgotten to
> set:
>
> map.addOptions({isBaseLayer: true});
>
> which seemed to solve the problem.
>
> -Steve W.
>
> > ...
> > var map;
> > function init()
> > {
> > var options =
> > {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 );
> > map.setCenter(new OpenLayers.LonLat(543443,255213), 7);
> > var olextent = map.getExtent();
> > var origincoords=toString(olextent.bottom) + ',' + toString(
> olextent.left);
> > ...
> >
> > and I'm getting the following error:
> >
> > maxExtent has no properties
> > isValidLonLat(lon=543443,lat=255213 lon=543443 lat=255213 CLASS_NAME=
> > OpenLayers.LonLat)Map.js (line 933)
> > setCenter( lon=543443,lat=255213 lon=543443 lat=255213
> > CLASS_NAME=OpenLayers.LonLat , 7, undefined, undefined)Map.js (line 804)
> > init() classexample.php (line 11)
> > onload(load ) classexample.php (line 1)
> > valid = maxExtent.containsLonLat(lonlat);
> >
> > Any ideas?
> >
> > cheers,
> >
> > Tom
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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/20070531/2b91fa70/attachment.html


More information about the Users mailing list