[ka-Map-users] Re: Speeding up tile display/download

Steve Walker walker at mfgis.com
Thu Feb 22 15:30:43 EST 2007


Hi,

Thank you Ionut for the great tip!

Can anybody help by filling in some details?

Specifically, I am not sure where tileURL should be set and what its
contents should look like.

Also, is it correct that the modifications be made to kaMap.js ?  Do other
files need modification as well?

Thanks,

-Steve



> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 17 Feb 2007 21:00:46 +0200
> From: Ionut Muntean <ionut at muntean.ro>
> Subject: [ka-Map-users] Speeding up tile display/download
> To: ka-map-users at lists.maptools.org
> Message-ID: <45D750DE.9030709 at muntean.ro>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> 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
>
>
> ------------------------------

-- 
Steve Walker
Middle Fork Geographic Information Services
walker at mfgis.com
360-671-2505



More information about the ka-Map-users mailing list