Skip to content

r.vect.stats

Bins vector points into a raster map.

r.vect.stats input=name output=name [column=name] [method=string] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.vect.stats input=name output=name

grass.script.run_command("r.vect.stats", input, output, column=None, method="mean", overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.vect.stats", input="name", output="name")

Parameters

input=name [required]
    Name of input vector map
    Or data source for direct OGR access
output=name [required]
    Name for output raster map
column=name
    Name of attribute column for statistics
method=string
    Statistic to use for raster values
    Allowed values: n, min, max, range, sum, mean, stddev, variance, coeff_var, median, percentile, skewness, trimmean
    Default: mean
    n: Number of points in cell
    min: Minimum value of point values in cell
    max: Maximum value of point values in cell
    range: Range of point values in cell
    sum: Sum of point values in cell
    mean: Mean (average) value of point values in cell
    stddev: Standard deviation of point values in cell
    variance: Variance of point values in cell
    coeff_var: Coefficient of variance of point values in cell
    median: Median value of point values in cell
    percentile: Pth (nth) percentile of point values in cell
    skewness: Skewness of point values in cell
    trimmean: Trimmed mean of point values in cell
--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
output : str, required
    Name for output raster map
    Used as: output, raster, name
column : str, optional
    Name of attribute column for statistics
    Used as: input, dbcolumn, name
method : str, optional
    Statistic to use for raster values
    Allowed values: n, min, max, range, sum, mean, stddev, variance, coeff_var, median, percentile, skewness, trimmean
    n: Number of points in cell
    min: Minimum value of point values in cell
    max: Maximum value of point values in cell
    range: Range of point values in cell
    sum: Sum of point values in cell
    mean: Mean (average) value of point values in cell
    stddev: Standard deviation of point values in cell
    variance: Variance of point values in cell
    coeff_var: Coefficient of variance of point values in cell
    median: Median value of point values in cell
    percentile: Pth (nth) percentile of point values in cell
    skewness: Skewness of point values in cell
    trimmean: Trimmed mean of point values in cell
    Default: mean
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

r.vect.stats bins points from a vector map into a raster map.

Use g.region to set the extent and resolution of the resulting raster.

EXAMPLES

Calculate number of schools in grid of spatial resolution 1km:

g.region res=1000 vector=schools_wake
r.vect.stats input=schools_wake output=schools_count

Calculate sum of atribute column CAPACITYTO:

r.vect.stats input=schools_wake output=schools_capacity_sum column=CAPACITYTO method=sum

image-alt image-alt
Figure: Number of schools (left part) and sum of CAPACITYTO attribute column (right part) in grid of spatial resolution 1km.

SEE ALSO

g.region, v.out.ascii, r.in.xyz, r.in.lidar

AUTHORS

Vaclav Petras, NCSU GeoForAll Lab
Column and method parameters added by Martin Landa, CTU GeoForAll Lab

SOURCE CODE

Available at: r.vect.stats source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819