[mapguide-users] Little patch to make ajaxviewer as fast as google.maps

Bruno Scott bscott at geomapgis.com
Mon Apr 6 10:06:05 EDT 2009



why would it end up loading the same tile more than once?
the host is selected randomly once the tile url has been constructed
for cases where load matters, an even randomised spread is far more desirable
z


This is the code in mapguide where it is called

function RequestTile(col, row, tilex, tiley)
{
    for(var k=0; k < baseGroups.length; k++)
    {
        if(visBaseGroups.getItem(baseGroups[k]) == null)
            continue;
        cellSpec = k + ":" + col + ":" + row;
        cell = document.getElementById(cellSpec);
        if(cell == null)
        {
            if((cell = FindCell(k, cellSpec)) == null)
                return 0;
        }
        if(cell.loaded == "1")
            return 0;
        cell.loaded = "1";
        if(useHttpTile == 1)
        {
          url = GetHttpTileUrl(tilex, tiley, sci, baseGroups[k],k==0);
        }
        else
        {
          url = webAgent + "?OPERATION=GETTILEIMAGE&VERSION=1.2.0&...
        }

        tag = '<img id="' + (imgId) + '" width=' + TILECX + ' height=' + TILECY + ' ...
        imgId ++;
        cell.innerHTML = tag;
    }
    return 1;
}

In debug mode i have noticed that the test 
  if(cell.loaded == "1")
failed sometimes even if i've already been over that cell.
this meens that the url for the tile will be recalculated, in that case a random may return a different url

I guess with openlayers that situation would never happend, but with mapguide it does.
I didn't lookup too much why the cell.loaded is lost, it could be a mapguide bug or a normal , behavior i don't know.

Bruno
-- 
View this message in context: http://n2.nabble.com/Little-patch-to-make-ajaxviewer-as-fast-as-google.maps-tp2580480p2593275.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list