We all know that vector pdf maps are best for print quality and file size, so when we were upgrading our map printing systems we wanted to ensure that we output all our maps as vector PDFs.
Geoserver is well able to output mapping as SVG, but we needed to incorporate that within a template that includes all the traditional map ‘furniture’ and text needed to make a complete map.
As always, keen to use an open-source solution we adopted TCPDF as the engine to create the final PDF but quickly encountered a few issues:
- There seemed to be a size limit on the svg output made by geoserver. This was fine for creating outputs for A4 size papers but caused geoserver to crash when working with sizes up to A0.
- For this project we were specifically using ordnance survey mastermap data and the geoserver style sheets that have been kindly produced and provided by the Ordnance Survey. On review of the final pdf we noticed issues with the styling i.e. building outlines being dashed instead of solid, the image output from directly from geoserver was however fine. This caused some serious head scratching…
Fortunately the open nature of TCPDF and Geoserver allowed us to dig under the hood and identify the size limit issue being limited to the xml parse on the latest build of the Linux operating system. We were therefore able to code around this issue. The styling issue was slightly more complex as there was a number of bugs and compatibility issues between the styling available within Geoserver and TCPDF. The most fundamental of which was to ensure that TCPDF utilised the default style from the base element and the value was changed if a new style was available.
We made the changes to Geoserver and submitted back to the developers for consideration. You can check out our changes here:
We would be interested to hear if others have had similar issues and if our fix is useful to the wider mapping community.