[GIS] Printing OpenStreetMap tiles to PDF

openstreetmappdf

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?

Best Answer

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!

Related Question