Note: This document is for an older version of GRASS GIS that has been discontinued. You should upgrade, and read the current manual page.
For each column in the csv file (except the first one) new raster map will be created, replacing the raster values corresponding to the first column with those in the second (3rd, 4th, etc) column.
Users can define custom names for the output map(s). If only one output name is provided and the CSV file contains more than two columns, the module will automatically generate output names by appending the column names to the provided base name.
r.category map=landuse@PERMANENT
Based on the categories of the landuse layer, create a CSV file reclass.csv. This table assigns a friction value and a suitability value to each attribute.
cat <<EOL > reclass.csv rasterID,friction,suitability 1,0.9,0 2,0.7,0.2 3,0.6,0.4 4,0.2,0.5 5,0.1,0.9 6,1,0 7,0.8,0 EOL
Use the r.recode.attr addon to generate two new raster layers, one for friction and another for suitability. Specify a base name for the output maps. Ensure that the separator matches the delimiter used in your CSV file.
r.recode.attr input=landuse output=map rules=reclass.csv separator=comma
Note that the names of the two maps are constructed based on the provided base name 'map' + name of the name of the column. Create for both layers created above a color table.
r.colors map=map_friction color=oranges r.colors map=map_suitability color=greens
The original land use map and the derived friction and suitability maps are shown in the figure below.
Available at: r.recode.attr source code (history)
Latest change: Tuesday Nov 26 15:14:26 2024 in commit: 0429182d06771f96c18f16e0b5e712848e7314c3
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2024 GRASS Development Team, GRASS GIS 8.3.3dev Reference Manual