<!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><FONT color=#0000ff size=2 face=Arial><SPAN
class=187455415-01122012>It seems, that the propertyStyles for label have to be
set.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=187455415-01122012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=187455415-01122012>something like this:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial>pois["styleMap"]["styles"]["default"]["propertyStyles"] =
{"label":true};</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial>Example:<BR><A
href="http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/kml_csv_data_layer/kml_csv_data_layer.asp?propertyStyles=true">http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/kml_csv_data_layer/kml_csv_data_layer.asp?propertyStyles=true</A><BR></FONT></DIV>
<DIV><SPAN class=187455415-01122012><FONT color=#0000ff size=2
face=Arial>Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=187455415-01122012><FONT color=#0000ff size=2
face=Arial>Arnd</FONT></SPAN></DIV>
<DIV><SPAN class=187455415-01122012><FONT color=#0000ff size=2
face=Arial>gis.ibbeck.de</FONT></SPAN></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><BR></DIV>
<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> Freitag, 30. November 2012
13:38<BR><B>An:</B> openlayers-users@lists.osgeo.org<BR><B>Betreff:</B>
[OpenLayers-Users] Can not Extract KML Attribute<BR></FONT><BR></DIV>
<DIV></DIV>OL Users,<BR><BR>Could some one please help?<BR><BR>I can not extract
attributes in a KML file. Here is my KML:<BR><BR><?xml version="1.0"
encoding="utf-8" ?><BR><kml
xmlns="http://www.opengis.net/kml/2.2"><BR>
<Document><BR>
<Folder><BR>
<name>ba_uf</name><BR>
<Schema name="ba_uf" id="ba_ufID"><BR>
<SimpleField type="string"
name="ID"></SimpleField><BR>
<SimpleField type="string"
name="Regiao"></SimpleField><BR>
<SimpleField type="string"
name="State"></SimpleField><BR>
<SimpleField type="float"
name="Area"></SimpleField><BR>
</Schema><BR>
<Placemark><BR>
<Style><BR>
<LineStyle><color>ff0000ff</color></LineStyle><BR>
<PolyStyle><fill>0</fill></PolyStyle><BR>
</Style><BR>
<ExtendedData><BR>
<SchemaData
schemaUrl="#ba_ufID"><BR>
<SimpleData
name="ID">2909901</SimpleData><BR>
<SimpleData
name="Regiao">Nordeste></SimpleData><BR>
<SimpleData
name="State">BAHIA></SimpleData><BR>
<SimpleData
name="Area">0</SimpleData><BR>
</SchemaData><BR>
</ExtendedData><BR>
<Polygon><BR>
<tessellate>1</tessellate><BR>
<outerBoundaryIs><BR>
<LinearRing><BR>
<coordinates><BR>
-39.76265494838268,-12.27246488227016,0
-39.48325151827876,-12.09283133762983,0 -39.41905766787695,-11.8699639552835,0
-39.36482198574752,-11.65858652001503,0 -39.76422342556302,-11.64471479218556,0
-40.04350054605078,-11.82438907570092,0 -40.01005372231482,-12.1350573465942,0
-39.76265494838268,-12.27246488227016,0 <BR>
</coordinates><BR>
</LinearRing><BR>
</outerBoundaryIs><BR>
</Polygon><BR>
</Placemark><BR>
</Folder><BR> </Document><BR></kml><BR><BR>This
what I am using to extract and style the
attributes:<BR><BR>...<BR> new
OpenLayers.Layer.Vector("ESTADO DA BAHIA",
{<BR>
strategies: [new
OpenLayers.Strategy.Fixed()],<BR>
protocol: new
OpenLayers.Protocol.HTTP({<BR>
url:
"kml/ba_uf_900913a.kml",<BR>
format: new
OpenLayers.Format.KML({<BR>
extractStyles: false,
<BR>
extractAttributes:
true,<BR>
srsName:
"EPSG:900913"<BR>
})<BR>
}),<BR>
style:
{<BR>
fillColor:
"#ffffff",<BR>
fillOpacity:
0,<BR>
strokeWidth: 1,
<BR>
strokeColor: "#0000ff",
<BR>
strokeOpacity:
1,<BR>
label:
"${State}",<BR>
fontColor:
"#ffffff",<BR>
fontFamily:
"sans-serif",<BR>
fontSize:
"15px",<BR>
fontWeight:
"bold"<BR>
}<BR>...<BR><BR>I want the attribute for State to be rendered on the map, but I
only get ${State} rendered.<BR><BR>I've tried additng
<value></value> and label: "${State}" or label: "${State.value}" . I
get either ${State} or ${State.value} rendered on the map, but never the actual
attribute, which is BAHIA.<BR><BR>I just can´t get it to work. Could someone
help please?<BR><BR>Thanks a lot in advance.<BR><BR>Reinaldo<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>