[OpenLayers-Users] Problems switching baselayers - centre undefined when baselayer really small cf extent.

Phil Scadden p.scadden at gns.cri.nz
Thu Feb 25 22:20:00 EST 2010


I've been having trouble with behaviour when switching base layers. I 
start with a large area, and I have images covering some much smaller 
parts of the whole area that I would like to switch in. At moment, if I 
change the
base layer to one of these I get odd results certainly dont see the layer.

I switched to simple example to investigate. I find an issue when 
debugging through. Code below...
The image layer is much smaller the fullbounds (as it will in my main 
application). When goto map.zoomtoExtext(fullBounds), then in the moveto 
procedure, we have the following setup.

The centre of fullBounds is NOT inside the image extents.
In MoveTo, it tries to get a new centre with
if (!this.center && !this.isValidLonLat(lonlat)) {
lonlat = this.maxExtent.getCenterLonLat();
}
However, since CentreLonLat is defined (but outside the image area), 
this does nothing but return
the existing centrelonlat. map.centre remains undefined and eventually 
fires an error.

I can work around (I think) by changing maxExtent before switching to 
the other base layer?? The smaller image ALSO has different srs to the 
map srs specified in options when map created. I understand that map 
switches to this srs but when do I change the maxExtent and with what 
srs do I put it into? I am quietly getting lost here.



Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.




More information about the Users mailing list