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:68 We @ ol.js:68 Ze @ 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/arcgis/rest/services/USGSImageryOnly/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?

  • 1
    Switching to ol-debug.js shows the error is actually projection related. I added in proj4js definition of the EPSG:2965 projection and now the error is "Assertion failed: extent tile range must not exceed tilegrid width and height". Googling shows people discussing this as a possible bug in OL. – Chris Hartley Dec 28 '15 at 19:14
  • 1
    Suggest updating the question with the additional detail, rather than having it hidden in the comments. Its easier to see what the current situation is, rather than original problem plus changes. – BradHards Dec 28 '15 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.