![](/img/trans.png)
[英]Way to tell if a map tile image has loaded successfully using OpenLayers
[英]Map not loaded using openlayers 3 on firefox and ie/edge
我正在使用openlayers 3,并且具有平铺的图像(而不是地理地图),它在chrome中效果很好,但在Firefox或ie / edge中效果不佳。 我不断收到以下错误:
IndexSizeError: Index or size is negative or greater than the allowed amount
我认为这可能与投影有关,或者我没有使用lan / lat坐标。
这是一个简单的示例(也可以在jsbin上获得 )
<!DOCTYPE html> <html> <head> <title>XYZ</title> <link rel="stylesheet" href="http://openlayers.org/en/v3.13.0/css/ol.css" type="text/css"> <script src="http://openlayers.org/en/v3.13.0/build/ol.js"></script> </head> <body> <div id="map" class="map" style="width: 500px; height: 500px; border: 1px solid #000;"></div> <script> var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ source: new ol.source.XYZ({ url: 'http://shimz.me/example/leaflet/image/mother_map/TileGroup0/{z}-{x}-{y}.jpg', wrapX: false }) }) ], view: new ol.View({ center: [0,0], zoom: 1 }) }); </script> </body> </html>
任何想法如何解决?
所以...经过长时间的研究,问题是瓦片的大小不相等,在边缘而不是256x256,有时是256xsometting-smaller-then-256
将所有图块平方为256x256后,效果很好!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.