I'm going to host a customized xyz tiled layer so I tested on my local machine to add that layer to OpenLayers Map control. I've already rendered some tiles using generate_tiles.py and Mapnik. I've already confirmed that there's no problem accessing local files by starting my Chrome in --allow-file-access-from-files mode and adding local KML layer. However, not only did the debugger stop the page with the following unhandled exception message, but the map control wouldn't load as well.
Stack trace:
dh (ol.js:112)ad (ol.js:43)l.dispatchEvent (ol.js:41)l.Qn (ol.js:452)l.Pf (ol.js:125)paused on exception: 'TypeError: cannot use 'in' operator to search for '10' in undefined'Related js code:
var projection = ol.proj.get('EPSG:3857');var raster = new ol.layer.Tile({ source: new ol.source.OSM()});var map = new ol.Map({ controls: ol.control.defaults({ attributionOptions{ collapsible: false }) }), layers: [raster], target: document.getElementById('map'), view: new ol.View({ center: ol.proj.fromLonLat([116.5, 40]), zoom: 10 })});var xyz = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: ["Local test."], url: './{z}/{x}/{y}.png' })});map.addLayer(xyz);
أكثر...
Stack trace:
dh (ol.js:112)ad (ol.js:43)l.dispatchEvent (ol.js:41)l.Qn (ol.js:452)l.Pf (ol.js:125)paused on exception: 'TypeError: cannot use 'in' operator to search for '10' in undefined'Related js code:
var projection = ol.proj.get('EPSG:3857');var raster = new ol.layer.Tile({ source: new ol.source.OSM()});var map = new ol.Map({ controls: ol.control.defaults({ attributionOptions{ collapsible: false }) }), layers: [raster], target: document.getElementById('map'), view: new ol.View({ center: ol.proj.fromLonLat([116.5, 40]), zoom: 10 })});var xyz = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: ["Local test."], url: './{z}/{x}/{y}.png' })});map.addLayer(xyz);
أكثر...