v.centroids
Adds missing centroids to closed boundaries.
v.centroids input=name output=name [option=string] [layer=string] [cat=integer] [step=integer] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
v.centroids input=name output=name
grass.script.run_command("v.centroids", input, output, option="add", layer="1", cat=1, step=1, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("v.centroids", 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 vector map
option=string
Action to be taken
Allowed values: add
Default: add
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
cat=integer
Category number starting value
Default: 1
step=integer
Category increment
Default: 1
--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 vector map
Used as: output, vector, name
option : str, optional
Action to be taken
Allowed values: add
Default: add
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
cat : int, optional
Category number starting value
Used as: input, cats
Default: 1
step : int, optional
Category increment
Default: 1
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
In GRASS GIS, a centroid is a point within a closed ring of boundaries. A vector area is defined as composite entity consisting of a set of closed boundaries and a centroid. The attribute information associated with this area is linked to the centroid. The v.centroids module adds centroids to closed boundaries in the input file and assigns a category number to them. The starting value as well as the increment size may be set using optional parameters.
Multiple attributes may be linked to a single vector entity through numbered fields referred to as layers. Refer to v.category for more details, as v.centroids is simply a frontend to that module.
The boundary itself is often stored without any category reference as it can mark the border between two adjacent areas. Thus it would be ambiguous as to which feature the attribute would belong. In some cases it may, for example, represent a road between two parcels of land. In this case it is entirely appropriate for the boundary to contain category information.
EXAMPLES
Create an area from a closed line using North Carolina sample dataset:
v.type input=busroute11 output=busroute11_boundary from_type=line to_type=boundary
v.centroids input=busroute11_boundary output=busroute11_area
Figure: Creating area from closed line
SEE ALSO
AUTHORS
module: M. Hamish Bowman, Dept. Marine Science, Otago University, New
Zealand
help page: Trevor Wiens
SOURCE CODE
Available at: v.centroids source code
(history)
Latest change: Wednesday Feb 12 23:02:46 2025 in commit 9c11460