logocar3
logocar3

Reputation: 31

Preload tiles before animation

I am currently doing some animation (smooth zooming & panning) in OpenLayers using ol.animation, but sometimes those animations are too fast to show smooth zooming (tiles do not load fast enough) - which is expected behaviour. But animation on my page starts only after viewer reads whole post (~1min), so I thought I could preload tiles that are needed for the animation in this time of inactivity.

Is there possibility to preload tiles of a layers/map? I was thinking some solutions:

Upvotes: 3

Views: 3223

Answers (1)

ahocevar
ahocevar

Reputation: 5648

It's much easier than you think - tile layers have an preload option. So if you want to preload e.g. down to zoom level 3, you could construct your layer with

new ol.layer.Tile({
  ...
  preload: 3
});

Also see http://openlayers.org/en/v3.4.0/apidoc/ol.layer.Tile.html.

Upvotes: 2

Related Questions