GDAL reference

From Wildsong
Revision as of 20:22, 19 January 2011 by Brian Wilson (talk | contribs) (New page: == Clip == === Geometric === If you want to clip a rectangle out of a larger raster, for example to remove the collar from a scanned map, you can use gdal_translate but only if the input...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Clip

Geometric

If you want to clip a rectangle out of a larger raster, for example to remove the collar from a scanned map, you can use gdal_translate but only if the input raster is not in a spherical projection. (For example, if it's in WGS84 (EPSG 4326) this will work.)

If the data is not projected you can use a gdal_translate command with either projwin or srcwin specifying a window on the command line.

If it is projected it will fail.

Using a mask

Data management

Data conversion

Use gdal_translate

Projections =

To reproject data, use gdalwarp

Mosaic

The gdal_merge command creates a single raster output from several inputs. It does this the old-fashioned way by copying pixels.

Build raster catalog

(Or, "what is a VRT")

In GDAL world this is called a VRT = Virtual Dataset (which in my mind would abbreviate to "VD" but no one asked me.)

To build one you can use gdalbuildvrt

I think it creates a small file referencing the members of the dataset, which can then be processed by GDAL commands that accept only one input file.

Surfaces

Contour

To build a vector contour layer from an elevation dataset, use gdal_contour

Raster surfaces

To generate raster surfaces from an elevation dataset, use gdaldem

The list of surfaces you can generate includes

  • hillshade
  • color relief
  • shaded relief
  • slope
  • aspect
  • terrain ruggedness index
  • topographic position index
  • roughness