1

I am using MapFish Print 3.

I'm trying to add a WMTS layer to a map using EPSG:2193 from the service described at https://data.linz.govt.nz/layer/50767-nz-topo50-maps/webservices/

I'm trying to use EPSG:2193 rather than EPSG:3857 so I can display a working scale bar.

I've tried various variations on the baseUrl with requestEncoding as both KVP and REST but always get a report generated with a blank map without and no errors reported.

The WMTS capabilities of the layer - https://data.linz.govt.nz/services;key=60c2f93ec4dc45448ff7d93df524eb75/wmts/1.0.0/layer/50767/WMTSCapabilities.xml

An example of a single tile request from the service - https://tiles-a.data-cdn.linz.govt.nz/services;key=60c2f93ec4dc45448ff7d93df524eb75/tiles/v4/layer=50767,style=auto/EPSG:2193/0/1/1.png

A KVP example request tried:

{
    "layout": "A4 landscape",
    "outputFormat": "pdf",
    "geodetic": true,
    "outputFilename": "test-kvp",
    "attributes": {
        "map": {
            "projection": "EPSG:2193",
            "dpi": 300,
            "rotation": 0,
            "areaOfInterest": {
                "display": "NONE",
                "area": {
                    "type": "MultiPoint",
                    "coordinates": [
                        [
                            1257372,
                            5023405
                        ],
                        [
                            1262142,
                            5027333
                        ]
                    ]
                }
            },
            "layers": [
                {
                    "type": "WMTS",
                    "baseURL": "https://data.linz.govt.nz/services;key=60c2f93ec4dc45448ff7d93df524eb75/wmts/?",
                    "opacity": 1,
                    "layer": "layer-50767",
                    "style": "auto",
                    "version": "1.0.0",
                    "requestEncoding": "KVP",
                    "dimensions": null,
                    "dimensionParams": {},
                    "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
                            ]
                        }
                    ],
                    "imageFormat": "image/png"
                }
            ]
        }
    }
}

A REST example request tried:

{
    "layout": "A4 landscape",
    "outputFormat": "pdf",
    "geodetic": true,
    "outputFilename": "test-rest",
    "attributes": {
        "map": {
            "projection": "EPSG:2193",
            "dpi": 300,
            "rotation": 0,
            "areaOfInterest": {
                "display": "NONE",
                "area": {
                    "type": "MultiPoint",
                    "coordinates": [
                        [
                            1257372,
                            5023405
                        ],
                        [
                            1262142,
                            5027333
                        ]
                    ]
                }
            },
            "layers": [
                {
                    "type": "WMTS",
                    "baseURL": "https://tiles-a.data-cdn.linz.govt.nz/services;key=60c2f93ec4dc45448ff7d93df524eb75/tiles/v4/layer=50767,style=auto/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png",
                    "opacity": 1,
                    "layer": "layer-50767",
                    "version": "1.0.0",
                    "requestEncoding": "REST",
                    "dimensions": null,
                    "dimensionParams": {},
                    "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
                            ]
                        }
                    ],
                    "imageFormat": "image/png"
                }
            ]
        }
    }
}

And the following is my config.yaml:

templates:
  #===========================================================================
  A4 landscape: !template
  #===========================================================================
    reportTemplate: A4-landscape.jrxml
    attributes:
      map: !map
        maxDpi: 300
        width: 802
        height: 520
      overlayLayers: !staticLayers
        default:
          layers:
            - type: "grid"
              numberOfLines: [10, 10]
              labelColor: rgba(0,0,0,0)
              haloColor: rgba(0,0,0,0)
      scalebar: !scalebar
        width: 230
        height: 35
      northArrow: !northArrow
        size: 35
        default:
          graphic: 'north.svg'
    processors:
    - !addBackgroundLayers
      inputMapper:
          overlayLayers: staticLayers
          map: map
    - !reportBuilder # compile all reports in current directory
      directory: '.'
    - !createMap {}
    - !createScalebar {}
    - !createNorthArrow {}

Any ideas what I may be doing wrong consuming the WMTS layer for my map?

I've also opened an issue against the GitHub repo that includes all configuration files etc. - https://github.com/mapfish/mapfish-print/issues/1948

1 Answer 1

1

It seems that the matrices topLeftCorner x and y values needed reversing in my JSON requests.

So instead of:

"topLeftCorner": [ 10000000.0, -1000000.0 ]

using the following worked:

"topLeftCorner": [ -1000000.0, 10000000.0 ]

I'm not sure if this is an issue with MapFish Print 3 or the capabilities reported by the LINZ service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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