v.to.rast.multi
Create raster maps for multiple numeric attribute columns of a vector map
v.to.rast.multi [-d] input=name [layer=string] [type=string [,string,...]] [cats=range] [where=sql_query] output=prefix key_column=name attribute_columns=names [,names,...] [label_columns=names [,names,...]] [memory=memory in MB] [ndigits=number of digits [,number of digits,...]] [separator=Separator] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
v.to.rast.multi input=name output=prefix key_column=cat attribute_columns=names
grass.script.run_command("v.to.rast.multi", input, layer="1", type="point,line,area", cats=None, where=None, output, key_column="cat", attribute_columns, label_columns=None, memory=300, ndigits=None, separator="pipe", flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("v.to.rast.multi", input="name", output="prefix", key_column="cat", attribute_columns="names")
Parameters
input=name [required]
Name of input vector map
Or data source for direct OGR access
layer=string
Layer number or name
Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
Default: 1
type=string [,string,...]
Input feature type
Allowed values: point, line, boundary, centroid, area
Default: point,line,area
cats=range
Category values
Example: 1,3,7-9,13
where=sql_query
WHERE conditions of SQL statement without 'where' keyword
Example: income < 1000 and population >= 10000
output=prefix [required]
Prefix for output raster maps
key_column=name [required]
Name of the key column (default: cat, data type must be integer)
Default: cat
attribute_columns=names [,names,...] [required]
Names of columns for 'attr' parameter (data type must be numeric)
label_columns=names [,names,...]
Names of columns used as raster category labels
memory=memory in MB
Maximum memory to be used (in MB)
Cache size for raster rows
Default: 300
ndigits=number of digits [,number of digits,...]
Number of significant digits per attribute column
Number of significant digits per attribute column (for columns with floating point data)
separator=Separator
Separator used for parsing attribute table (it should not occur in any selected column)
Default: pipe
-d
Create densified lines (default: thin lines)
All cells touched by the line will be set, not only those on the render path
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
input : str, required
Name of input vector map
Or data source for direct OGR access
Used as: input, vector, name
layer : str, optional
Layer number or name
Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
Used as: input, layer
Default: 1
type : str | list[str], optional
Input feature type
Allowed values: point, line, boundary, centroid, area
Default: point,line,area
cats : str, optional
Category values
Example: 1,3,7-9,13
Used as: input, cats, range
where : str, optional
WHERE conditions of SQL statement without 'where' keyword
Example: income < 1000 and population >= 10000
Used as: input, sql_query, sql_query
output : str, required
Prefix for output raster maps
Used as: output, raster, prefix
key_column : str, required
Name of the key column (default: cat, data type must be integer)
Used as: input, dbcolumn, name
Default: cat
attribute_columns : str | list[str], required
Names of columns for 'attr' parameter (data type must be numeric)
Used as: input, dbcolumn, names
label_columns : str | list[str], optional
Names of columns used as raster category labels
Used as: input, dbcolumn, names
memory : int, optional
Maximum memory to be used (in MB)
Cache size for raster rows
Used as: memory in MB
Default: 300
ndigits : int | list[int] | str, optional
Number of significant digits per attribute column
Number of significant digits per attribute column (for columns with floating point data)
Used as: number of digits
separator : str, optional
Separator used for parsing attribute table (it should not occur in any selected column)
Used as: Separator
Default: pipe
flags : str, optional
Allowed values: d
d
Create densified lines (default: thin lines)
All cells touched by the line will be set, not only those on the render path
overwrite: bool, optional
Allow output files to overwrite existing files
Default: False
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
v.to.rast.multi creates a raster map for each selected numeric column of the attribute table of a vector map. The purpose is to provide a simple and efficient way to rasterize different attributes of vector maps with multiple numeric value columns.
It is a simple wrapper around v.to.rast and most of the options from that module are available. v.to.rast.multi works as follows: First, (only) the key column is rasterized with v.to.rast. Then reclassification rules are generated for all selected attribute columns and the key_column and reclass maps are created with r.reclass.
Because r.relass only handles integer data and rounds data with floating point precision, the number of significant digits to preserve during reclassification can be defined with the ndigits option. Also text labels can be provided in the label_columns option.
If the label_columns or ndigits are given, the number and order of provided values has to correspond to the number and order of the selected attribute_columns.
EXAMPLE
This example is based on the North Carolina sample location (nc_spm_08_grass7) which can be downloaded from the GRASS GIS website.
# Create raster maps for RINGS_OK amd TRACT attribute of the census_wake2000 map
# Note: RINGS_OK is of type integer, so 0 digits need to be preserved
v.to.rast.multi --o --v input=census_wake2000 type=area \
output=vrastmulti attribute_columns="RINGS_OK,TRACT" \
label_columns="ID,TRACTID" memory=3000 ndigits="0,4" separator=","
SEE ALSO
AUTHOR
Stefan Blumentrath, Norwegian Institute for Nature Research (NINA)
SOURCE CODE
Available at: v.to.rast.multi source code
(history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819