I'm trying to use tiles from an ArcGIS WMTS server with Openlayers 3 but I'm running in to a frustrating problem - optionsFromCapabilities() gives the following unhelpful error:Uncaught (in promise) TypeError: Cannot read property 'a' of null(…)Ie @ ol.js:68We @ ol.js:68Ze @ ol.js:68(anonymous function) @ ol.js:855(anonymous function) @ (index):18`
To keep things simple I'm just using the Openlayers WMTS Layer from Capabilities example - http://openlayers.org/en/v3.12.1/examples/wmts-layer-from-capabilities.html only changing the XML document to the layer I'd like to use.
I've verified that the XML document is being retrieved and Openlayers can parse it with WMTSCapabilities.read(). The layer and matrixSet are correctly defined. I tried using another ArcGIS server of the same version (10.22) (http://basemap.nationalmap.gov/arcg...nly/MapServer/WMTS/1.0.0/WMTSCapabilities.xml) and that worked properly. I've thought that the problem might be projection based but it seems to be failing well before the point that projections enter in to things.
Here is my javascript code:
var parser = new ol.format.WMTSCapabilities();var map;fetch('http://imaps.indy.gov/arcgis/rest/services/2015Photography_Labels/MapServer/WMTS/1.0.0/WMTSCapabilities.xml').then(function(response) {return response.text();}).then(function(text) {var result = parser.read(text);var options = ol.source.WMTS.optionsFromCapabilities(result, {layer: '2015Photography_Labels', matrixSet: 'default028mm'});map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM(), opacity: 0.7 }), new ol.layer.Tile({ opacity: 1, source: new ol.source.WMTS(options) }) ], target: 'map', view: new ol.View({ center: [19412406.33, -5050500.21], zoom: 5 })});});Any thoughts?
أكثر...
To keep things simple I'm just using the Openlayers WMTS Layer from Capabilities example - http://openlayers.org/en/v3.12.1/examples/wmts-layer-from-capabilities.html only changing the XML document to the layer I'd like to use.
I've verified that the XML document is being retrieved and Openlayers can parse it with WMTSCapabilities.read(). The layer and matrixSet are correctly defined. I tried using another ArcGIS server of the same version (10.22) (http://basemap.nationalmap.gov/arcg...nly/MapServer/WMTS/1.0.0/WMTSCapabilities.xml) and that worked properly. I've thought that the problem might be projection based but it seems to be failing well before the point that projections enter in to things.
Here is my javascript code:
var parser = new ol.format.WMTSCapabilities();var map;fetch('http://imaps.indy.gov/arcgis/rest/services/2015Photography_Labels/MapServer/WMTS/1.0.0/WMTSCapabilities.xml').then(function(response) {return response.text();}).then(function(text) {var result = parser.read(text);var options = ol.source.WMTS.optionsFromCapabilities(result, {layer: '2015Photography_Labels', matrixSet: 'default028mm'});map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM(), opacity: 0.7 }), new ol.layer.Tile({ opacity: 1, source: new ol.source.WMTS(options) }) ], target: 'map', view: new ol.View({ center: [19412406.33, -5050500.21], zoom: 5 })});});Any thoughts?
أكثر...