[OpenLayers-Users] [Fwd: [ka-Map-users] Speeding up tile display/download]

Stephen Woodbridge woodbri at swoodbridge.com
Sat Feb 17 15:16:59 EST 2007


Is this easy to do with OpenLayers? What would be invovled?

-Steve

-------- Original Message --------
Subject: [ka-Map-users] Speeding up tile display/download
Date: Sat, 17 Feb 2007 21:00:46 +0200
From: Ionut Muntean <ionut at muntean.ro>
Reply-To: ionut at muntean.ro
To: ka-map-users at lists.maptools.org

Hi,

Don't know if this is already known by you, but it is worth a try to
share this.

I've always wondered why google maps displays the tiles so fast.
mt0..mt3.google.com resolves to the same server. So what's the clue?
Fortunately, i've bumped on some web page where it says that IE and
Firefox have only 4 sockets for downloading the web page content.

So, what if altering kaMap.setTile() to use, sequentially, 4 server
names to build img.src?

The improvement was dramatically! The tiles are now loading 4 to 5 times
faster.

tileURL is now an array that holds 4 server names that are basically
only cnames in the dns server to the same server.

The setTile() function was modified to sequential build the img.src like
this (this is only the last part of the function):

.....
    var idx = this._map.kaMap.tileIDX;
     if (this._map.kaMap.tileURL[idx].indexOf('?') != -1) {
         if (this._map.kaMap.tileURL[idx].slice(-1) != '&') {
             q = '&';
         } else {
             q = '';
         }
     } else {
         var src = this._map.kaMap.tileURL[idx] +
         q + 'map=' + this._map.name +
         '&t=' + t +
         '&l=' + l +
         szScale + szForce + szGroup + szImageformat + szTimestamp +
szVersion;
     }
     if (img.src != src) {
         img.style.visibility = 'hidden';
         img.src = src;
     }
    idx++;
    if (idx == this._map.kaMap.tileURL.length) {
      this._map.kaMap.tileIDX = 0;
    } else {
      this._map.kaMap.tileIDX = idx;
    }
}


Of course this method presumes that you have access to the DNS servers
of the company or whoever is hosting your pages.

Hope this is usefull info for someone.

/ IM
_______________________________________________
ka-Map-users mailing list
ka-Map-users at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/ka-map-users



More information about the Users mailing list