|
NAMEr.category - Manages category values and labels associated with user-specified raster map layers.KEYWORDSraster, categorySYNOPSISr.categoryr.category --help r.category map=name [cats=range[,range,...]] [values=float[,float,...]] [separator=character] [raster=name] [rules=name] [format=string] [coefficients=mult1,offset1,mult2,offset2] [--help] [--verbose] [--quiet] [--ui] Flags:
Parameters:
DESCRIPTIONr.category prints the category values and labels for the raster map layer specified by map=name to standard output. You can also use it to set category labels for a raster map.The user can specify all needed parameters on the command line, and run the program non-interactively. If the user does not specify any categories (e.g., using the optional cats=range[,range,...] argument), then all the category values and labels for the named raster map layer that occur in the map are printed. The entire map is read using r.describe, to determine which categories occur in the map. If a listing of categories is specified, then the labels for those categories only are printed. The cats may be specified as single category values, or as ranges of values. The user may also (optionally) specify that a field separator other than a space or tab be used to separate the category value from its corresponding category label in the output, by using the separator=character|space|tab option (see example below). If no field separator is specified by the user, a tab is used to separate these fields in the output, by default. The output is sent to standard output in the form of one category per line, with the category value first on the line, then an ASCII TAB character (or whatever single character or space is specified using the separator parameter), then the label for the category. NOTESAny ASCII TAB characters which may be in the label are replaced by spaces.The output from r.category can be redirected into a file, or piped into another program. Input from a fileThe rules option allows the user to assign category labels from values found in a file (without header). The label can refer to a single category, range of categories, floating point value, or a range of floating point values. The format is given as follows (when separator is set to colon; no white space must be used after the separator):cat:Label val1:val2:LabelIf the filename is given as "-", the category labels are read from stdin Default and dynamic category labelsDefault and dynamic category labels can be created for categories that are not explicitly labeled. The coefficient line can be followed by explicit category labels which override the format label generation.0:no data 2: . 5: . ## explicit category labels 7: .explicit labels can be also of the form: 5.5:5:9 label description or 15:30 label description In the format line
Also, the form $?xxx$yyy$ translates into yyy if the category is 1, xxx otherwise. The $yyy$ is optional. Thus $1 meter$?s will become:
format=’Elevation: $1.2 to $2.2 feet’ ## Format
Statement
The format and coefficients above would be used to generate the following statement in creation of the format appropriate category string for category "num": sprintf(buff,"Elevation: %.2f to %.2f feet", num*5.0+1000, num*5.0*1005) Note: while both the format and coefficient lines must be present a blank line for the format string will effectively suppress automatic label generation. To use a "$" in the label without triggering the plural test, put "$$" in the format string. Use ’single quotes’ when using a "$" on the command line to avoid unwanted shell substitution. EXAMPLESNorth Carolina sample dataset:Printing categoriesr.category map=landclass96 1 developed 2 agriculture 3 herbaceous 4 shrubland 5 forest 6 water 7 sedimentprints the values and labels associated with all of the categories in the landclass96 raster map layer. r.category map=landclass96 cats=2,5-7 2 agriculture 5 forest 6 water 7 sedimentprints only the category values and labels for landclass96 map layer categories 2 and 5 through 7. r.category map=landclass96 cats=3,4 separator=comma 3,herbaceous 4,shrublandprints the values and labels for landclass96 map layer categories 3 and 4, but uses "," (instead of a tab) as the character separating the category values from the category values in the output. Adding categoriesExample for defining new category labels, using a colon as separator:r.category diseasemap separator=":" rules=- << EOF 1:potential absence 2:potential presence EOFThis sets the categoy values 1 and 2 to respective text labels. Alternatively, the rules can be stored in an ASCII text file and loaded via the rules parameter. SEE ALSOUNIX Manual entries for awk and sortd.what.rast, r.coin, r.describe, r.support AUTHORSMichael Shapiro, U.S. Army Construction Engineering Research LaboratoryHamish Bowman, University of Otago, New Zealand (label creation options) SOURCE CODEAvailable at: r.category source code (history)Main index | Raster index | Topics index | Keywords index | Graphical index | Full index © 2003-2021 GRASS Development Team, GRASS GIS 7.8.6 Reference Manual
Visit the GSP FreeBSD Man Page Interface. |