<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>

<META name=GENERATOR content="MSHTML 8.00.6001.19019"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011>look at the OpenLayers examples</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011><A 
href="http://dev.openlayers.org/releases/OpenLayers-2.10/examples/styles-unique.html">http://dev.openlayers.org/releases/OpenLayers-2.10/examples/styles-unique.html</A><BR><A 
href="http://dev.openlayers.org/releases/OpenLayers-2.10/examples/style-rules.html">http://dev.openlayers.org/releases/OpenLayers-2.10/examples/style-rules.html</A></SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011>Below some code how I do things.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011>Arnd</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=031585721-06042011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial>/*<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Comparison.EQUAL_TO = 
"==";<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Comparison.NOT_EQUAL_TO = 
"!=";<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Comparison.LESS_THAN = 
"&lt;";<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Comparison.GREATER_THAN = 
"&gt;";<BR>&nbsp;&nbsp;&nbsp; * 
OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = 
"&lt;=";<BR>&nbsp;&nbsp;&nbsp; * 
OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = 
"&gt;=";<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Comparison.BETWEEN = 
"..";<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Comparison.LIKE = 
"~";</FONT></DIV>
<DIV>&nbsp;</DIV><FONT color=#0000ff size=2 face=Arial>
<DIV dir=ltr align=left><BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Logical.AND = 
"&amp;&amp;";<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Logical.OR = 
"||";<BR>&nbsp;&nbsp;&nbsp; * OpenLayers.Filter.Logical.NOT = "!";<BR>*/</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>function createRule(theField, theValue, theType, 
theGeom, theSymbolizer, theElseFilter, theRuleName)<BR>{<BR>&nbsp;&nbsp;&nbsp; 
var filter = new 
OpenLayers.Filter.Comparison({<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
type: theType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; property: 
theField,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value: 
theValue<BR>&nbsp;&nbsp;&nbsp; });</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; var rule = new 
OpenLayers.Rule({<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name : 
theRuleName,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filter: 
filter,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
elseFilter:theElseFilter<BR>&nbsp;&nbsp;&nbsp; });</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>&nbsp;&nbsp;&nbsp; rule.symbolizer[ theGeom /* "Point" 
or "Line" or "Polygon" */] = theSymbolizer;<BR>&nbsp;&nbsp;&nbsp; 
return(rule);<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>var styleMapTest;</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>var Symbolizers = {<BR>&nbsp;&nbsp;&nbsp; Turm: 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeColor: 
"#0000FF",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeWidth: 
3,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillColor: 
"#00AAFF",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointRadius: 
5<BR>&nbsp;&nbsp;&nbsp; },<BR>&nbsp;&nbsp;&nbsp; Kirche: 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeColor: 
"#FF00FF",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeWidth: 
3,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillColor: 
"#00AAFF",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointRadius: 
5<BR>&nbsp;&nbsp;&nbsp; },<BR>&nbsp;&nbsp;&nbsp; Denkmal: 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeColor: 
"#00FF00",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeWidth: 
3,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillColor: 
"#00AAFF",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointRadius: 
5<BR>&nbsp;&nbsp;&nbsp; },<BR>&nbsp;&nbsp;&nbsp; Else: 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeColor: 
"#FF0000",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeWidth: 
3,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillColor: 
"#00AAFF",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
graphicName:"star",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointRadius: 
5<BR>&nbsp;&nbsp;&nbsp; },<BR>&nbsp;&nbsp;&nbsp; Line : 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeColor: 
"#00FF00",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeWidth: 
3,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointRadius: 
5<BR>&nbsp;&nbsp;&nbsp; },<BR>&nbsp;&nbsp;&nbsp; Polygon: 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeColor: 
"#FF0000",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strokeWidth: 
3,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillColor: 
"#FFAA00",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillOpacity: 
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointRadius: 
5<BR>&nbsp;&nbsp;&nbsp; },<BR>&nbsp;&nbsp;&nbsp; Text: 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; label : 
"${name}",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; labelXOffset: 
"10",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; labelYOffset: 
"-10",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fontColor: 
"red",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fontSize: 
"12px",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fontFamily: 
"Arial",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fontWeight: 
"bold",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
display:"${getVisibility}",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
labelAlign: "lt"<BR>&nbsp;&nbsp;&nbsp; }<BR>};</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>styleMapTest = new OpenLayers.StyleMap();</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>var rules = [];<BR>rules.push(createRule("kategorie", 
"TURM",&nbsp;&nbsp;&nbsp; OpenLayers.Filter.Comparison.EQUAL_TO, "Point", 
Symbolizers["Turm"], false, "TURM"));<BR>rules.push(createRule("kategorie", 
"KIRCHE",&nbsp; OpenLayers.Filter.Comparison.EQUAL_TO, "Point", 
Symbolizers["Kirche"], false, "KIRCHE"));<BR>rules.push(createRule("kategorie", 
"DENKMAL", OpenLayers.Filter.Comparison.EQUAL_TO, "Point", 
Symbolizers["Denkmal"], false, 
"DENKMAL"));<BR>rules.push(createRule("kategorie", "DENKMAL", 
OpenLayers.Filter.Comparison.NOT_EQUAL_TO, "Text", Symbolizers["Text"], true, 
"ELSE"));</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr align=left>styleMapTest.styles["default"].addRules(rules);</DIV>
<DIV>&nbsp;</DIV>
<DIV dir=ltr 
align=left>map.layers[map.aktLayer]["styleMap"]=styleMapTest;<BR>map.layers[map.aktLayer].redraw();<BR></DIV>
<DIV dir=ltr align=left>&nbsp;</DIV></FONT><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org 
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Robert 
Buckley<BR><B>Gesendet:</B> Mittwoch, 6. April 2011 22:17<BR><B>An:</B> 
users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] vector polygon 
styling with rules<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV 
style="FONT-FAMILY: arial,helvetica,sans-serif; COLOR: #40007f; FONT-SIZE: 10pt">Hi,<BR><BR>I´m 
having a bad time trying to set styles to vector features,<BR><BR>I have made 
this...<BR><BR><BR>
<DIV>var style_solar = new OpenLayers.StyleMap({<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
"default": new 
OpenLayers.Style(OpenLayers.Util.applyDefaults({<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fillOpacity: 0.6, <BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fillColor: '#000000'<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; }, 
OpenLayers.Feature.Vector.style["default"])),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"select": new 
OpenLayers.Style(OpenLayers.Util.applyDefaults({<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fillOpacity: 0.6, <BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fillColor: 
'#FF0000'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}, 
OpenLayers.Feature.Vector.style["select"]))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
});<BR><BR><BR>which works ok...but I really need to add rules according to the 
wfs property "solar_kopf"<BR><BR>How can I apply rules to the stylemap?<BR><BR>I 
have tried numerous times but they all fail.<BR><BR>Could anyone provide me with 
a couple of examples?<BR><BR>yours,<BR><BR>Robert<BR></DIV></DIV></BODY></HTML>