Skip to content

vanhoesenj/GDAL-VCGI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 

Repository files navigation

Overview of GDAL Within a GUI

This is a companion site to a VCGI webinar scheduled for December 16, 2014 titled "Afraid of GDAL, There's a GUI For That: Raster Mastering in QGIS." The primary goal of this presentation is to demonstrate a GUI-based means of accessing the powerful tools available in the GDAL library. If you weren't scarred by command line DOS or PC ArcINFO you might be more inclined to access these tools (or at least ones you might use regularly) via command line given that processing time is often reduced. So if you wanted to convert between raster formats, you could simply fire up a command line terminal and enter:

gdal_translate -of "GTiff" ~path/input_grid.jpg ~path/output_grid.tif

However if your response to that syntax is:

Don't worry - that's the point of today's webinar and this brief tutorial about accessing the power of GDAL through a QGIS (although it also accessible via MapWindow and gvSIG). For those of you solely using ESRI products, there is also a GDAL plugin that provides access to many of these tools. However I will reiterate that becoming familiar with the syntax (even if that means just copy and pasting from a saved link) may be more efficient for some tasks.

I frequently refer back to this cheatsheet from Derek Watkins.


Ok, we need to procure some data!

  1. Start by visiting the Shangri-La of GIS clearinghouses to obtain a 30-meter DEM of Vermont (yes, yes I know there is a 10-meter version and LiDAR is available but time is precious and some people are using Comcast...). Enter 30 in the search dialog and download the ElevationDEM_DEM24 layer.
  2. We also need to download a vector layer from VCGI to demonstrate the full power of the GDAL library. You will also want to search for towns and download the BoundaryTown_TWNBNDS layer.
  3. And lastly visit LibreMap and search for Mansfield to get a DRG. This is a wonderful source for DRGs throughout the U.S.
  4. You could also download the bedrock geologic map of Vermont. For no particular reason other than it's gorgeous (and really informative I might add). Enjoy it.


USEFUL GDAL TOOLS (in no particular order)

Note: not all of these utilities have screenshots or command line examples.

1. Translate (gdal_translate)

This is the Leatherman (I mean not all Swiss Army knives are actually multitools right?) of the GDAL library. This tool allows us to change the raster output format (i.e. - JPG, GeoTiff, etc), create a subset of the layer (i.e. - crop <-- seriously, crop not clip...), change the output size (outsize), extract and mask individual bands (-b band, mask band), and variety of other options described in the documentation.

2. Extract Projection (gdalsrsinfo)

Useful for identifying projection within command line but less useful within a GUI-based GIS because you can typically view layer properties to find the same information. However in earlier versions of QGIS this was a useful tool when working with unfamiliar data sources. Note: to use this tool, raster files need to be converted to a *.tiff file.

3. Warp Raster (gdalwarp)

Similar to the Project Raster tool in the ESRI ArcGIS suite, this tool primarily allows users to assign raster layers different spatial reference system (SRS). However there are numerous options described in the documentation. One useful option is the -r resampling_method when up sampling or downsampling data. But this utility allows the user to also pass many other optional variables such as output format and nodata masking values (i.e. -of format and -srcnodata).

4. Assign Projection (-a_srs)

Similar to the Define Projection tool in the ESRI ArcGIS suite, this is another optional parameter that allows gdalwarp and gdal_translate to assign or change the layer SRS. Similar to the Define Projection tool it is important to make sure this tool isn't used in lieu of gdalwarp, meaning it is important to avoid assigning an SRS rather than re-projecting the data (i.e. - just 'telling' the data it is in an SRS that it is not...).

5. DEM Tools (gdal_dem)

This utility provides many of the most commonly used functions available through ESRI's Spatial Analyst extension for creating derivative layers from digital elevation models (i.e. - hillshade, slope, aspect, ruggedness index, etc). An additional useful option is the color-relief syntax, which allows the user to pass a color rule set specifying which colors should be assigned to different elevation ranges. Just to reiterate the point about the processing time between command line via a GUI, this function can be accessed using the following syntax:

gdaldem color-relief input_grid.tif color-rules.txt output-color-relief.tif).

6. Contour (gdal_contour)

Once you have a single elevation layer - either after using gdal_merge or downloading an individual file - you can use this tool to create vector contours. This utility is similar to the Contour tool in the ESRI ArcMap suite.

7. Grid (gdal_grid)

This utility interpolates continuous raster layers from point data using IDW, Nearest and Average algorithms - each of which have their own parameters that can be defined. It is similar to the interpolation tools available in the ArcMap suite. Perhaps the most exciting aspect of this tool is it offers the ability to parallelize processing to expedite your analyses. However I will say I typically use the interpolation tools accessible via GRASS or SAGA through the Processing Toolbox.

8. Merge (gdal_merge.py)

This utility can be used to merge or mosaic multiple raster grids into a single file. This is especially useful for working with ASTER or National Elevation Data (NED) files. This is similar to the Mosaic to New Raster tool available in the ESRI ArcMap suite.

9. Build Pyramids (gdaladdo)

If you create or are working with larger raster files, you may want to create tiles of your data at varying zoom levels. This utility retiles a given raster file into multiple images for faster viewing and redraw time. This is similar to the BuildPyramids tool in the ESRI ArcMap suite.

10. Polygonize (gdal_polygonize.py)

Although the majority of the tools in the GDAl library were developed for raster analysis/processing it is often useful to convert raster layers to polygon features for cartographic representation. This utility is similar to the Raster to Polygon tool available in the ESRI ArcMap suite.

About

Tutorial for using GDAL within QGIS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published