0

Using the EPSG:2193 projection from WMTS capabilities for a layer: https://data.linz.govt.nz/services;key=60c2f93ec4dc45448ff7d93df524eb75/wmts/1.0.0/layer/50767/WMTSCapabilities.xml
I'm trying to produce a JSON layer definition for use in MapFish Print requests.

I can get other WMTS layers to work, but this one is eluding me. I'm wondering if the XML provided by the service is actually correct as it states that each TileMatrix has a:

<TopLeftCorner>10000000.0 -1000000.0</TopLeftCorner>

But the bounding box provided would suggest a different TopLeftCorner?

<ows:BoundingBox crs="urn:ogc:def:crs:EPSG::2193">
  <ows:LowerCorner>3087000.000000 274000.000000</ows:LowerCorner>
  <ows:UpperCorner>7173000.000000 3327000.000000</ows:UpperCorner>
</ows:BoundingBox>

I've tried updating TopLeftCorner based on these values, but I'm still not seeing any tiles come through on my maps.

I can pull the WMTS layer into QGIS without issue. Perhaps there's a way I can export the JSON I need from QGIS itself? Looking at the Layer Properties, QGIS also reports a 10000000.0 -1000000.0 top left though.

QGIS screenshot

The layer JSON I've manually created from the XML capabilities, which doesn't work, is as follows. Can anyone see anything I might be getting wrong?

{
    "layout": "A4 portrait",
    "outputFormat": "pdf",
    "geodetic": true,
    "outputFilename": "test-WMTS",
    "attributes": {
        "map": {
            "projection": "EPSG:2193",
            "dpi": 300,
            "rotation": 0,
            "center": [
                1334616, 5064670
            ],
            "scale": 200000,
            "layers": [
                {
                    "type": "WMTS",
                    "baseURL": "https://tiles-a.data-cdn.linz.govt.nz/services;key=60c2f93ec4dc45448ff7d93df524eb75/tiles/v4/layer=50767/EPSG:2193/{TileMatrix}/{TileCol}/{TileRow}.png",
                    "opacity": 1,
                    "layer": "50767",
                    "matrixSet": "EPSG:2193",
                    "matrices": [
                        {
                            "identifier": "0",
                            "matrixSize": [
                                2,
                                4
                            ],
                            "scaleDenominator": 32000000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "1",
                            "matrixSize": [
                                4,
                                7
                            ],
                            "scaleDenominator": 16000000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "2",
                            "matrixSize": [
                                8,
                                13
                            ],
                            "scaleDenominator": 8000000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "3",
                            "matrixSize": [
                                16,
                                25
                            ],
                            "scaleDenominator": 4000000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "4",
                            "matrixSize": [
                                31,
                                49
                            ],
                            "scaleDenominator": 2000000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "5",
                            "matrixSize": [
                                61,
                                97
                            ],
                            "scaleDenominator": 1000000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "6",
                            "matrixSize": [
                                121,
                                193
                            ],
                            "scaleDenominator": 500000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "7",
                            "matrixSize": [
                                242,
                                386
                            ],
                            "scaleDenominator": 250000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "8",
                            "matrixSize": [
                                604,
                                965
                            ],
                            "scaleDenominator": 100000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "9",
                            "matrixSize": [
                                1208,
                                1929
                            ],
                            "scaleDenominator": 50000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "10",
                            "matrixSize": [
                                3858,
                                2415
                            ],
                            "scaleDenominator": 25000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "11",
                            "matrixSize": [
                                6037,
                                9645
                            ],
                            "scaleDenominator": 10000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "12",
                            "matrixSize": [
                                12074,
                                19289
                            ],
                            "scaleDenominator": 5000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "13",
                            "matrixSize": [
                                24147,
                                38578
                            ],
                            "scaleDenominator": 2500,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "14",
                            "matrixSize": [
                                60366,
                                96443
                            ],
                            "scaleDenominator": 1000,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "15",
                            "matrixSize": [
                                120732,
                                192886
                            ],
                            "scaleDenominator": 500,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        },
                        {
                            "identifier": "16",
                            "matrixSize": [
                                241463,
                                385771
                            ],
                            "scaleDenominator": 250,
                            "tileSize": [
                                256,
                                256
                            ],
                            "topLeftCorner": [
                                10000000.0, -1000000.0
                            ]
                        }
                    ]
                }
            ]
        }
    }
}
0

1 Answer 1

0

From what you stated it could be a serverside limitation (check for smaller areas) or a rendering limitation (e.g. set all values higher/smaller in tileSize compared to matrixSze)

1
  • Thanks for the ideas. I don't think it's a server side limitation as I can consume the EPSG:3857 projection from the same layer using OSM tile convention and render full maps. I can also construct urls to obtain single tiles so can confirm the tile size is correct. I suspect I'm missing a subtle issue when creating the JSON layer definition as QGIS has no issues consuming the layer in that projection.
    – Gavin
    Commented Jul 23, 2021 at 11:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.