I have a simple wfs layer from geoserver, here is code:
//wfs-t editable overlay
var wfs_layer = new OpenLayers.Layer.Vector("Vector sample", {
strategies: [new OpenLayers.Strategy.Fixed()],
//projection: new OpenLayers.Projection("EPSG:4326"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
// loading data through localhost url path
url: ".....",
featureNS : ".....",
extractAttributes: true,
// layer name
featureType: "....",
geometryName: "geom",
schema: "localhost:8080/geoserver......"
})
});
//vector style:
var vector_style = new OpenLayers.Style({
'fillColor': '#669933',
'fillOpacity': .8,
'strokeColor': '#aaee77',
'strokeWidth': 3,
'pointRadius': 8
});
var vector_style_select = new OpenLayers.Style({
'fillColor': '#FF0000',
'fillOpacity': .10,
'graphicName': 'circle',
//'label': 'klik',
'pointRadius': 8,
'strokeColor': '#f86633',
'strokeDashstyle': 'solid',
'strokeWidth': 4
});
var vector_style_iz_table = new OpenLayers.Style({
'cursor': 'pointer',
'fillColor': '#669933',
'fillOpacity': .8,
'fontColor': '#343434',
'label': '${table1}',
'pointRadius': '8',
'strokeColor': '#aaee77',
'strokeWidth': 3,
'strokeDashstyle': 'solid',
'strokeWidth': '${4}'
});
var vector_style_map = new OpenLayers.StyleMap({
'default': vector_style_iz_table,
'select': vector_style_select
});
wfs_layer.styleMap = vector_style_map;
I have table from "table1" database, where is three different value: "yes", "no" and "null".
Everything works fine, in this style I can view vector layer with green fillcolor with label "yes" or "no" from my "table1".
I want 3 different style, for "yes"-> green fillcolor, for "no"-> red fillcolor and "null"-> black fillcolor.
Is that posible having 3 styles for one vector layer? I think that I must write rule filter for all three different value?
Thanks!