[ka-Map-users] Detecting when tile images have loaded

Pete Giencke pgiencke at glc.org
Thu Apr 20 14:38:32 EDT 2006


There was actually some discussion on this topic last year
Through that discussion, I ran into the same luck you're having with this,
which is, I wasn't able to (repeatably) detect when all the images had
loaded. I think Brent Peterson was on the right track back when he suggested
comparing the ids of the tiles loaded with the tiles generated. 


-----Original Message-----
From: ka-map-users-bounces at lists.maptools.org
[mailto:ka-map-users-bounces at lists.maptools.org] On Behalf Of David Badke
Sent: Thursday, April 20, 2006 2:17 PM
To: ka-map-users at lists.maptools.org
Subject: [ka-Map-users] Detecting when tile images have loaded

I would like to be able to detect when all of the tile images have been
loaded - that is, get an event to trigger when the map image (or only a
certain layer) has been fully drawn by the browser. Since there is no such
event in ka-Map now, I have been trying to create one, with very limited
success. I had thought I could count the number of calls to tile.php (which
I can, in kaMap.setTile) to get a count of the number of images expected,
then decrement the count in the tile image onload event hander
(kaMap_imgOnLoad) as each image loads. This doesn't work; even when I
compensate for kaMap_imgOnLoad being called for already visible tiles, the
count hits zero when the browser has only partly finished drawing. I have
not found any reliable way to detect when all tiles are loaded, so
triggering an event (which in itself is easy to do with the event manager)
is problematic - when do I trigger it?

Anyone have any ideas how this could be done?



David Badke
Humanities Computing and Media Center
University of Victoria, BC, Canada

ka-Map-users mailing list
ka-Map-users at lists.maptools.org

More information about the ka-Map-users mailing list