[OpenLayers-Users] changing tile load functionality

Christopher Schmidt crschmidt at metacarta.com
Fri Jan 4 22:49:39 EST 2008


On Fri, Jan 04, 2008 at 10:33:49PM -0500, Adam Eskreis wrote:
> I am currently using OpenLayers 2.5 with kamap1.0 as my backend, trying to
> speed this thing up a little bit.  I know getting rid of kamap and replacing
> it with something else would probably help a lot, but im trying to optimize
> openlayers before i dive into that.  Right now, the main problem i can see
> that openlayers is having and is giving the appearance of poor speed, is
> that it is loading tiles off the screen before loading tiles on the screen.
> I would like to change this functionality.  I'm not afraid to get my hands
> dirty with code, so if anyone has any suggestions about a way to change
> this, i'm open to suggestions.

1. {buffer: 0}  in your layer options. This will decrease the tiles
   loaded outside the map by a huge amount. If tile loading is slow, do
   this first.
2. Multi-Host URLs: http://a.myserver.example.com,
  http://b.myserver.example.com/ . This way, the browser will load more
  tiles at once.  Optimial number of hosts is probably 3. See
  multiserver.html in examples.

> One thing i was considering, ive been looking at the code, and it appears
> that it loads the tiles from left to right.  One thing ive considered is
> loading htem in a spiral fashion, starting with the center of the map.  This
> would give the appearnce of speed, by loading the tiles on the screen first,
> then continuing to load off-screen tiles in the backgroudn to prepare for
> panning.  It seems the place to make this change is in initGriddedTiles(),
> but im not 100% sure and i dont wanna f*** things up too bad without getting
> some advice/opinions from the openlayers experts.

Your'e on the right track, but I don't think you read the last line of
initGriddedTiles:

    this.spiralTileLoad();

Essentially, the grid is created left-to-right -- but the tiles are
'empty' tiles until they're loaded by spiralTileLoad.  

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list