[OpenLayers-Users] Howto extract documentattributes(name/description) from KML Layer

Sven Geggus lists at fuchsschwanzdomain.de
Mon Aug 2 11:07:50 EDT 2010


Arnd Wippermann <arnd.wippermann at web.de> wrote:

>    brewpub_layer.events.register("loadend", brewpub_layer, function (e) {
>        var fts = this.features;
>        for(var i=0;i<fts.length;i++)
>        {
>            theHTML = fts[i].attributes.name + ", " + fts[i].attributes.description + "<br>";
>        }
>    }); 

Ok, while this works for feature attributes it does still not give me the
the "global" name and description attributes of my kml document as a whole
as well as those attributes inside the folder definition but those are
actually the ones I am interested in.

My kml looks like this (roughly):
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" ...
<Document>
        <name>Name of KML Document</name>
        <Folder>
                <name>Folder Name</name>
                 <description>Folder description</name>

                 ... features come here
                
        </Folder>
</Document>
</kml>

So the question is how to access these attributes from javascript.

Regards

Sven

-- 
The main thing to note is that when you choose open source you don't
get a Windows operating system.
                                  (from http://www.dell.com/ubuntu)
/me is giggls at ircnet, http://sven.gegg.us/ on the Web



More information about the Users mailing list