[gdal-dev] GeoPDF

Frank Broniewski frank.broniewski at gmail.com
Thu Jun 16 04:27:22 PDT 2016


Ok, finally l found some time to investigate into making GeoPDF files 
from QGIS map composer PDFs. I've created a small python script to aid 
me in the creation of the GeoPDF 
(https://github.com/frankbroniewski/GeoPDF). It basically takes 
parameters from QGIS (map position in the page, map extent) and writes 
them to the PDF. There are 2 screenshots in the git which show the 
current data values for my test.pdf test subject. The map-composer.png 
shows the map in the QGIS map composer with the important values for 
georeferencing at the right side. layer-in-qgis.png shows the 
(unfortunately misaligned) GeoPDF in the QGIS main window.
My gdal_edit call is as follows:

gdal_edit.bat -mo "NEATLINE=POLYGON((30 30, 30 170, 220 170, 220 30, 30 
30))" -a_srs "EPSG:31466" -a_ullr 2549800.000 5491000.000 2555800.000 
5486600.000 test.pdf

 From reading the docs (the OGC ones) I thought creating a neatline and 
adding coordinates to it would be more or less sufficient. Looking at 
layer-in-qgis.png shows that gdal_edit did not (as what I expected at 
first) write the coordinates to the neatline but to the whole page area.

Is there a way to add the coordinates to the neatline instead of the 
whole PDF page? I could calculate the page's extent and use these 
values, but maybe there's a more clever approach?

I've also noticed that Adobe Acrobat Reader does not display any 
coordinates when using the measurement tool. Any ideas why this is not 
working?

The python script (polygon.py - the name's somewhat stupid) is atm only 
used to assemble the gdal_edit call while taking the map extent and map 
frame aka neatline position along with an epsg code. I'm on windows 
(osgeo4w64) and using subprocess.call on gdal_edit causes an error with 
the -a_ullr switch. Probably some parsing errors or whatnot. Anyway, 
copy&paste is as good for the moment.

So, any comments on how to proceed with the neatline are greatly 
appreciated.  I will continue to do my own research and report back on 
any successful steps achieved.

Frank


Am 18.05.2016 um 16:50 schrieb Frank Broniewski:
> Hi,
>
> I want to turn my QGIS map composer PDF into a GeoPDF or a geospatial 
> PDF. Unfortunately that is not supported, just on a per layer basis 
> from within the main program. I could export my map to TIFF with a 
> world file and use GDAL on that, but I'd like to maintain the vectors 
> and text in the output.
> Since GDAL supports the creation of GeoPDF, I'd like to ask if there 
> is some kind of documentation on the web where the standard is 
> described of if someone knows an OpenSource library which supports the 
> creation of GeoPDF.
> I thought of writing a, preferable in Python, program which would add 
> the necessary tags and data to the PDF in order to turn it into a 
> GeoPDF. But I am already stuck at the beginning, because I simply 
> cannot find a good standard documentation. What does GDAL do to turn a 
> raster file into a GeoPDF? I guess I could read the source, but I have 
> no clue on the C-language so I thought I ask here beforehand.
>
> Thanks,
>
> Frank 


More information about the gdal-dev mailing list