我使用的是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>
&#13;
知道如何解决这个问题吗?
答案 0 :(得分:1)
所以...经过长时间的长期研究后,问题是瓷砖尺寸不相等,边缘而不是256x256有时它是256xsometing-smaller-then-256
将所有瓷砖平铺到256x256之后,效果很好!