register 'loadend' for your layer and declare there your function 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>"; } });
Arnd -----Ursprüngliche Nachricht----- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Sven Geggus Gesendet: Montag, 2. August 2010 11:21 Betreff: Re: [OpenLayers-Users] Howto extract documentattributes(name/description) from KML Layer Arnd Wippermann <arnd.wipperm...@web.de> wrote: > As you have set extractAttributes to true you can do something like this: > > var fts = brewpub_layer.features; > > var theHTML = ""; > > for(var i=0;i<fts.length;i++) > { > theHTML = fts[i].attributes.name + ", " + > fts[i].attributes.description + "<br>"; } Hm fts seems to be of zero length here. So when do I have to run this code? Looks like the kml is not been read immediately after layer generation. Sven -- "If you don't make lower-resolution mapping data publicly available, there will be people with their cars and GPS devices, driving around with their laptops" (Tim Berners-Lee) /me is gig...@ircnet, http://sven.gegg.us/ on the Web _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users