[OpenLayers-Users] changing color of a feature

Piero Campa piero.campa at gmail.com
Fri Apr 2 06:38:45 EDT 2010


1) WFS strategies: 
http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Strategy-js.html
http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Strategy-js.html 
For example try with: wfsstrategy = new OpenLayers.Strategy.BBOX();

2) the layerName is the name of the layer on the server side (what do you
use? Geoserver?);

3) for example in Geoserver each layer belong to a workspace, which has a
namespace URI;

4) on the Style you don't have to explicit the name of the feature, just say
how a feature has to change when it is clicked. If you want a different
beaviour within different features, you can access to the feature
attributes.
In this way for example you have the point radius proportional to the
feature Attribute:

		var pointStyle = new OpenLayers.StyleMap({
                        [...]
			"select": new OpenLayers.Style({
				pointRadius: '${radius}',
			}, {
				context: {
					radius: function(feature) {
						return (feature.attributes.Attribute) * 10; // whatever you want
						}
				}
                       }
               });
-- 
View this message in context: http://n2.nabble.com/changing-color-of-a-feature-tp4841655p4842106.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list