Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In OpenLayers, is there an event which fires when the map starts drawing any layer, and another for when the map has finished drawing all layers?

I wish to display a "waiting" animation while any layer is still drawing.

The help file for LoadingPanel mentions something which sounds promising, but the sample doesn't work and it mentions tiles (I'd like it to work on vector layers too).

I'm looking for the equivalent of dojo.connect(map,"onUpdateEnd"... in the ArcGIS JS API:

Fires after layers that are updating their content have completed. This event is often used in combination with onUpdateStart to display a "Map is busy" or "Loading? " message as visual feedback to the end-user.

(As a workaround, I could count the layers in the map, and monitor the status of each layer using layer.events.register("loadend"... until they have all finished. Are there other options?)

Thanks

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

A loading panel is available as an add-in and was first mentioned here. You can either use that or hack it to suit your needs; anyway imho it provides good enough functionality.

The linked example does not work so I took the liberty of assembling a working jsfiddle:

http://jsfiddle.net/bxpjT/1/

share|improve this answer
    
Thanks for that - much appreciated. I'm finding that both the loading panel and layer.events.register("loadend"... are a bit buggy and don't always register the end of drawing, but I'll explore this in a separate thread if I can't resolve it –  Stephen Lead Aug 12 '12 at 1:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.