[OpenLayers-Users] SelectFeature on Overlapping Layers

Marc Jansen jansen at terrestris.de
Mon Jan 18 07:00:31 EST 2010


Hi Afroz,

maybe the Vector.RootContainer-Layer is of any help to your problem:
http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Layer/Vector/RootContainer-js.html

Regards,
Marc


afrozk wrote:
> Hi,
> 	I have two vector layers Layer1 and Layer2 on a country base map.
> 	I use the following code to fetch data for the layers.
> 	var selectControl = new OpenLayers.Control.SelectFeature(
> 				[Layer1, Layer2],
>                 {
>                     toggle: true,
>                     multiple: true, 
> 					hover: true,
> 					onSelect: getLayerDetails
> 				}
> 				
> 			);
> 			
> 		
> 		function getLayerDetails(feature) {
> 			alert(feature.attributes.name);
> 		}
> 		
> 	The above function gives me data correctly when i hover on each independant
> layers, but
> 	there are certain areas on the map where some parts of Layer1 and Layer2
> overlap.
> 	When I hover on the overlap, I always get the data for Layer1.
> 	I read here in http://docs.openlayers.org/library/overlays.html, under
> Interaction section that ,
> 	there is no support for selecting features from more than a single vector
> layer at a time, as of OL 2.7.
> 	
> 	Is there a way in OL 2.8 by which I can get data for the underlying Layer2
> as well.
> 	Or is there a workaround (for the overlap area) by which can I get the data
> for the a particular layer based on which layer was hovered previously.
>
> Any help would be highly appreciated. 
> 	
> 	
> 	
> Thanks and regards
> Afroz Kannancheri Kodiyathur
> 	
> 	
>   


-- 


  Dipl.-Geogr. Marc Jansen
  - Anwendungsentwickler -

  terrestris GmbH & Co. KG
  Irmintrudisstraße 17
  53111 Bonn

  Tel:    ++49 (0)228 / 96 28 99 -53
  Fax:    ++49 (0)228 / 96 28 99 -57

  Email:  jansen at terrestris.de
  Web:    http://www.terrestris.de

  Amtsgericht Bonn, HRA 6835
  Komplementärin:  terrestris Verwaltungsgesellschaft mbH
  vertreten durch: Hinrich Paulsen, Till Adams  





More information about the Users mailing list