简体   繁体   English

增加OpenLayers中磁贴的超时时间

[英]Increase timeout for tiles in OpenLayers

I have an OpenLayers XYZ-layer. 我有一个OpenLayers XYZ层。 When loading the layer some of the tiles does not show up. 加载图层时,某些图块不会显示。 However if I reload the tile it shows up (aka there is nothing wrong with the tile). 但是,如果我重新加载它显示的瓷砖(也就是瓷砖没有任何问题)。 Seems to me OpenLayers has some kind of timeout mechanism, and won't render the tile if it takes too long. 在我看来,OpenLayers有一些超时机制,如果花费的时间太长,将不会渲染瓷砖。

Does anybody know how to increase the timeout ? 有人知道如何增加超时吗?

I think that is not possible to do that. 我认为这样做是不可能的。 I had the same problem few months ago, and the best solution I found was to set OpenLayers.IMAGE_RELOAD_ATTEMPTS constant. 几个月前我遇到了同样的问题,我找到的最佳解决方案是将OpenLayers.IMAGE_RELOAD_ATTEMPTS设置为常量。

OpenLayers.IMAGE_RELOAD_ATTEMPTS is a variable to specify how many times do you want to try to reload tiles when its reach timeout. OpenLayers.IMAGE_RELOAD_ATTEMPTS是一个变量,用于指定在达到超时时要尝试重新加载切片的次数。

You just need to include this sentence at top of your own code and playing with its value to set the best for you: 您只需要在自己的代码顶部包含这个句子并使用其值来为您设置最佳:

OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;

I hope it helps. 我希望它有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM