[OpenLayers-Dev] KML and labels from attributes
Slawomir Messner
slawomir.messner at staff.uni-marburg.de
Wed Jul 28 04:23:28 EDT 2010
Hi,
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.
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.
My code looks like:
this.layer.styleMap =new OpenLayers.StyleMap({
"default":new OpenLayers.Style({
pointRadius: 6,
fillColor:"#666666",
strokeColor:"#00FF00",
labelAlign:"lb",
label:"${" + jQuery(this.viewSelect).val() +"}"
}),
});
It would be cool if it would work like this:
this.layer.styleMap =new OpenLayers.StyleMap({
"default":new OpenLayers.Style({
pointRadius: 6,
fillColor:"#666666",
strokeColor:"#00FF00",
labelAlign:"lb",
label:"${" + jQuery(this.viewSelect).val() +".value}"
}),
});
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:)
Regards,
Slawomir
--
-----------------------------------------------
Slawomir Messner
Forschungszentrum "Deutscher Sprachatlas"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100728/1653ad40/attachment.html
More information about the Dev
mailing list