0

I'm trying to add a scalebar to my Mapfish Print pdf output but it's always rendering too small.

I have seen a few solutions that suggest using the "geodetic": true setting in my requests, but this makes no difference to the results.

Here's a section of the pdf output demonstrating the issue:

enter image description here

The blue grid marked 75 - 76 is 1 km in size, yet you can see that the scalebar rendered suggests this would be in excess of 1 km if used as the source of truth.

Any ideas how I may be able to get the scalebar to render correctly?

Here's an example request I'm sending to Mapfish Print:

{
    "layout": "A4 landscape",
    "outputFormat": "pdf",
    "geodetic": true,
    "attributes": {
        "map": {
            "projection": "EPSG:3857",
            "dpi": 300,
            "rotation": 0,
            "areaOfInterest": {
                "display": "NONE",
                "area": {
                    "type": "MultiPoint",
                    "coordinates": [
                        [
                            19092823.11,
                            -5325062.01
                        ],
                        [
                            19087166.77,
                            -5329055.85
                        ]
                    ]
                }
            },
            "layers": [
                {
                    "baseURL": "http://tiles-a.data-cdn.linz.govt.nz/services;key=SECRET/tiles/v4/layer=50767/EPSG:3857/{z}/{x}/{y}.png",
                    "type": "OSM"
                }
            ]
        }
    }
}

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 {}

1 Answer 1

0

It looks like there's an open bug regarding this issue:

https://github.com/mapfish/mapfish-print/issues/327

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.