[OpenLayers-Users] changing the baselayer
protos
kildimo at gmail.com
Wed Feb 24 05:22:08 EST 2010
Hi,
I need to create a new layer and make this the new base layer and use the
old base layer for something else
but I'm having issues with it - when I switch the baseLayer, and request new
tiles the tiles still end up in the old baseLayer instead of the new one.
This is how I'm switching the baseLayer :
var baseId = this.map.baseLayer.id;
var cloneId = baseId + "_clone";
// point baseLayer at the cloned layer
// point baseLayerClone at the base layer
this.map.tmp = this.map.baseLayerClone;
this.map.baseLayerClone = this.map.baseLayer;
this.map.baseLayer = this.map.tmp;
this.map.tmp = null;
// change the openlayer object ids
this.map.baseLayer.id = baseId;
this.map.baseLayerClone.id = cloneId;
// change the DOM div ids
this.map.baseLayer.div.id = baseId;
this.map.baseLayerClone.div.id = cloneId;
this.map.baseLayerClone.isBaseLayer = false;
// set the layer indexes
var cidx = this.map.getLayerIndex(this.map.baseLayerClone);
var bidx = this.map.getLayerIndex(this.map.baseLayer);
this.map.setLayerIndex(this.map.baseLayerClone, bidx);
this.map.setLayerIndex(this.map.baseLayer, cidx);
this.map.baseLayerClone.index = bidx;
this.map.baseLayer.index = cidx;
this.map.setBaseLayer(this.map.baseLayer);
A lot of this is probably unnecessary but I'm trying to make sure that
everything is covered.
I think the problem might be that the old baseLayer is still seen as a base
layer and I now have two baseLayers. Is there something I need to do with
the old baseLayer to make it a normal layer ?
Cheers,
Colm
--
View this message in context: http://n2.nabble.com/changing-the-baselayer-tp4624844p4624844.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list