[OpenLayers-Users] control.SelectFeature

Alexandre Dube adube at mapgears.com
Tue Apr 20 10:31:17 EDT 2010


Sarah,

Sarah Schuessler wrote:
> If I use map.addLayers(wfs2) after defining my layer my map is empty 
> (no layers were loaded).
>
> You said:
> "unless you add all the vector layers to the SelectFeature control.
>
> Also, you could use only one layer (wfs2) for feature selection instead
> of two."
> Can I use only one vector layer or more than one?
If you have multiple layers of different types, let's say a 'city' 
layer, a 'road' layer and a 'water' layer (all of them vector) and you 
want to be able to select features from any of these layers, you can 
define an array of layers to the SelectFeature control and you'll be 
able to select any feature from any layer.

What you're currently doing is having a 'water' layer (I don't know what 
is the type, but let's assume they are 'water' polygons) to display your 
features and an other 'water' layer (that is empty) for feature 
selection.  Having 2 layers for just the purpose of selection seems odd 
so that is why I proposed you should only have one.

Do you want your features to be always Vector of do you want to 
'highlight' them only from drawing a box on the map ?

Also, do you have control on the feature server ?  I mean, are you able 
to add the missing projection on server-side ?  That could resolve that 
issue.

Kind regards,

-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list