0

I've built a web map with Geoserver and Leaflet displaying background tiles from osm and IGN, and some geojson for overlays. I'm using the MapFish print module with Geoserver and Leaflet.print to print my maps. On my map and printed map, all these layers are lined up correctly and I have no problem to print my maps. But the scalebar and numeric scale displayed are wrong. When I'm measuring some distances on my leaflet map, I have the right distance, but not in my printed map.

Here is a bunch of my config.yaml, where scales are the resolutions of my osm and IGN tiles :

dpis: [75, 96, 150, 300]

scales:
    - 1223
    - 2446
    - 4892
    - 9784
    - 19568
    - 39136

And here I've console.log what I'm sending in my create.json :

{"units":"m","srs":"EPSG:3857","layout":"A4 Landscape","dpi":96,"outputFormat":"pdf","outputFilename":"leaflet-map","layers":[{"baseURL":"http://a.tile.osm.org/","opacity":1,"type":"OSM","extension":"png","tileSize":[256,256],"maxExtent":[-20037508.34,-20037508.34,20037508.34,20037508.34],"resolutions":[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,0.5971642833948135,0.29858214169740677,0.14929107084870338,0.07464553542435169,0.037322767712175846],"singleTile":false}],"pages":[{"center":[175236.00917692634,6280596.13623742],"scale":1223,"mapTitle":"","comment":"","mapCopyright":"copyrightText","rotation":0}]}

I've set srs : 'EPSG:3857' as Leaflet maps default projection are in 'EPSG:3857'. I've tried to change it by 'EPSG:900913', I've tried setting other DPI values, scales, ... But I still have the problem.

I've also posted my question on Mapfish Print Users google's group

1 Answer 1

1

I'm answering my question, I've fixed it setting geodetic parameter to true.

pages: [{
        center: center,
        scale: scale,
        dpi: 190,
        geodetic: true,
        rotation: 0
}]

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.