Ross Beyer, my co-worker at NASA, performed a Google Tech Talk early this month. It is now available online and you can watch it above. I don’t want to give any spoilers, but a certain stereo something is mentioned in this talk.
Despite first appearances, GDAL is way more than an image I/O library. I routinely use it resize images, transcode images, and reproject images. But did you know that it can also draw contour lines, write kml, and orthorectify RPC images? Even if you did, I think it’s good to document here because I keep forgetting.
Render Contour Lines
Publishing DEM’s created by ASP is a tricky because it is easiest visualize height change through a color gradient. That loses its usefulness when publishing to a conference where they print in gray scale. A snazzier option would be a hill-shaded render of a DEM with contour lines plotted on top. You can see an example on right and the commands below:
gdaldem hillshade <DEM> output.tif -z 0.000012 gdal_contour -i 50 <DEM> contour gdal_rasterize -burn 0 -l contour contour output.tif
The “-z” value on gdaldem hillshade requires some playing around to figure out what is best for your image. The “-i” value on gdal_contour is the interval between lines in units of height defined by the DEM (for ASP products, it’s meters).
KML Outline of a Cube File’s footprint
footprintinit from=<ISIS Cube File> isis2gml from=<ISIS Cube File> to=output.gml label=footprint ogr2ogr -f KML output.kml output.gml
Orthorectify an RPC image on a DEM
This one doesn’t apply to planetary imagery, but most Earth images tend to have an RPC camera model attached to them. Download a DEM from USGS’s NED, and then with GDAL you can drape your source imagery over the DEM.
gdalwarp -of GTiff -co TILED=yes -co COMPRESS=lzw -r cubicspline \ -rpc -to RPC_DEM=<your DEM> <RPC image> output.tif -dstnodata 0