Working with Rasters in GDAL

last updated: September 04, 2024

Overview

Clip a Raster to an Area of Interest

Digital Elevation Model (DEM) Unit Conversion

The first step is to determine the conversion betweet feet and meters -- a quick and easy internet search reminds us that 1 foot equals .3048 meters. Great! Now we have what we need to convert our DEM's values from one unit of measurement to the other. To run the conversion, do:

gdal_translate -scale 0 0.3048 0 1 input.tif output.tif

This seems a bit magical, so let's break it down:

gdal_translate
The specific GDAL command we're calling
-scale
Indicates we want to rescale the input pixel values to generate a new output
0 0.3048 0 1
The order of numbers here indicate: source_min, source_max, destination_min, destination_max. In other words,

For more information on this, and other gdal_translate commands, also check out this docs page.

Vector Mask Creation

- mask areas where elevation greater than x
- mask areas where veg index greater than y

Generate a Vegetation Index


Rate this guide: