[gdal-dev] create GeospatialPDF using Python

Even Rouault even.rouault at spatialys.com
Fri Apr 17 06:12:59 PDT 2015


Le vendredi 17 avril 2015 14:44:19, Luca Delucchi a écrit :
> On 17 April 2015 at 13:27, Even Rouault <even.rouault at spatialys.com> wrote:
> > 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.
> 
> sorry, http://geodati.fmach.it/gfoss_geodata/prova.pdf
> 
> >> 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.
> 
> Yes the PDF reader can open the file, my GDAL version should be build
> against libpoppler and libpodofo
> 
> Poppler support:           yes
> Podofo support:            yes

I can open it. See below. If you tried different ./configure options between 
builds, make sure to make clean before rebuilding, otherwise files might not 
get recompiled

$ gdalinfo prova.pdf  -checksum
Driver: PDF/Geospatial PDF
Files: prova.pdf
Size is 1024, 981
Coordinate System is:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_84",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]]
Origin = (11.107265291898358,46.028723077038812)
Pixel Size = (0.000015600143859,-0.000015609058582)
Metadata:
  DPI=72
  NEATLINE=POLYGON ((11.107265291898358 46.028723077038812,11.107265291898358 
46.013410590570132,11.123239839210113 46.013410590570132,11.123239839210113 
46.028723077038812,11.107265291898358 46.028723077038812))
Corner Coordinates:
Upper Left  (  11.1072653,  46.0287231) ( 11d 6'26.16"E, 46d 1'43.40"N)
Lower Left  (  11.1072653,  46.0134106) ( 11d 6'26.16"E, 46d 0'48.28"N)
Upper Right (  11.1232398,  46.0287231) ( 11d 7'23.66"E, 46d 1'43.40"N)
Lower Right (  11.1232398,  46.0134106) ( 11d 7'23.66"E, 46d 0'48.28"N)
Center      (  11.1152526,  46.0210668) ( 11d 6'54.91"E, 46d 1'15.84"N)
Band 1 Block=1024x1 Type=Byte, ColorInterp=Red
  Checksum=39379
Band 2 Block=1024x1 Type=Byte, ColorInterp=Green
  Checksum=19235
Band 3 Block=1024x1 Type=Byte, ColorInterp=Blue
  Checksum=9847


> 
> > The style is attached to each feature.
> 
> ok
> 
> >> 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.
> 
> ok
> 
> > 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.pd
> > f
> 
> yes, but I hoped to find another way without use VRT
> 
> Thanks for the support
> 
> > Even

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


More information about the gdal-dev mailing list