[英]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.