I'm trying to alter the colour of displayed points using addUniqueValueRules
in OpenLayers. If I don't use addUniqueValueRules
all my points display the default colour (green). However, when I add addUniqueValueRules
, only those points that meet the rules are drawn.
The relevant code:
var styleMap = new OpenLayers.StyleMap({
fillOpacity: 1,
fillColor: "green",
pointRadius: 5
});
var styleLookup = {
"Hög": { fillColor: "red" },
"Måttlig": { fillColor: "yellow" },
"Undersöka": { fillColor: "cyan" }
};
styleMap.addUniqueValueRules( "default", "risk", styleLookup );
wfs = new OpenLayers.Layer.Vector("Editable Features", {
strategies : [new OpenLayers.Strategy.Fixed(), saveStrategy],
projection: new OpenLayers.Projection("EPSG:4326"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
srsName: "EPSG:4326",
url: "http://localhost/cgi-bin/tinyows",
featurePrefix: "tows",
featureNS : "http://www.tinyows.org/",
featureType: "tradcopy",
geometryName: "geom"
}),
styleMap: styleMap
});
Can anyone help me draw all the points - both default and the ones that meet the rules?