[OpenLayers-Users] Tile Rendering start-stop

Greg Allensworth gregor at greeninfo.org
Mon Apr 9 16:16:17 EDT 2012


The 'loadstart' and 'loadend' events, for WMS layers anyway, indicate 
when all tiles have finished loading. We use this to make a little 
"loading..." spinner for the WMS layers, it works great.


function loadingStart(layer) {
     document.getElementById('loading').style.display = 'inline';
}

function loadingStop(layer) {
     document.getElementById('loading').style.display = 'none';
}

wmslayer.events.register('loadstart', wmslayer, loadingStart );
wmslayer.events.register('loadend', wmslayer, loadingStop );


Since the 1 param sent to the callback ("layer" above) is the WMS layer, 
you can fetch the layer's ID or name, and do something a little more 
sophisticated with getElementById() such as fetching a specific <IMG> 
element, so each layer can have its own loading spinner.

-- 
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the Users mailing list