4

I'm attempting to convert a USGS US Topo GeoPDF in Windows. I'm using GDAL 1.11.1. My initial attempts were with this Python script, which automates the process by feeding a command to the Windows Command Prompt. After some initial problems (I couldn't get past line 10), I decided to try directly with the Command Prompt. I used this USGS resource as a guide, which offers step-by-step instructions for using GDAL in the Command Prompt. To simplify the process, I have been following the guide literally and using the same Santa Fe topo map. When I enter the following command:

gdalinfo NM_Santa_Fe_20131108_TM_geo.pdf –mdd LAYERS

I get this error:

gdalinfo failed - unable to open 'NM_Santa_Fe_20131108_TM_geo.pdf'

I found a few different resources that said that this error could originate from the GeoPDF file format not being compiled into the build, and suggested the following command:

gdalinfo --formats

When I run this, the GeoPDF format is indeed listed:

PDF (rw): Geospatial PDF

GDAL functions properly if I read in other formats (PNG, TIF). Does anyone have experience with this issue?

  • Gdalinofo works for me with GDAL 2.0.0-dev from gisinternals.com/sdk. – user30184 Nov 6 '14 at 23:09
  • Are you sure that the PDF does not contain vector layers? These might not be read by GDAL. – AndreJ Nov 7 '14 at 8:15
  • ogrinfo shows that this PDF contains 12 vector layers. I have not tried to convert them to other formats but at least both gdalinfo and ogrinfo work for me but not for @hfisch. The error message is not very selective. For example wrong filename/path or missing driver are both giving the same error. – user30184 Nov 7 '14 at 10:07
2

After finding the geopdf files, I get the same error message with GDAL 1.11.0 that was shipped with QGIS Chugiak, although gdalinfo --formats lists the pdf driver as rw.

But it works with GDAL 1.11.1 shipped with QGIS Brighton, current OSGeo4W and the binaries from gisinternals.

See also How to add Georeferenced PDF as layer to QGIS 2.0? for some bug tickets that may have been solved lately, especially http://hub.qgis.org/issues/8912 for handling of USGS Topo pdfs.

By the way, you can now use ogr2ogr -f sqlite out.sqlite in.pdf to store the vector layers from the pdf into a sqlite database and display that in QGIS:

enter image description here

This looks far better in detail than the rasterized output of gdalwarp (and saves lot of disk space too).

  • This is interesting. GDAL 1.11.1 in QGIS Brighton works for me as well. I downloaded my GDAL as an exe from here: lfd.uci.edu/~gohlke/pythonlibs. Obviously something is not working right there. – hfisch Nov 7 '14 at 15:03
  • This is interesting. GDAL 1.11.1 in QGIS Brighton works for me as well. I downloaded my GDAL as an exe from here: lfd.uci.edu/~gohlke/pythonlibs. Obviously something is not working right there. – hfisch Nov 7 '14 at 15:03
  • I have no experience with those sources, so I don't know what is missing there. PDF requires extra libraries for read support. – AndreJ Nov 7 '14 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.