本文介绍了禁用用于图块层的临时图块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建这样的地图时:

var map = new ol.Map({
   loadTilesWhileAnimating: true,
   loadTilesWhileInteracting: true
})

OpenLayers 3在缩放和平移时使用临时图块(即以前加载的较​​低分辨率的图块),直到完成新图块的加载为止.临时图块放置在真实图块的后面.这非常聪明,并且对于不透明的图层非常有用,但是对于大多数透明的图层来说却不是那么好.

OpenLayers 3 uses interim tiles (i.e., previously loaded lower resolution tiles) when zooming and panning until it has finished loading the new tiles. The interim tiles are placed behind the real tiles. Which is very clever, and is great for opaque layers, but much not so great for mostly transparent layers.

我们目前有一个仅由几行组成的图层,只有少数像素认为.稍微平移地图会使它们变成巨大的斑点,从而导致大量闪烁.

We currently have a layer which consists of just a few lines, only a few pixels think. Slightly panning the map makes these into huge blobs, causes a lot of flicker.

有没有一种方法可以仅针对特定图层来禁用这些临时图块的创建?如果仅由于单个层而需要禁用两个loadTilesWhile *属性,将令人失望.

Is there a way to disable creating of these interim tiles, just for a specific layer? It would be disappointing if I'd need to disable both loadTilesWhile* properties just because of a single layer.

例如,请参见: http://imgur.com/RbtmkpT 左边是正常的(红线是我的),右边是轻微摇摄后的

For an example, see: http://imgur.com/RbtmkpT The left is normal (the red line is mine), right is after panning slightly.

这是源上的cacheSize 0,并且useInterimTilesOnError为false.

This is with cacheSize 0 on the source and useInterimTilesOnError false.

更新:OpenLayers 3.12的行为有所不同.在该版本中,只有未卸载的图块是模糊的(这是可以预料的),而已经加载的图块则保持不变.从3.13或3.14开始,此行为已更改.

Update:OpenLayers 3.12 behaves differently. In that version, only unloaded tiles are blurry (which is to be expected), but already loaded tiles are left alone. Starting from 3.13 or 3.14, this behavior changed.

推荐答案

请参阅我在OpenLayers GitHub存储库中的拉取请求,以获取解决方案/解决方法: https://github.com/openlayers/ol3/issues/5251#issuecomment-212322292

See my pull request in the OpenLayers GitHub repository for a solution / workaround:https://github.com/openlayers/ol3/issues/5251#issuecomment-212322292

这篇关于禁用用于图块层的临时图块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 13:10