[OpenLayers-Users] Loading GML and features.length

Christopher Schmidt crschmidt at metacarta.com
Tue Sep 23 14:06:39 EDT 2008


On Tue, Sep 23, 2008 at 10:44:37AM -0700, Casagrande Luca wrote:
> 
> Hello everybody!
> 
> I wanna show a small popup with the number of features inside a GML layer
> loaded on the fly.Everything it's fine except that the number of features is
> always 0 also if I can see them on the map. 
> Can this be due the time needed to load the layer in the browser? 

Yes. use the loadend event. 

layer.events.register("loadend", layer, function() {
        alert(this.features.length) }); 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list