One of my students wants to style a WFS layer and have selections too. I got as far as this code http://ian01.geog.psu.edu/geoserver/www/wfs/wfs-sld2.html which styles the WFS (though with out the text labels) and while the selection control seems to be working (i.e. the box is blue not red) nothing is actually selected.
Tell me more
×
Geographic Information Systems Stack Exchange is a question and answer site for
cartographers, geographers and GIS professionals. It's 100% free, no registration required.
|
Looks like you're on your way to getting this to work. Though, I know this selection thing can be tricky so I thought i'd share my code which does selection and hover highlighting. Using a control to highlight and a control for selection:
|
|||
|
|
|
You don't need a separate layer in which to select features (unless you want copies of the features). So you can remove the following code:
And the onSelect, onUnSelect functions. Just set the OpenLayers.Feature.Vector.style["select"] on your WFS layer, and the control will take care of the rest. In addition: The onSelect function of the select control takes a single feature as a parameter so:
should be:
|
|||||||||
|