[gdal-dev] create GeospatialPDF using Python

Even Rouault even.rouault at spatialys.com
Fri Apr 17 04:27:02 PDT 2015


Le vendredi 17 avril 2015 13:11:15, Luca Delucchi a écrit :
> On 13 April 2015 at 13:25, Luca Delucchi <lucadeluge at gmail.com> wrote:
> > Hi all,
> 
> Hi devs,
> some updates
> 
> > For vector it seems quite simple, just writing a new vector and insert
> > all features but I'm not able to create it, my code [0] is not
> > returning any error but I cannot find the output file
> 
> Now I'm able but I'm still not able to read it with GDAL, my example
> is here [2],

The link doesn't work. 

> maybe some Creation Options is missing?
> Also If I'm using gdal_translate after that I'm not able to read with
> gdalinfo
> 
> gdal_translate -of PDF ../STEM/data/OFD/060140_ravina_OFD.tif my.pdf
> gdalinfo my.pdf
> 
> ERROR 4: `my.pdf' not recognised as a supported file format.

Can the file be opened in a PDF reader ? If so, check that your GDAL is built 
against libpoppler or libpodofo. That's required for the reading side.

> 
> gdalinfo failed - unable to open 'my.pdf'.
> 
> > How the "Creation Options" should be passed to CreateCopy?
> 
> Maybe I found it
> 
> dst_ds = driver.CreateCopy( dst_filename, src_ds, 0,
>                                 [ 'TILED=YES', 'COMPRESS=PACKBITS' ] )
> 

Yes, except PACKBITS isn't supported for the PDF driver.

> I was looking to GeospatialPDF format and it seems there is no
> Creation Options to pass the style of vector file.
> Is also this an enhancement to do?

The style is attached to each feature.

> 
> What is the suggested way to create GeospatialPDF with raster and
> styled vector together?

gdal_translate (or CreateCopy) with the OGR_DATASOURCE creation option that 
points to a vector file.

Did you have a look at Jukka's excellent tutorial ? (the link is at the bottom 
of http://gdal.org/frmt_pdf.html): 
http://latuviitta.org/documents/Geospatial_PDF_maps_from_OSM_with_GDAL.pdf

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list