1

I've installed GDAL2.3dev on my mac using Homebrew, expecting it to support GeoPDFs already. But when I run gdalinfo on a pdf file from USGS, I still get this error:

ERROR 4: `WA_Sunrise_244132_1971_24000_geo.pdf' not recognized as a supported file format.

What do I need to do add PDF support to GDAL?

5
  • you need the libraries Poppler,PoDoFo PDFium gdal.org/frmt_pdf.html
    – Mapperz
    Oct 24, 2017 at 20:58
  • On Windows an interpreter like GhostScript ghostscript.com is required to rasterize the pdf into an image.. I'm not sure about Macs. There is instructions static1.squarespace.com/static/56f6ee5f8a65e2431330aac8/t/… that might illuminate. First check your formats with gdalinfo --formats and see if your build supports PDF. Oct 24, 2017 at 20:59
  • You can't add support afterwards but GDAL must be compiled with some of the abovementioned libraries. Check with "gdalinfo --formats" if your build is really made without PDF driver.
    – user30184
    Oct 25, 2017 at 5:34
  • @Mapperz I have Poppler installed but I don't know how to build a package from scratch, which is why I've been using Homebrew. I can see that others have had the same problem and were able to fix it by ./configure the Poppler path before ./make the build but I don't know how to incorporate that into Homebrew builds.
    – Zen Liu
    Oct 27, 2017 at 7:07
  • homebrew poppler install macappstore.org/poppler
    – Mapperz
    Oct 27, 2017 at 16:46

1 Answer 1

0

It seems that osgeo4mac has shifted to a new strategy for PDF support. You now need to install gdal2-pdf:

$ brew install gdal2-pdf

and then, as brew tells you to, link to the plugins:

$ export GDAL_DRIVER_PATH=/usr/local/lib/gdalplugins

Peter

4
  • Thanks Peter - I tried that but I'm still getting the same problem. Perhaps I need to uninstall the previous gdal installation?
    – Zen Liu
    Oct 26, 2017 at 5:54
  • I still get the same error even when I explicitly invoke the new instance of gdalinfo that came with this new install: /usr/local/Cellar/gdal2/2.2.2_1/bin/gdalinfo WA_Sunrise_244132_1971_24000_geo.pdf
    – Zen Liu
    Oct 27, 2017 at 7:09
  • This worked after I uninstalled all my gdal installations and just ran brew install gdal2-pdf, hooray!
    – Zen Liu
    Oct 30, 2017 at 21:26
  • @ZenLiu glad to hear it! You can use brew link to choose which gdal you call when in the shell. Not sure if you tried that first.
    – PeterT
    Oct 30, 2017 at 23:19

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.