[OpenLayers-Users] clone Google Layers

jorgelopez jorgelopez.physics at gmail.com
Tue May 29 23:05:31 PDT 2012


Hello: 


I have a Google and WMS layers loaded into a map and I am trying to clone
these ones in
order to be loaded into another map (with different div) associated to a
child (opened) window page. 

There is no problem to clone OL-based WMS layers and they are correctly
added to map div 
but Google base layers are not shown. 

Here is my code: 

// function that returns an array of (cloned!) active layers in an opener
window
function returnActivaLayersFromOpener() {
	
						var activ = []; 
						
						for (layername in opener.map.layers) {
									// if the layer isn't visible at this range, or is turned off, skip
it
									var layer = opener.map.layers[layername];
											if (layer.visibility) {
																									                                        var layerc
= layer.clone();
													//console.log(layer);
													activ.push(layerc); 
													
											}
						}
							
						return activ;
};

activelayers = returnActivaLayersFromOpener();

// add cloned layers to a map in a opened window 

map_child = new OpenLayers.Map({options});
	
map_child.addLayers(activelayers);


I dont know why WMS are correctly shown but, on the contrary, Google layers
are not shown (I checked they are included as item in the activelayers
array). 

I have followed this ticket regarding Google.js,  

ticket: http://trac.osgeo.org/openlayers/attachment/ticket/2473/2473.patch

but there is no succeed. 

Any help would be appreciated

Jorge 


--
View this message in context: http://osgeo-org.1560.n6.nabble.com/clone-Google-Layers-tp4977932.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list