r.to.vect(1)

πŸ’– r.to.vect β€” bestie edition πŸ’–

okay so this is the GRASS GIS User's Manual page for r.to.vect(1), and honestly? it's a whole glow-up moment for your raster data. let's get into it ✨


✨ NAME ✨

r.to.vect β€” converts a raster map into a vector map. it's giving transformation. πŸ’…


🏷️ KEYWORDS 🏷️

raster, conversion, geometry, vectorization


πŸ¦‹ SYNOPSIS πŸ¦‹

r.to.vect
r.to.vect --help
r.to.vect [-svzbt] input=name output=name type=string  [column=name]
[--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags πŸŽ€

  • -s β€” smooths the corners of area features. no more blocky queen, we're contouring πŸ’–
  • -v β€” use the raster values as categories instead of a unique sequence (CELL only, bestie, don't forget)
  • -z β€” write raster values as the z coordinate. no table gets created for this one. currently only supported for points.
  • -b β€” do NOT build vector topology. this one's recommended for massive point conversion 🫢
  • -t β€” do NOT create the attribute table. it's giving minimalist
  • --overwrite β€” lets output files overwrite existing files (chaotic but valid)
  • --help β€” prints the usage summary. your little helper 🧚
  • --verbose β€” verbose module output, for when you wanna know everything
  • --quiet β€” quiet module output, for when you literally cannot
  • --ui β€” forces launching the GUI dialog

🌸 Parameters 🌸

  • input=name [required] β€” name of the input raster map
  • output=name [required] β€” name for the output vector map
  • type=string [required] β€” the output feature type. options are: point, line, area
  • column=name β€” name of the attribute column to store the value. the name must be SQL compliant. default is value

πŸ’œ DESCRIPTION πŸ’œ

r.to.vect scans the named input raster map layer, extracts points, lines or area edge features from it, and converts that data into GRASS vector format. that's the whole plot. πŸ‘‘

πŸ“ Point conversion

the r.to.vect program pulls data out of a GRASS raster map layer and stores the output in a brand new GRASS vector file.

🌈 Line conversion

r.to.vect assumes that the input map has already been thinned using r.thin. (respect the pipeline, bestie.)

r.to.vect extracts vectors (aka, "arcs") from a raster map. these arcs may represent linear features (like roads or streams), or they 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. (it's the cleanup era we all deserve ✨)

πŸ’… Area conversion

r.to.vect first traces the perimeter of each unique area in the raster map layer and creates vector data to represent it. the cell category values for the raster map layer will be used to create attribute information for the resultant vector area edge data.

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 smooths 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. 🚨


πŸ”₯ EXAMPLES πŸ”₯

the examples are based on the North Carolina sample dataset:

conversion of raster points to vector points:

random sampling of points:

g.region raster=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 type=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 raster=elevation -p
r.watershed elev=elevation stream=elev.streams thresh=50000
r.to.vect -s input=elev.streams output=elev_streams type=line
# drop "label" column which is superfluous in this example
v.db.dropcolumn map=elev_streams column=label
v.db.renamecolumn map=elev_streams column=value,basin_id
# report length per basin ID
v.report map=elev_streams option=length units=meters sort=asc

conversion of raster polygons to vector polygons:

vectorization of simplified landuse class map:

g.region raster=landclass96 -p
# we smooth corners of area features
r.to.vect -s input=landclass96 output=my_landclass96 type=area
v.colors my_landclass96 color=random

πŸ’€ KNOWN ISSUES πŸ’€

for type=line the input raster map MUST be thinned by r.thin; if not, r.to.vect may crash. no cap, do the thinning first. 😭


🫢 SEE ALSO 🫢

g.region, r.thin, v.clean


πŸ‘‘ AUTHORS πŸ‘‘

Point support

Bill Brown

Line support

Mike Baba DBA Systems, Inc. 10560 Arrowhead Drive Fairfax, Virginia 22030

Area support

Original version of r.poly:

Jean Ezell and Andrew Heekin, U.S. Army Construction Engineering Research Laboratory

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


🌟 SOURCE CODE 🌟

Available at: r.to.vect source code (history)

Accessed: Saturday Jan 17 05:41:04 2026

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index


Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual

and that's the whole page, bestie πŸ’– this was r.to.vect(1) from GRASS 8.4.2 β€” go vectorize something iconic, mwah πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from