Note: This document is for an older version of GRASS GIS that is outdated. You should upgrade, and read the current manual page.
r.to.vect extracts vectors (aka, "arcs") from a raster map. These arcs may represent linear features (like roads or streams), or may represent area edge features (like political boundaries, or soil mapping units).
r.thin and r.to.vect may create excessive nodes at every junction, and may create small spurs or "dangling lines" during the thinning and vectorization process. These excessive nodes and spurs may be removed using v.clean.
A true vector tracing of the area edges might appear blocky, since the vectors outline the edges of raster data that are stored in rectangular cells. To produce a better-looking vector map, r.to.vect smoothes the corners of the vector data as they are being extracted. At each change in direction (i.e., each corner), the two midpoints of the corner cell (half the cell's height and width) are taken, and the line segment connecting them is used to outline this corner in the resultant vector map. (The cell's cornermost node is ignored.) Because vectors are smoothed by this program, the resulting vector map will not be "true" to the raster map from which it was created. The user should check the resolution of the geographic region (and the original data) to estimate the possible error introduced by smoothing.
r.to.vect extracts only area edges from the named raster input file. If the raster map contains other data (i.e., line edges, or point data) the output may be wrong.
Conversion of raster points to vector points:
Random sampling of points:
g.region rast=elevation -p # random sampling of points (note that r.random also writes vector points) r.random elevation raster_output=elevrand1000 n=1000 r.to.vect input=elevrand1000 output=elevrand1000 feature=point # univariate statistics of sample points v.univar elevrand1000 column=value type=point # compare to univariate statistics on original full raster map r.univar elevation
Conversion of raster lines to vector lines:
Vectorization of streams in watershed basins map:
g.region rast=elevation -p r.watershed elev=elevation stream=elev.streams thresh=50000 r.to.vect -s input=elev.streams output=elev_streams feature=line # drop "label" column which is superfluous in this example v.db.dropcol map=elev_streams column=label v.db.renamecol map=elev_streams column=value,basin_id # report length per basin ID v.report map=elev_streams option=length units=meters
Conversion of raster polygons to vector polygons:
Vectorization of simplified landuse class map:
g.region rast=landclass96 -p # we smooth corners of area features r.to.vect -s input=landclass96 output=my_landclass96 feature=area v.colors my_landclass96 color=random # show colorized vector map d.mon x0 d.vect my_landclass96 -a
Modified program for smoothed lines:
David Satnik,
Central Washington University
Updated 2001 by Andrea Aime, Modena, Italy
Update
Original r.to.sites, r.line and r.poly merged and updated to 5.7 by Radim Blazek
Last changed: $Date: 2014-01-03 10:40:28 -0800 (Fri, 03 Jan 2014) $
Main index - raster index - Full index
© 2003-2014 GRASS Development Team