[OpenLayers-Users] OpenLayers.Control.SelectFeature

Javier Mr javiersdevmail at ymail.com
Mon Jun 4 23:13:41 PDT 2012



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 <rlombaard at maxgeo.com>
>Para: "openlayers-users at lists.osgeo.org" <openlayers-users at lists.osgeo.org> 
>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:dominikmikiewicz at o2.pl] 
>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:openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Riaan Lombaard
>Sent: Monday, June 04, 2012 2:36 PM
>To: openlayers-users at lists.osgeo.org
>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
>Users at lists.osgeo.org
>http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120605/1f0d468d/attachment-0001.html>


More information about the Users mailing list