Smoother loading of tiles in OpenLayer

一世执手 提交于 2020-02-23 05:56:29

问题


I would like to improve the loading experience of my maps displayed with OpenLayer. At the moment, the loading of new tiles is not very smooth, especially when loading tiles in an empty area of the map. I would like to animate the apparition of the new tile, for example by playing with the opacity of the new image to display. I have the feeling that this is what leaflet is doing.

The problem is that I did not find a way to listen when a tile is ready to be displayed and even less how to animate it afterward.

What is the best way to tackle this issue? Maybe I am heading in the wrong direction.


回答1:


You will use loadTilesWhileAnimating and loadTilesWhileInteracting on ol.Map like:

  var map = new ol.Map({
    target: 'map',
    layers: [
      new ol.layer.Tile({
        source: new ol.source.OSM()
      })
    ],
    // Improve user experience by loading tiles while animating. Will make
    // animations stutter on mobile or slow devices.
    loadTilesWhileAnimating: true,
    loadTilesWhileInteracting: true,
    view: view
  });


来源:https://stackoverflow.com/questions/43054868/smoother-loading-of-tiles-in-openlayer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!