I am a GIS newbie and I am trying to get WMTS layers to work with OpenLayers 2.

I do the standard procedure:

  1. Issue a GetCapabilities request.
  2. Parse the response using OpenLayers.Format.WMTSCapabilities().read( )
  3. Turn the response object into a layer using OpenLayers.Format.WMTSCapabilities().createLayer( ) using the matrix tile set and layer.

This all boilerplate OpenLayers code -- I didn't do much myself. Everything works as expected for EPSG:4326, and some ArcGIS services I tried. In fact, for the same service and layer - the EPSG:4326 tile set shows up but the EPSG:900913 tile set does not.

In fact, looking at the network response (in developer tools) when fetching the EPSG:900913 tile matrix set, I know I am getting the image tiles but they are not showing up onthe map. The map is black for some reason.

I thought it was maybe because the projection is in EPSG:4326 when my tiles are in EPSG:900913. After setting the base layer as the WMTS layer, I do:

  var projection = map.getProjection(); // Shows up correctly as EPSG:900913

It might useful to note that I had to override the below functions with the latest code code from the OpenLayers 2 github repo:


Maybe I missed a function I had to override? That's my best theory so far!

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.