Saturday, June 28, 2014

GDAL to convert GeoPDF to GeoTIFF - the Windows version

I needed to convert GeoPDF files to GeoTIFF.  I'm not command-line savvy.  So I was hesitant to try this.  When the gdal_translate command failed no matter what I tried, I nearly gave up.  (I can just screen-shot the PDFs.  Right!)  

But I kept digging.  I found that not all GDAL installs support PDF.  I had to get a specific set of GDAL binaries for Windows.  Here's how and why:

I'm doing volunteer/non-profit work to publish map services that show georeferenced map layers for historic maps of  Caroline County, Maryland.  I'm using MapTiler, Tileserver, QGIS, and ArcGIS Online for low-cost production and publishing.  Recent products are:

1875 and 1897 county and towns via AGOL and
- 1897 county in OpenLayers.

Next task is to publish similar services and maps from the USGS Topo GeoPDFs.  I need to convert the GeoPDFs to GeoTIFF in order to publish the tiles as a service.  (Esri has done this already.  But only for paying customers.)

I found a tutorial for using GDAL's gdaltranslate utility.  After installing GDAL and cursing my way through the godawful Windows command line window, I kept getting GDAL errors.  GDAL wasn't recognizing the PDF format.

Why not?  I was following the tutorial steps exactly.  I checked forums and found that GDAL has PDF support in some releases but not in others -- it was working for Ubuntu installs, but not for all Windows installs.   The tutorial used the Ubuntu installer.  I had used the OSGeo4W installer for GDAL.  That one does not include PDF support.  Gotta love opensource.

I found a pointer to GDAL binaries I needed at  I downloaded the zipfile with the files that are right for my Windows system.  Simply unzipped the file in a folder.  Then ran the SDKShell.bat file.  No need to install anything.  That worked for me.  Gotta love opensource.