<html><body>OL Users,<br><br>I am now trying to do rule-based styling, but am not getting anywhere. <br><br>Can some one help?<br><br>I would like to apply styling base on rules, such as the examples:<br><br>var map = new OpenLayers.Map("map");<br><br>var vector_style = new OpenLayers.Style();<br><br>var ruleLow = new OpenLayers.Rule({<br> filter: new <a target="_blank" href="http://OpenLayers.Filter.Comparison">OpenLayers.Filter.Comparison</a>({<br> type: <a target="_blank" href="http://OpenLayers.Filter.Comparison.LESS_THAN,">OpenLayers.Filter.Comparison.LESS_THAN,</a><br> property: "SUMMER",<br> value = 2000.0<br> }),<br> symbolizer: {<br> strokeColor: "#ff0000",<br> strokeWidth: 1,<br> fillColor: "#ff0000"<br> }<br> });<br>var ruleHigh = new OpenLayers.Rule({<br> filter: new <a target="_blank" href="http://OpenLayers.Filter.Comparison">OpenLayers.Filter.Comparison</a>({<br> type: <a target="_blank" href="http://OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,">OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,</a><br> property: "SUMMER",<br> value = 2000.0<br> }),<br> symbolizer: {<br> strokeColor: "#ff0000",<br> strokeWidth: 1,<br> fillColor: "#ff0000"<br> }<br> });<br><br>vector_style.addRules([ruleLow, ruleHigh]);<br><br>var vectorlayer = new OpenLayers.Layer.Vector("SOLAR RAD BA", {<br> strategies: [new OpenLayers.Strategy.Fixed()],<br> protocol: new OpenLayers.Protocol.HTTP({<br> url: "kml/ba_diffuse_summer.kml",<br> format: new OpenLayers.Format.KML({<br> extractStyles: false,<br> extractAttributes: true,<br> srsName: "EPSG:900913"<br> })<br> }),<br> styleMap: vector_style<br>});<br><br>var googleLayer = new OpenLayers.Layer.Google("Google Satellite",<br> {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}<br> );<br><br>map.addLayers([googleLayer, vectorlayer]);<br>map.addControl(new OpenLayers.Control.LayerSwitcher());<br>map.zoomToMaxExtent();<br><br>I have a KML file with the following attributes for the features (placemarks):<br><br><Schema name="ba_diffuse_summer" id="ba_diffuse_summer"><br> <SimpleField name="Name" type="string"></SimpleField><br> <SimpleField name="Description" type="string"></SimpleField><br> <SimpleField name="ID_CEL" type="string"></SimpleField><br> <SimpleField name="LONGITUDE" type="float"></SimpleField><br> <SimpleField name="LATITUDE" type="float"></SimpleField><br> <SimpleField name="JAN" type="float"></SimpleField><br> <SimpleField name="FEB" type="float"></SimpleField><br> <SimpleField name="MAR" type="float"></SimpleField><br> <SimpleField name="APR" type="float"></SimpleField><br> <SimpleField name="MAY" type="float"></SimpleField><br> <SimpleField name="JUN" type="float"></SimpleField><br> <SimpleField name="JUL" type="float"></SimpleField><br> <SimpleField name="AUG" type="float"></SimpleField><br> <SimpleField name="SEP" type="float"></SimpleField><br> <SimpleField name="OCT" type="float"></SimpleField><br> <SimpleField name="NOV" type="float"></SimpleField><br> <SimpleField name="DEC" type="float"></SimpleField><br> <SimpleField name="ANNUAL" type="float"></SimpleField><br> <SimpleField name="SPRING" type="float"></SimpleField><br> <SimpleField name="SUMMER" type="float"></SimpleField><br> <SimpleField name="FALL" type="float"></SimpleField><br> <SimpleField name="WINTER" type="float"></SimpleField><br></Schema><br> <Placemark><br> <Style><LineStyle><color>ff0000ff</color></LineStyle> <PolyStyle><fill>0</fill></PolyStyle></Style><br> <ExtendedData><SchemaData schemaUrl="#ba_diffuse_summer"><br> <SimpleData name="ID_CEL">cel_41355</SimpleData><br> <SimpleData name="LONGITUDE">-39.33</SimpleData><br> <SimpleData name="LATITUDE">-8.514</SimpleData><br> <SimpleData name="JAN">2354.6590</SimpleData><br> <SimpleData name="FEB">3722.106</SimpleData><br> <SimpleData name="MAR">2457.454</SimpleData><br> <SimpleData name="APR">2300.018</SimpleData><br> <SimpleData name="MAY">1856.493</SimpleData><br> <SimpleData name="JUN">1874.805</SimpleData><br> <SimpleData name="JUL">1766.843</SimpleData><br> <SimpleData name="AUG">2075.472</SimpleData><br> <SimpleData name="SEP">2165.046</SimpleData><br> <SimpleData name="OCT">2079.367</SimpleData><br> <SimpleData name="NOV">2044.279</SimpleData><br> <SimpleData name="DEC">2210.000</SimpleData><br> <SimpleData name="ANNUAL">2242.269</SimpleData><br> <SimpleData name="SPRING">2128.142</SimpleData><br> <SimpleData name="SUMMER">2864.096</SimpleData><br> <SimpleData name="FALL">2002.744</SimpleData><br> <SimpleData name="WINTER">1974.092</SimpleData><br> </SchemaData></ExtendedData><br> <MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>-39.374898840000021,-8.532500220000012
-39.368901960000017,-8.53460298000002
-39.361320000000006,-8.539000020000019
-39.357873000000019,-8.542680029999996
-39.356818920000016,-8.546292000000021
-39.352569839999994,-8.549219969999998 -39.345095880000024,-8.55734202
-39.342219480000033,-8.558644590000013
-39.373840080000008,-8.559807030000023
-39.374898840000021,-8.532500220000012</coordinates></LinearRing></outerBoundaryIs></Polygon><Polygon><outerBoundaryIs><LinearRing><coordinates>-39.328748280000021,-8.558149410000008
-39.339051840000003,-8.558528130000013
-39.331622880000026,-8.557507980000004
-39.328748280000021,-8.558149410000008</coordinates></LinearRing></outerBoundaryIs></Polygon><Polygon><outerBoundaryIs><LinearRing><coordinates>-39.311822160000034,-8.557527150000002
-39.311876160000018,-8.557529130000008 -39.311844840000013,-8.55752202
-39.311822160000034,-8.557527150000002</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry><br> </Placemark><br> <br>Thanks a lot.<br><br>Reinaldo<br><br>
<hr>
<br>
Reinaldo Escada Chohfi<br>
Sócio Gerente<br>
GeoDesign Internacional<br>
<a href="http://www.geodesign.com.br">www.geodesign.com.br</a><br>
Tel./Fax: (12) 3153-5115<br>
<br>
Inteligência e Tecnologia Espacial de Ponta<br>
<br></body></html>