2

I rendered a PDF with mapnik and I am now trying to add geospatial header information to the PDF.

I tried the method add_geospatial_pdf_header() from mapnik.printing.PDFPrinter. I do get some Geo PDF information in my PDF but when I check it with gdalinfo or with qgis, I get some invalid angles in my corner coordinates (and the ones that are not marked as invalid don't look correct either).

What I do in my code is something like that (where my pdf extent is calculated based on my layer envelope):

m = mapnik.Map(100, 100)
m.zoom_to_box(mapnik.Box2d(my_mapnik_pdf_extent))
page = mapnik.printing.PDFPrinter()
page.render_map(m,"my_output_file.pdf")
page.finish()
page.add_geospatial_pdf_header(m, "my_output_file.pdf", epsg=2193)

Any idea on what I might be doing wrong or any experience with add_geospatial_pdf_header to share? (I checked my projection multiple times and that side seems ok)

Source code from mapnik: https://github.com/mapnik/mapnik/blob/2.3.x/bindings/python/mapnik/printing.py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.