未在 firefox 和 ie/edge 上使用 openlayers 3 加载地图
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 有时是 256xsometing-smaller-then-256
将所有图块平方为 256x256 后效果很好!
我使用的是 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 有时是 256xsometing-smaller-then-256
将所有图块平方为 256x256 后效果很好!