GRASS logo

NAME

r.extract - Extracts specified categories of an integer input map.

KEYWORDS

raster, extract, extent, category

SYNOPSIS

r.extract
r.extract --help
r.extract [-cs] input=name output=name cats=range [--overwrite] [--help] [--verbose] [--quiet] [--ui]

Flags:

-c
Clip to minimum extent
-s
Output reclassified map instead of true map
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

input=name [required]
Name of input raster map
output=name [required]
Name for output raster map
cats=range [required]
Category values
Example: 1,3,7-9,13

Table of contents

DESCRIPTION

This module extracts selected categories from an integer raster map into a new raster, similarly to v.extract for vectors. The categories and color table are preserved.

The category values can be specified as:

The extent of the new raster can be changed with flag -c to fit the extent of the extracted data. When using flag -s output raster is a reclassified input raster (see r.reclass for details).

NOTES

This implementation supports only integer raster maps (type CELL).

EXAMPLES

The following examples are using the full North Carolina sample dataset. We will extract certain zipcodes. First print zipcodes raster info:
g.region raster=zipcodes -p
r.info zipcodes -rg
...
rows=1350
cols=1500
min=27511
max=27610
...
Now we extract 2 categories and automatically adjust the raster extent to fit the extracted data.
r.extract input=zipcodes output=selected_zipcodes cats=27605,27601 -c
r.info selected_zipcodes -rg
...
rows=404
cols=377
min=27601
max=27605
...

SEE ALSO

r.reclass (used in this implementation)
v.extract (for extracting vector data)

AUTHOR

Anna Petrasova, NCSU GeoForAll Lab

SOURCE CODE

Available at: r.extract source code (history)


Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2021 GRASS Development Team, GRASS GIS 7.8.7dev Reference Manual