mapsgismapfish

Printing Image Layer with MapFish Print


I try to print a Image Layer with MapFish Print 3. I've tried several different print requests absolute image paths, relative ones and urls, but never succeeded. The print finishes successfully without an image showing up.

My request looks like this:

{
    "outputFormat": "pdf",
    "layout": "A4 landscape",
    "outputFilename": "file",
    "attributes": {
        "map": {
            "dpi": "300",
            "rotation": 0,
            "bbox": [
                1617602.8915079264,
                5888215.094869674,
                1622199.0367374036,
                5890693.644391326
            ],
            "projection": "EPSG:3857",
            "layers": [
                {
                    "baseURL": "http://mapsNEU.wien.gv.at/basemap/bmapoverlay/normal/google3857/{TileMatrix}/{TileRow}/{TileCol}.png",
                    "imageFormat": "image/png",
                    "layer": "bmapoverlay",
                    "type": "WMTS",
                    "version": "1.0.0",
                    "requestEncoding": "REST",
                    "matrixSet": "google3857",
                    "matrices": [ ... ]
                },
                {
                    "type": "image",
                    "baseURL": "https://github.com/geotools/geotools/raw/main/geotools-logo.png",
                    "extent": [
                        1617602.8915079264,
                        5888215.094869674,
                        1622199.0367374036,
                        5890693.644391326
                    ],
                    "name": "test",
                    "opacity": 1,
                    "imageFormat": "image/png"
                }
            ]
        }
    }
}

and my config.yaml looks

templates:
# default
  A4 landscape: !template
    reportTemplate: default/A4LandscapeReport.jrxml
    attributes:
      abteilung: !string {}
      title: !string {}
      user: !string {}
      zweck: !string {}
      myScale: !string {}
      kunde: !string {}
      img: !string {}
      map: !map
        maxDpi: 400
        width: 814
        height: 439
      scalebar: !scalebar
        width: 200
        height: 40
        default:
          align: "left"
          intervals: 3
          type: "bar"
          unit: "m"
      northArrowDef: !northArrow
        size: 30
        default:
          graphic: "file://NorthArrow_10.svg"
    processors:
    - !reportBuilder
      directory: 'default/.'
    - !createMap
      inputMapper: {map: map}
      outputMapper: {mapSubReport: mapSubReport, mapContext: mapContext}
    - !createScalebar {}
    - !createNorthArrow
        inputMapper: {map: map, northArrowDef: northArrow}

The Result: map without any sign of the image


Solution

  • After fiddling around I realised that the order of the layers was messed up see this Bug. The Solution was to change the order up till the wished result was achieved - sadly there was no regularity to be found it feels very random, luckily the order it prints is the same every time.