<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19328"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=703275319-11122012><FONT color=#0000ff 
size=2 face=Arial>try with attributes like</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=703275319-11122012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=703275319-11122012><FONT color=#0000ff 
size=2 face=Arial><SUMMER>1000.123</SUMMER></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=703275319-11122012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=703275319-11122012><FONT color=#0000ff 
size=2 face=Arial>instead of this</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=703275319-11122012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left>        
<ExtendedData><BR>          
<SchemaData 
schemaUrl="#ba_summerId"><BR>            
<SimpleData 
name="SUMMER">1000.123</SimpleData><BR>          
</SchemaData><BR>        
</ExtendedData><BR></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=703275319-11122012>then your code should work. Very likely the property in 
the filter doesn't evaluate against ExtendedData.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=703275319-11122012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=703275319-11122012>Arnd</SPAN></FONT></DIV><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>reinaldo@geodesign.com.br<BR><B>Gesendet:</B> Dienstag, 11. Dezember 2012 
03:42<BR><B>An:</B> openlayers-users@lists.osgeo.org; OpenGSC<BR><B>Betreff:</B> 
[OpenLayers-Users] Can Not Get Rule-based Styling to Work with 
KML<BR></FONT><BR></DIV>
<DIV></DIV>OP Users,<BR><BR>I can't get the rule-base styling to work on KML 
file.<BR><BR>Please find below my JS, HTML and KML files.<BR><BR>I would 
appreciate very much if someone could help me. <BR><BR>I examined the examples, 
read the documentation and double checked the KML file structure. Evertyhing 
indicate that the rule-based styling should work, but it doesn't.<BR><BR>I 
created a simple kml file with one attribute for each placemark. I can get the 
attributes rendered as labels, but I can not do the rule-based styling to work 
It looks like the rules are not being evaluated because I only get the 
elseifFilter style result rendered. It does not evaluate the other two EQUAL_TO 
rules, or any other Filter.Comparison rule.<BR><BR>Thanks in 
advance,<BR><BR>Reinaldo<BR><BR>*** JS FILE 
**************************************<BR>var map = new 
OpenLayers.Map("map");<BR><BR>var vector_style = new OpenLayers.Style(<BR>  
{<BR>        fillColor: 
"#00ff00",<BR>        fillOpacity: 
0.1,<BR>        strokeWidth: 
1,<BR>        strokeColor: 
"#0000ff",<BR>        strokeOpacity: 
4,<BR>//        label: 
'${state}',<BR>//        fontColor: 
"#ff0000",<BR>//        fontFamily: 
"sans-serif",<BR>//        fontSize: 
"10px",<BR>//        fontWeight: 
"bold"<BR>},<BR>//{<BR>//context: {<BR>//state: function(feature){ return 
feature.attributes.SUMMER.value; }<BR>//}},<BR>  {<BR>   rules: 
[<BR>     new 
OpenLayers.Rule({<BR>            
filter: new 
OpenLayers.Filter.Comparison({<BR>            
type: 
OpenLayers.Filter.Comparison.EQUAL_TO,<BR>            
property: 
"SUMMER",<BR>            
value: 1000.123<BR>          
}),<BR>            
symbolizer: {<BR>           
fillColor: 
"#ff0000",<BR>           
fillOpacity: 
1.0,<BR>           
strokeWidth: 1,<BR>           
strokeColor: 
"#ff0000",<BR>           
strokeOpacity: 4,<BR>          
}<BR>         
}),<BR>     new 
OpenLayers.Rule({<BR>            
filter: new 
OpenLayers.Filter.Comparison({<BR>            
type: 
OpenLayers.Filter.Comparison.EQUAL_TO,<BR>            
property: 
"SUMMER",<BR>            
value: 2000.123<BR>          
}),<BR>            
symbolizer: {<BR>           
fillColor: 
"#00ff00",<BR>           
fillOpacity: 
1.0,<BR>           
strokeWidth: 1,<BR>           
strokeColor: 
"#00ff00",<BR>           
strokeOpacity: 4,<BR>          
}<BR>         
}),<BR>     new 
OpenLayers.Rule({<BR>         // apply 
this rule if no others 
apply<BR>            
elseFilter: 
true,<BR>            
symbolizer: 
{<BR>               
fillColor: 
"#ffff00",<BR>               
fillOpacity: 
1.0,<BR>               
strokeWidth: 
1,<BR>               
strokeColor: 
"#ffffff",<BR>               
strokeOpacity: 
4,<BR>              
}<BR>         
})<BR>     ]<BR>  }<BR>);<BR><BR>var vector_style_map = 
new OpenLayers.StyleMap({<BR>'default': vector_style<BR>});<BR><BR>var 
vectorlayer = new OpenLayers.Layer.Vector("SOLAR RAD BAHIA", 
{<BR>        strategies: [new 
OpenLayers.Strategy.Fixed()],<BR>        
protocol: new 
OpenLayers.Protocol.HTTP({<BR>           
url: 
"kml/ba_diff_simple1.kml",<BR>            
format: new 
OpenLayers.Format.KML({<BR>               
extractStyles: 
false,<BR>               
extractAttributes: 
true,<BR>               
srsName: 
"EPSG:900913"<BR>            
})<BR>        
}),<BR>        styleMap: 
vector_style_map<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>*** HTML 
FILE **************************************<BR><!DOCTYPE 
html><BR><html><BR><html><BR>    
<head><BR>    <meta http-equiv="Content-Type" 
content="text/html; charset=utf-8"><BR>    <meta 
name="viewport" content="width=device-width, initial-scale=1.0, 
maximum-scale=1.0, user-scalable=0"><BR>    <meta 
name="apple-mobile-web-app-capable" 
content="yes"><BR>        <link 
rel="stylesheet" href="../theme/default/style.css" 
type="text/css"><BR>        <link 
rel="stylesheet" href="style.css" 
type="text/css"><BR>        <script 
src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script><BR><style 
type="text/css"><BR>#map {<BR>    width: 
600px;<BR>    height: 450px;<BR>    border: 1px 
solid black;<BR>}<BR></style><BR>    
</head><BR>    
<body><BR>        <h1 
id="title">OpenLayers 
Example</h1><BR>        <div 
id="tags">simple, basic, 
light</div><BR>        <div id="map" 
class="smallmap"></div><BR>        
<script 
src="../lib/OpenLayers.js"></script><BR>        
<script src="example1.js"></script><BR>    
</body><BR></html><BR><BR>*** KML FILE 
**************************************<BR><kml 
xmlns="http://www.opengis.net/kml/2.2"><BR>  
<Document><BR>    
<Folder><BR>      
<name>diffuse_summer</name><BR>      
<Schema name="ba_diffuse_summer" id="ba_summerId"><BR>    
<SimpleField name="SUMMER" 
type="double"></SimpleField><BR>      
</Schema><BR>      
<Placemark><BR>        
<Style><BR>          
<LineStyle><BR>            
<color>ff0000ff</color><BR>          
</LineStyle><BR>          
<PolyStyle><BR>            
<fill>0</fill><BR>          
</PolyStyle><BR>        
</Style><BR>        
<ExtendedData><BR>          
<SchemaData 
schemaUrl="#ba_summerId"><BR>            
<SimpleData 
name="SUMMER">1000.123</SimpleData><BR>          
</SchemaData><BR>        
</ExtendedData><BR>        
<Polygon><BR>          
<outerBoundaryIs><BR>            
<LinearRing><BR>              
<coordinates>-39.551991120000018,-8.654038020000009 
-39.461196960000017,-8.650702980000011 -39.457748160000023,-8.738279009999998 
-39.54856104000001,-8.741648970000023 
-39.551991120000018,-8.654038020000009</coordinates><BR>            
</LinearRing><BR>          
</outerBoundaryIs><BR>        
</Polygon><BR>      
</Placemark><BR>      
<Placemark><BR>        
<Style><BR>          
<LineStyle><BR>            
<color>ff0000ff</color><BR>          
</LineStyle><BR>          
<PolyStyle><BR>            
<fill>0</fill><BR>          
</PolyStyle><BR>        
</Style><BR>        
<ExtendedData><BR>          
<SchemaData 
schemaUrl="#ba_summerId"><BR>            
<SimpleData 
name="SUMMER">2000.123</SimpleData><BR>          
</SchemaData><BR>        
</ExtendedData><BR>        
<Polygon><BR>          
<outerBoundaryIs><BR>            
<LinearRing><BR>              
<coordinates>-39.370407120000024,-8.647350030000021 
-39.27961296000003,-8.643977999999999 -39.27612708000003,-8.731485000000008 
-39.366936000000003,-8.734890960000024 
-39.370407120000024,-8.647350030000021</coordinates><BR>            
</LinearRing><BR>          
</outerBoundaryIs><BR>        
</Polygon><BR>      
</Placemark><BR>      
<Placemark><BR>        
<Style><BR>          
<LineStyle><BR>            
<color>ff0000ff</color><BR>          
</LineStyle><BR>          
<PolyStyle><BR>            
<fill>0</fill><BR>          
</PolyStyle><BR>        
</Style><BR>        
<ExtendedData><BR>          
<SchemaData 
schemaUrl="#ba_diffuse_summerId"><BR>            
<SimpleData 
name="SUMMER">3000.123</SimpleData><BR>          
</SchemaData><BR>        
</ExtendedData><BR>        
<Polygon><BR>          
<outerBoundaryIs><BR>            
<LinearRing><BR>              
<coordinates>-41.365158120000011,-8.805078990000009 
-41.274315,-8.802090000000005 -41.271233040000013,-8.890313040000013 
-41.362098840000023,-8.893332990000021 
-41.365158120000011,-8.805078990000009</coordinates><BR>            
</LinearRing><BR>          
</outerBoundaryIs><BR>        
</Polygon><BR>      
</Placemark><BR>    </Folder><BR>  
</Document><BR></kml><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>