<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
I have a kml-layer with attributes. In the KML-file the attributes
are stored in ExtendedData/Data tag, so OL parses an attribute into
feat.attributes.attrib1 as object with value and displayName
attributes.<br>
Now I want that OL shows the value of one of the attributes as
labels. To do sos I would like to use the "${attribName}" notation
but with KML-parsed attributes it should be something like this
"${attribName.value}" but it's not working. I think I could
implement to follow the point to the attribute of the attribute
myself, but I would like to know if someone has done it before, if
there is another solution or if there is another common way to do
this.<br>
My code looks like:<br>
<title>Snippet</title>
<pre style="font-family: consolas;"><span style="color: blue;">this</span>.layer.styleMap = <span style="color: blue;">new</span> OpenLayers.StyleMap({
<span style="color: maroon;">"default"</span>: <span style="color: blue;">new</span> OpenLayers.Style({
pointRadius: 6,
fillColor: <span style="color: maroon;">"#666666"</span>,
strokeColor: <span style="color: maroon;">"#00FF00"</span>,
labelAlign: <span style="color: maroon;">"lb"</span>,
label: <span style="color: maroon;">"${"</span> + jQuery(<span style="color: blue;">this</span>.viewSelect).val() + <span style="color: maroon;">"}"</span>
}),
});
It would be cool if it would work like this:
<span style="color: blue;">this</span>.layer.styleMap = <span style="color: blue;">new</span> OpenLayers.StyleMap({
<span style="color: maroon;">"default"</span>: <span style="color: blue;">new</span> OpenLayers.Style({
pointRadius: 6,
fillColor: <span style="color: maroon;">"#666666"</span>,
strokeColor: <span style="color: maroon;">"#00FF00"</span>,
labelAlign: <span style="color: maroon;">"lb"</span>,
label: <span style="color: maroon;">"${"</span> + jQuery(<span style="color: blue;">this</span>.viewSelect).val() + <span style="color: maroon;">".value}"</span>
}),
});
</pre>
Could someone tell me why, if I run the first code above, the labels
are "${attribName}"? But this is not so important, if I have to
implement it myself I will find out:)<br>
Regards,<br>
Slawomir<br>
<pre class="moz-signature" cols="72">--
-----------------------------------------------
Slawomir Messner
Forschungszentrum "Deutscher Sprachatlas"
</pre>
</body>
</html>