What I would like to achieve is an A4 print out of an OSM map with a polygon outline printed on top.

This would come from a web application. Where a user can centre the map, upload a polygon. Which I can do already using Leaflet.js and Mapbox.

I have no idea where to start on this, but I need to take the tiles from the current "view" which would be easy enough, but then I need to scale them, draw the polygon ontop, and then print to a PDF which gets emailed back.

Does anyone have any suggestions on how to achieve this in an automated way?

  • GDAL seems to have most components for the task. Read the PDF manual page gdal.org/frmt_pdf.html and the linked tutorial. Could be tricky to make a web application through that route, though.
    – user30184
    Sep 19, 2014 at 10:10
  • 1
    As a starting point, I'd say take a look at the various tools listed on this page: wiki.openstreetmap.org/wiki/OSM_on_Paper A few of them generate PDFs (Some vector, which is more advanced but better for print quality) You could poke around in the source code of existing apps and contact the developers.
    – Harry Wood
    Sep 19, 2014 at 10:44

1 Answer 1


One approach is to do this on the Client by copying the generated WMS Layers from Open Layers to a HTML5 Canvas.

I have not actually done it yet, but the resultant image could be saved, printed, etc using the standard browser controls.

I know you mention Leaflet, but it may be worth a look ..

A good article on this can be seen Here!

Your Answer

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

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