[OpenLayers-Users] changing color of a feature
Piero Campa
piero.campa at gmail.com
Fri Apr 2 05:19:59 EDT 2010
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.
More information about the Users
mailing list