Dorset-Council-UK / GIFramework-Maps

A .NET based web map built with OpenLayers and Bootstrap
MIT License
14 stars 8 forks source link

Added optional scale line to prints #316

Open VulpesFerrilata opened 2 weeks ago

VulpesFerrilata commented 2 weeks ago

This PR adds an optional scale line or bar when exporting to a PDF for printing.

There is a new checkbox in the Export and Print panel. When ticked a scale line or bar (depending on which one the user has active) will be added to the export.

A scale line/bar will be added to the bottom-right of the PDF export, above the attributions. The position and scale will adapt depending on the size (A4, A3 etc), orientation and the print resolution (150 dpi, 200 dpi etc). image

Observation: the scale bar changes in size when you swap between different dpis - appearing bigger at lower dpis and smaller at higher dpis. I think this is to do with how OpenLayers defines the size of a pixel, and the same scaling issue happens with measurements and annotations.

On staging for full testing.

Closes #292

RobQuincey-DC commented 2 weeks ago

Found an issue with the old school scale bar image It seems to be clipping. I'm guessing this is something to do with html2canvas, but I haven't looked closer yet