[OpenLayers-Users] wms untiled 'busy loading' message or image

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Thu May 3 07:58:08 EDT 2007


Hi Richard,

there is for WMS.Untiled only:

var layerloadcounter = 0;
var activitydiv;

mylayer.events.register( 'loadend', this, decreasecounter);
mylayer.events.register( 'loadcancel', this, decreasecounter);
mylayer.events.register( 'loadstart', this, increasecounter);

function increasecounter()
{
  layerloadcounter++;
  if (layerloadcounter > 0 && activitydiv) 
  {   
    activitydiv.style.visibility = "visible"; 
  }
}

function decreasecounter(){
  if (layerloadcounter > 0) layerloadcounter--;
  if (layerloadcounter == 0 && activitydiv) 
  { 
    activitydiv.style.visibility = "hidden";
  }
}

And then have some kind of div in the center of the map div:

function activitylayerinit()
{
  sz = new OpenLayers.Size();
  sz.h = gMapDHTMLWaitImageHeight;
  sz.w = gMapDHTMLWaitImageWidth; 
  var dim = OpenLayers.Element.getDimensions(map.viewPortDiv);
  position = 
    new OpenLayers.Pixel(dim.width-gMapDHTMLWaitImageWidth-25, 
      gMapDHTMLWaitImageHeight);
    activitydiv = OpenLayers.Util.createDiv("ActivityLayer", 
      position, sz, gMapDHTMLWaitImage);
    activitydiv.style.zIndex = 1000;
    map.viewPortDiv.appendChild(activitydiv);
}

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: Richard Duivenvoorde <rdmailings at duif.net>
Naar: users at openlayers.org <users at openlayers.org>
Onderwerp: [OpenLayers-Users] wms untiled 'busy loading' message or image
Datum: 03/05/07 09:40

> Hi List,
> 
> What is the preferred way to implement some kind of 'loading or busy 
> message' for a slow wms server?
> 
> I've got a map with some (faster) tiled reference layers, and one (slow) 
> untiled wms top layer. While the reference layer loads pretty fast, the 
> (dynamic) top layer is sometimes loaded after a few seconds. I want to 
> inform users that they have to be patient for a while :-)
> 
> If there is some kind of callback mechanisme possible which is called 
> when the image is loaded? So I can show an image while loading, and 
> remove it when this callback function is called.
> 
> TIA
> 
> Richard Duivenvoorde
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 






More information about the Users mailing list