Hi,
yes, you can specify two or more layers in the same select feature control (in
fact, i think this is the way things should be done, only have a one select
control over the 'n' number of layers you want select from).
Below is a link two the openlayers example showing this. The important part is
this one:
selectControl = new OpenLayers.Control.SelectFeature( [vectors1, vectors2], {
clickout: true, toggle: false, multiple: false, hover: false, toggleKey:
"ctrlKey", // ctrl key removes from selection multipleKey: "shiftKey" // shift
key adds to selection } );
Where 'vectors1' and 'vectors2' are the layers.
http://openlayers.org/dev/examples/select-feature-multilayer.html
Regards.
Javier.
>________________________________
> De: Riaan Lombaard <[email protected]>
>Para: "[email protected]" <[email protected]>
>Enviado: Lunes 4 de junio de 2012 15:12
>Asunto: Re: [OpenLayers-Users] OpenLayers.Control.SelectFeature
>
>
>Ah thanks,
>
>Ok my select feature looks like this.
>
> //Create and add selectFeature control
> var select_feature_control = new OpenLayers.Control.SelectFeature(
> pointLayer,
> {
> multiple: false,
> toggle: true,
> toggleKey: 'ctrlKey',
> multipleKey: 'shiftKey'
> }
> );
>
> var select_feature_control_ten = new OpenLayers.Control.SelectFeature(
> leaseLayer,
> {
> multiple: false,
> toggle: true,
> toggleKey: 'ctrlKey',
> multipleKey: 'shiftKey'
> }
> );
>
>What you are saying is that I can combine these 2 in one?
>
>From:Dominik Mikiewicz [mailto:[email protected]]
>Sent: 04 June 2012 02:57 PM
>To: Riaan Lombaard
>Subject: RE: [OpenLayers-Users] OpenLayers.Control.SelectFeature
>
>Your top select control ‘covers’ the other control.
>You can use one select control for both layers.
>
>From:[email protected]
>[mailto:[email protected]] On Behalf Of Riaan Lombaard
>Sent: Monday, June 04, 2012 2:36 PM
>To: [email protected]
>Subject: [OpenLayers-Users] OpenLayers.Control.SelectFeature
>
>Hey Guys,
>
>Please assist.
>
>I have 2 layers.
>Layer 1. Vector Layer using only `OpenLayers.Geometry.Point` functionality.
>Layer2. Vector Layer using only `OpenLayers.Geometry.LinearRing` functionality.
>
>Now both of them have their own `OpenLayers.Control.SelectFeature` obviously
>adding, activating and registering the features on the map.
>
>The issue I am having is, when both layers are active only one of the layers
>selection functionality will work.
>
>For example if Layer1 and 2 are active, only Layer2 selection will work.
>Only when I disable Layer2 then Layer1 selection will work.
>
>Hope this make's sense. Please let me know if you need more information.
>
>Riaan
>_______________________________________________
>Users mailing list
>[email protected]
>http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users