It seems, that OL doesn't parse ExtendedData in filter property try simple attributes to see if your code works. ... <ANNUAL>2242.269</ANNUAL> <SPRING>2128.142</SPRING> <SUMMER>2864.096</SUMMER> <FALL>2002.744</FALL> <WINTER>1974.092</WINTER> ...
This should work. Arnd -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von [email protected] Gesendet: Donnerstag, 6. Dezember 2012 20:34 An: [email protected]; OpenGSC Betreff: Re: [OpenLayers-Users] Can Not Get Rule-based Stying to Work on KML OpenGSC, Thanks for he advise, but I can't get it to work. Please point out where I am wrong. This my code now: var map = new OpenLayers.Map("map"); var vector_style = new OpenLayers.Style({ fillColor: "#ffffff", fillOpacity: 0.1, strokeWidth: 1, strokeColor: "#ffffff", strokeOpacity: 4, }); var ruleLow = new OpenLayers.Rule({ filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.LESS_THAN, property: "SUMMER", value = 2000.0 }), symbolizer: { strokeColor: "#00ff00", strokeWidth: 1, fillColor: "#00ff00" } }); var ruleHigh = new OpenLayers.Rule({ filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO, property: "SUMMER", value = 2000.0 }), symbolizer: { strokeColor: "#ff0000", strokeWidth: 1, fillColor: "#ff0000" } }); vector_style.addRules([ruleLow, ruleHigh]); var vector_style_map = new OpenLayers.StyleMap({ 'default': vector_style }); var vectorlayer = new OpenLayers.Layer.Vector("SOLAR RAD BA", { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: "kml/ba_diffuse_summer.kml", format: new OpenLayers.Format.KML({ extractStyles: false, extractAttributes: true, srsName: "EPSG:900913" }) }), styleMap: vector_style_map }); var googleLayer = new OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22} ); map.addLayers([googleLayer, vectorlayer]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.zoomToMaxExtent(); ------------------------------------ Reinaldo Escada Chohfi Sócio Gerente GeoDesign Internacional www.geodesign.com.br (http://www.geodesign.com.br) Tel./Fax: (12) 3153-5115 Inteligência e Tecnologia Espacial de Ponta >---- Original Message ---- >From: OpenGSC <[email protected]> >To: [email protected] >Sent: Qui, Dez 6, 2012, 3:49 AM >Subject: Re: [OpenLayers-Users] Can Not Get Rule-based Stying to Work >on KML > >syleMap is not equal to style,your code is not correct. >construt a styleMap and match the defalut attribute to you style. >and Assign it to vectory layer's styleMap attribute > > > >-- >View this message in context: >http://osgeo-org.1560.n6.nabble.com/Can-Not-Get-Rule-based-Stying-to-Wo >rk-on-KML-tp5021027p5021109.html Sent from the OpenLayers Users mailing >list archive at Nabble.com. >_______________________________________________ >Users mailing list >[email protected] >http://lists.osgeo.org/mailman/listinfo/openlayers-users _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
