<html><body>OL Users,<br><br>I tried a new piece of code based on the provided OL examples. But I still can not get the rule-based styling to work with a KML file.<br><br>Could someone please help?<br><br>Thanks.<br><br>This is how my code looks like now:<br><br>var map = new OpenLayers.Map("map");<br><br>var googleLayer = new OpenLayers.Layer.Google("Google Satellite",<br>            {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}<br>        );<br><br>var features = 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: new OpenLayers.StyleMap(style)<br>});<br><br>var style = new OpenLayers.Style(<br>  {<br>   fillColor: "#ffffff",<br>   fillOpacity: 0.1,<br>   strokeWidth: 1,<br>   strokeColor: "#ffffff",<br>   strokeOpacity: 4<br>  },<br> <br>  {<br>   rules: [<br>     new OpenLayers.Rule({<br>            filter: new OpenLayers.Filter.Comparison({<br>            type: OpenLayers.Filter.Comparison.LESS_THAN,<br>            property: "SUMMER",<br>            value: 2000<br>          }),<br>            symbolizer: {<br>            strokeColor: "#00ff00",<br>            strokeWidth: 1,<br>            fillColor: "#00ff00"<br>          }<br>         }),<br>     new OpenLayers.Rule({<br>            filter: new OpenLayers.Filter.Comparison({<br>            type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,<br>            property: "SUMMER",<br>            value: 2000<br>          }),<br>            symbolizer: {<br>            strokeColor: "#ff0000",<br>            strokeWidth: 1,<br>            fillColor: "#ff0000"<br>          }<br>         })<br>     ]<br>  }<br>);<br><br>map.addLayers([googleLayer, features]);<br>map.addControl(new OpenLayers.Control.LayerSwitcher());<br>map.zoomToMaxExtent();<br><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>