Sunset at the Dollhouse. Maze District, Canyonlands National Park. Photo courtesy National Park Service.

A Gentle Introduction to GDAL, Part 1

Robert Simmon
Apr 4, 2017 · 9 min read
USGS 1:250000-scale Quadrangle for La Sal, UT 1885. Via the National Geologic Map Database.
On the top of the country immediately at the junction of the Grand and Green Rivers, westside. Utah. Photograph taken by the second Powell expedition, September 17, 1871. Photo courtesy USGS.
Comparison of the USGS 1:250,000-scale topographic maps of the confluence of the Green and Colorado Rivers drawn in 1885 (1923 printing, left) and 1959 (right). From the USGS National Geological Map Database.
Aerial photograph of the Canyonlands taken by the USGS in 1953. The Green River merges with the Colorado River in the center of the frame. Photograph from the USGS Earth Explorer.
Locals and Tourists, Boston. Blue pictures are by locals. Red pictures are by tourists. Yellow pictures might be by either. ©2010 Eric Fisher, CC BY-SA 2.0.

Why GDAL?

Installing GDAL

OSX

echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profilesource ~/.bash_profile

Windows

Linux

conda install -c conda-forge gdal=2.1.3

First Steps Using GDAL

gdalinfo --version
GDAL 2.1.2, released 2016/10/24
Shaded relief map of the Canyonlands. Courtesy National Park Service Harpers Ferry Center.

gdalinfo

gdalinfo CANYrelief1-geo.tif -mm
Driver: GTiff/GeoTIFF
Files: CANYrelief1-geo.tifSize is 2800, 2800
Coordinate System is:PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]Origin = (-12249462.599999999627471,4629559.794860946945846)Pixel Size = (13.284000000000001,-13.285397060378999)
Metadata:AREA_OR_POINT=AreaTIFFTAG_DATETIME=2017:04:01 20:24:57TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)TIFFTAG_SOFTWARE=Adobe Photoshop CC (Macintosh)TIFFTAG_XRESOLUTION=72TIFFTAG_YRESOLUTION=72Image Structure Metadata:COMPRESSION=LZWINTERLEAVE=PIXEL
Corner Coordinates:Upper Left  (-12249462.600, 4629559.795) (110d 2'19.66"W, 38d21'14.51"N)
Lower Left (-12249462.600, 4592360.683) (110d 2'19.66"W, 38d 5'29.42"N)
Upper Right (-12212267.400, 4629559.795) (109d42'16.79"W, 38d21'14.51"N)
Lower Right (-12212267.400, 4592360.683) (109d42'16.79"W, 38d 5'29.42"N)
Center (-12230865.000, 4610960.239) (109d52'18.23"W, 38d13'22.39"N)
Band 1 Block=2800x31 Type=Byte, ColorInterp=RedComputed Min/Max=149.000,255.000Band 2 Block=2800x31 Type=Byte, ColorInterp=GreenComputed Min/Max=133.000,255.000Band 3 Block=2800x31 Type=Byte, ColorInterp=BlueComputed Min/Max=100.000,255.000

gdal_translate

gdal_translate -of JPEG -co QUALITY=70 -co PROGRESSIVE=ON -outsize 1400 0 -r bilinear CANYrelief1-geo.tif CANYrelief1.jpg
-of JPEG -co QUALITY=70 -co PROGRESSIVE=ON
-outsize 1400 0 -r bilinear
CANYrelief1-geo.tif CANYrelief1.jpg

Further Reading

Planet Stories

Using space imagery to tell stories about our changing planet.

Robert Simmon

Written by

Data Visualization, Planet Labs. Ex-NASA. Blue Marble, Earth at Night, color.

Planet Stories

Using space imagery to tell stories about our changing planet.