kesterton

Print Service issue on WMTS with multiple tilematrixsets

Discussion created by kesterton on Dec 4, 2015

Hi

 

We have a custom print service hosted on ArcGIS Server 10.3.1 that is being used to print an external (and non-ESRI) WMTS.

 

This has worked fine up until today when a new tilematrixset was added for some of the layers we use, which provides tiles in a different tiling scheme and projection.  Following this addition the print service no longer printed maps correctly, as it was ignoring the tileMatrixSet given in the exportwebmap object, and instead selecting the new tilematrixset from the service.

 

The Web_Map_As_JSON submitted to the server is below (I've removed the service URL);

 

Web_Map_as_JSON:{"mapOptions":{"showAttribution":true,"extent":{"xmin":339612.87000012194,"ymin":731752.6299997785,"xmax":339811.27000012196,"ymax":731909.4299997785,"spatialReference":{"wkid":27700}},
"spatialReference":{"wkid":27700},"scale":755.9055118113259},"operationalLayers":[{"id":"os_background_bng_colour","title":"background_bng_colour","opacity":1,"minScale":3779527.5590566304,"maxScale":755.9055118113259,"url":"http://WMTS_URL/wmts/",
"type":"wmts","layer":"background_bng_colour","style":"default","format":"image/png","tileMatrixSet":"scotland_bng"}]}}}

 

The print service accepts this however it retrieves tiles from the other tileMatrixSet for the layer - disregarding the property in the JSON web map.  I've confirmed this capturing traffic from ArcGIS Server.

 

Altering the capabilities document to re-order the tilematrixsetlinks for the layer and put the desired matrixset first resolves the problem - it seems the print service uses the first tilematrixset specified for the layer when requesting tiles rather than that specified in the web map.  I've attached an example below:

 

    <Layer>
      <ows:Title>OS Background Stack</ows:Title>
      <ows:Abstract></ows:Abstract>
      <ows:WGS84BoundingBox>
        <ows:LowerCorner>-10.4455381418 54.444252928</ows:LowerCorner>
        <ows:UpperCorner>-0.248994254178 61.2560481198</ows:UpperCorner>
      </ows:WGS84BoundingBox>
      <ows:Identifier>os_background_bng_colour</ows:Identifier>
      <Style>
        <ows:Identifier>default</ows:Identifier>
      </Style>
      <Format>image/png</Format>
          <TileMatrixSetLink> <!-- moving the desired tile set to be first causes it to be used by the print service -->
        <TileMatrixSet>scotland_bng</TileMatrixSet>
      </TileMatrixSetLink>
              <TileMatrixSetLink>
        <TileMatrixSet>scotland_gwm</TileMatrixSet>
      </TileMatrixSetLink>
      <ResourceURL format="image/png" resourceType="tile"         template="http://WMTS_URL/wmts/os_background_bng_colour/{style}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png"/>
    </Layer>

Of course this fix will only work if you just need one tile set, and the services are stable enough for you to hand craft a local capabilities document.  Hopefully ESRI can update the print services to correctly use the matrix specified.

 

Andrew

Outcomes