[OpenLayers-Users] Description attribute of KML file

mpele pmilanovic at gmail.com
Tue Jun 9 06:38:59 EDT 2009




Andreas Hocevar-2 wrote:
> 
> 
> Here is what you could do. The snippet assumes you are using a GML
> layer with a KML format, because that is what I read between the lines
> in your question.
> 
> var documentDescription;
> var layer = new OpenLayers.Layer.GML("my gml layer", "http://my.url", {
>     format: OpenLayers.Format.KML,
>     formatOptions: {
>         read: function(data) {
>             OpenLayers.Format.KML.prototype.read.apply(this, arguments);
>             var desc = data.getElementsByTagNameNS(data, "*",
> "description");
>             if(desc.length && desc[0].parentNode.nodeName == "Document") {
>                documentDescription = desc[0].firstChild &&
> desc[0].firstChild.nodeValue;
>             }
>         }
>     }
> });
> 
> 

I have problems to implement this code. When I try to define "read:
function(data) " my code doesn't work even the function is empty. 

Is there any documentation that explains what can be done with OpenLayers? I
asume what should be done but I don't have knowlage to do it. :(


-- 
View this message in context: http://n2.nabble.com/Description-attribute-of-KML-file-tp3042113p3048694.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list