Hi Sunny,
if you want to do this I think it's better if you create a feature layer via
WFS, because a WMS layer is a raster.
Try with something like:
myFeaturesLayer = new OpenLayers.Layer.Vector("name", {
styleMap: myStyle,
strategies: [wfsStrategy],
protocol: new OpenLayers.Protocol.WFS({
url: wfsurl,
featureType: "layerName", // on the server
featureNS: "workspaceNamespaceURI", // on the
server
srsName: "EPSG:xxxx",
version: "1.1.0" // : supports reprojection
})
});
then you can define myStyle in order to have a different style (color for
example) when you select (click) on a feature.
var myStyle = new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
<parameters>
}),
"select": new OpenLayers.Style({
<parameters>
})
});
For further info:
http://docs.openlayers.org/library/feature_styling.html#stylemap
http://docs.openlayers.org/library/feature_styling.html#stylemap
Good work!
Piero
--
View this message in context:
http://n2.nabble.com/changing-color-of-a-feature-tp4841655p4841884.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users