v.edit(1grass)
β¨ v.edit β¨
okay bestie, so this is v.edit from the GRASS User's Manual and it is literally the main character of vector editing. π
buckle up.
π NAME π
v.edit β edits a vector map, and lets you add, delete and modify selected vector features. that's it, that's the plot. π¦
π KEYWORDS π
vector, geometry, editing, line, node, point, vertex, level1 β the whole squad is tagged in. β
π SYNOPSIS π
v.edit
v.edit --help
v.edit [-rcnb1p] map=name [layer=string] [type=string[,string,...]]
tool=string [input=name] [move=x,y,z] [threshold=float[,float,...]]
[ids=range] [cats=range] [coords=x,y[,x,y,...]] [bbox=x1,y1,x2,y2]
[polygon=x,y[,x,y,...]] [where=sql_query] [query=string]
[bgmap=name[,name,...]] [snap=string] [zbulk=value,step]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
πΈ Flags πΈ
-rβ Reverse selection. flip it, reverse it π«-cβ Close added boundaries (using threshold distance)-nβ Do not expect header of input data-bβ Do not build topology. genuinely advantageous when you're handling a large number of points π₯-1β Modify only first found feature in bounding box-pβ Connect parallel lines (using extend tools and threshold distance)--overwriteβ Allow output files to overwrite existing files--helpβ Print usage summary--verboseβ Verbose module output--quietβ Quiet module output--uiβ Force launching GUI dialog
π₯ Parameters π₯
map=name[required] β Name of vector map to edit. can also be the data source for direct OGR access πlayer=stringβ Layer number or name. so like, vector features can have category values in different layers, and this number decides which layer we're on. when you're using direct OGR access this is the layer name instead. Default:1type=string[,string,...]β Input feature type. Options:point,line,boundary,centroid. Default:point,line,boundary,centroidtool=string[required] β Tool. Options:create,add,delete,copy,move,flip,catadd,catdel,merge,break,snap,connect,extend,extendstart,extendend,chtype,vertexadd,vertexdel,vertexmove,areadel,zbulk,selectcreate: Create new (empty) vector mapadd: Add new features to existing vector mapdelete: Delete selected features from vector mapcopy: Copy selected featuresmove: Move selected features in vector mapflip: Flip direction of selected vector linescatadd: Set new categories to selected vector features for defined layercatdel: Delete categories from selected vector features for defined layermerge: Merge selected vector linesbreak: Break/split vector linessnap: Snap vector features in given thresholdconnect: Connect two linesextend: Extend linesextendstart: Extend start nodesextendend: Extend end nodeschtype: Change feature type (point<->centroid,line<->boundary)vertexadd: Add new vertex to selected vector linesvertexdel: Remove vertex from selected vector linesvertexmove: Move vertex of selected vector linesareadel: Delete selected areas from vector map (based on selected centroids)zbulk: Z bulk-labeling (automated assignment of z coordinate to vector lines)select: Select lines and print their IDβs
input=nameβ Name of file containing data in GRASS ASCII vector format.'-'for standard input πmove=x,y,zβ Difference in x,y,z direction for moving feature or vertexthreshold=float[,float,...]β Threshold distance (coords,snap,query).'-1'for threshold based on the current resolution settings. Default:-1,0,0ids=rangeβ Feature ids. Example:1,3,7-9,13cats=rangeβ Category values. Example:1,3,7-9,13coords=x,y[,x,y,...]β List of point coordinatesbbox=x1,y1,x2,y2β Bounding box for selecting featurespolygon=x,y[,x,y,...]β Polygon for selecting featureswhere=sql_queryβ WHERE conditions of SQL statement without'where'keyword. Example:income < 1000 and population >= 10000query=stringβ Query tool. for'shorter'use a negative threshold value, positive value for'longer'. Options:length,danglelength: Select only lines or boundaries shorter/longer than threshold distancedangle: Select dangles shorter/longer than threshold distance
bgmap=name[,name,...]β Name of background vector map(s)snap=stringβ Snap added or modified features in the given threshold to the nearest existing feature. Options:no,node,vertex. Default:nono: Not apply snappingnode: Snap only to nodevertex: Allow snapping also to vertex
zbulk=value,stepβ Starting value and step for z bulk-labeling. Pair:value,step(e.g.1100,10)
π§ DESCRIPTION π§
so, the module v.edit lets you edit a vector map straight from the command line interface. no GUI, just vibes and flags. π
v.edit supports only "simple" vector features: points, centroids, lines and boundaries. and currently, only 2D vector features are supported (except for tool=zbulk, which is the one exception, periodt).
it provides editing featuresβ geometry. the attribute data connected to the vector map? not modified at all. we leave that alone, respectfully. π
vector features can be selected either by internal id, category number cats, coordinates coords, bounding box bbox, polygon, where statement (attribute data) or by query. selecting features by coordinates is affected by the current 2D resolution or by the threshold distance given by threshold. and the options are orthogonal, i.e. can be used in various combinations. for example:
v.edit map=roads tool=select \
coord=599505,4921010,603389.0625,4918292.1875 \
threshold=10000 where="label=βinterstateβ"
this selects all features (and prints their idβs to standard output) covered by two bounding boxes (center at 599505,4921010 and 603389.0625,4918292.1875, size 2*10000) with attribute label=βinterstateβ. iconic behavior honestly. β¨
π NOTES π
if no vector features are selected, or the flag -b is used, topology is not build at the end.
ngl bestie, that's lowkey important β no features selected means no topology build. don't come for me later. π
π USAGE π
okay bestie, this is the part where we actually do stuff with the map. buckle up. π
β¨ Feature selection β¨
Vector features can be selected in several ways, and honestly? pick your fighter:
idsβ using internal (unique) feature idβs πcatsβ using category numbers π±coordsβ using x,y coordinate pairs (center of bounding box, size defined bythreshold) πbboxβ using bounding box π¦polygonβ using polygon (at least 3 coordinate pairs have to be set) πΊwhereβ usingwherestatement (attribute data) πqueryβ special query (e.g. minimal vector line length) π΅οΈββοΈ
Additional parameters for vector feature specification are:
layerβ layer number (currently used only withcatsorwhereoption) π§thresholdβ threshold distance used for selecting vector features by coordinates π
π οΈ Tool description π οΈ
okay so the tool parameter is literally the main character here. each value does a different little task, and theyβre all iconic in their own way. letβs go one by one, no cap. π
createβ Create new (empty) vector map (see alsov.in.ascii). Optionally vector features (in GRASS ASCII vector format) can be read from standard input (input=-) or from the text file given by theinputoption. π±addβ Add new vector features (defined in GRASS ASCII vector format) to existing vector map. Features can be read from standard input or from the given text file (inputoption). If no header is given, the-nflag must be used. Added features can be snapped (defined bysnapparameter) to nodes or vertices based on threshold distancethreshold. βdeleteβ Delete selected vector features from existing vector map. ποΈcopyβ Make identical copy of selected vector features. If background mapbgmapis given copy features from background map, not from currently modified vector map. πmoveβ Move selected features of existing vector map relatively to their current location. This tool requiresmoveoption. The option defines coordinates of the movement direction. Moved features can be snapped (defined bysnapparameter) to nodes or vertices based on threshold distancethreshold. πflipβ Flip direction of selected vector lines (lines or boundaries). πcataddβ Add new layer category(ies) to selected vector feature(s). Category can be later used for new database entry. π·οΈcatdelβ Delete layer category(ies) of selected vector feature(s). βmergeβ Merge (at least two) selected vector lines or boundaries. The geometry of the merged vector lines can be changed. If the second line from two selected lines is in opposite direction to the first, it will be flipped. See also modulev.build.polylines. π§¬breakβ Split given vector line or boundary into two lines on location given bycoords. Ifcoordsnot given, breaks all selected lines at each intersection (based onv.clean,tool=break). βοΈsnapβ Snap vector features in giventhreshold. See also modulev.clean. Note that this tool supports only snapping to nodes. Parameterssnapandbgmapare ignored. πconnectβ Connect selected lines or boundaries, the first given line is connected to the second one. The second line is broken if necessary. The lines are connected only if distance between them is not greater than snapping threshold distancethreshold. πextendβ Extend selected lines or boundaries without changing the current shape. Similar toconnect, but the first and second lines are both extended until they intersect. The second line is broken if necessary. The lines are extended only if distance between them is not greater than snapping threshold distancethreshold. If the first and second lines are parallel and do not intersect, no lines are extended. Use the-pflag to extend the first line across the parallel gap. πextendstartβ Similar toextend, but extend at start nodes only. Start nodes are used to select the second line and the end node of that line can also be extended if it is within the snapping threshold distance given bythreshold. πextendendβ Similar toextend, but extend at end nodes only. πchtypeβ Change feature type of selected geometry objects. Points are converted to centroids, centroids to points, lines to boundaries and boundaries to lines. πvertexaddβ Add vertex(ces) to the given vector lines or boundaries. Location of the new vertex is given bycoordoption. If-1is given only first found line or boundary in bounding box is modified. πvertexdelβ Remove vertex(ces) specified bycoordsoption. If-1is given only first found line or boundary in bounding box is modified. π§½vertexmoveβ Move vertex(ces) specified bycoordsoption. Direction of the movement is specified by themoveoption. If-1is given only first found line or boundary in bounding box is modified. Moved vertex can be snapped (definedsnap) to nodes or vertices based on threshold distancethreshold. π§zbulkβ Assign z coordinate to 3D vector lines in given bounding box. The first found line will get z coordinate based on value given byzbulkparameter. Z coordinate of other selected lines will be increased by step given byzbulkparameter. This tool strictly requiresbboxandzbulkparameter. Also input vector map must be 3D. π§selectβ Print comma separated list of selected line idβs. No editing is done. π
thatβs the whole tool lineup bestie, every single one accounted for. more coming in the next part, donβt go anywhere. π
πΈ EXAMPLES πΈ
ok bestie this is the part where we actually do stuff, no cap. every single one of these is copy-pasteable, so go off π
π Create new vector map
so you wanna make a fresh empty one? iconic. run this:
v.edit tool=create map=vectmap
or if you already got data in a file called roads.txt and you want it in there, first dump it out:
v.out.ascii in=roads format=standard > roads.txt;
v.edit tool=create map=vectmap input=roads.txt
or alternatively (same energy, different plumbing):
cat roads.txt | v.edit tool=create map=vectmap input=-
β¨ Add new features to existing vector map
adding a new point to the vector map (without header, so no preamble bestie):
echo "P 1 1
640794 214874
1 1" | v.edit -n tool=add map=vectmap input=-
# insert new row for each category in attribute table if doesn't exist yet
v.to.db map=vectmap option=cat
heads up: the input must be in GRASS ASCII vector format. no shortcuts, no vibes-only data π
and if you want to add new features straight off standard input:
v.out.ascii in=railroads format=standard | v.edit tool=add map=vectmap input=-
ποΈ Delete selected features from vector map layer
yeeting every vector feature with category number 1 or 2:
v.edit tool=delete map=roads cats=1,2
ooh and if you want the opposite β remove everything except the ones with category number 1 or 2 (reverse selection):
v.edit -r tool=delete map=roads cats=1,2
want to remove features with category 1 or 2 that are sitting on the coordinates 600952.625,4926107 (and yes, the bounding box is based on the current 2D resolution):
g.region -d;
v.edit tool=delete map=roads cats=1,2 coords=600952.625,4926107
and the β¨fancyβ¨ version β nuke all features with category 1 and 2 that are covered by two bounding boxes (center coordinates 592542.892,4924766.996 and 603389.062,4918292.187, size 1000 map units):
v.edit map=roads tool=delete \
coord=592542.892,4924766.996,603389.062,4918292.187 \
threshold=1000 cat=1,2
π Copy selected features from background map
copying every feature with category number 1 over from the background map:
v.edit map=roads tool=copy bgmap=archsites cat=1
π Move features
moving a feature (vector point) that's chillin' on coordinates 602580,4918480 over to 603580,4919480:
v.edit tool=move map=archsites coord=602580,4918480 th=1e-2 move=1000,1000
moving all features with category 1 a full 1000 map units to the west and 1000 map units to the south β and the moved features snap to nodes within a threshold distance of 10 map units:
v.edit tool=move map=roads cat=1 move=1000,-1000 snap=node threshold=-1,10
or move everything defined by the bounding box 601530,4921560,602520,4922310 (W,S,E,N) 1000 map units east and 1000 map units north:
v.edit tool=move map=roads bbox=601530,4921560,602520,4922310 move=-1000,1000
π Flip direction of vector lines
flipping the direction of all the vector lines, just like that:
v.edit tool=flip map=streams cats=1-9999 type=line
π·οΈ Add / delete layer category number
adding a new layer/category 2/1, 2/3, 2/4, 2/5 to the features covered by this given polygon:
v.edit tool=catadd map=roads \
polygon=599877.75,4925088.375,597164.812,4922524.5,601338.562,4920914.625 \
layer=2 cat=1,3-5
and deleting layer/category 1/1, line id 1:
v.edit tool=catdel map=roads id=1 cats=5
π§΅ Merge lines
merging two lines with a given category number:
v.edit map=roads tool=merge cat=4
βοΈ Split line on given point
splitting line id 810 on coordinates 604268,4923570 with a threshold of 50 map units:
v.edit map=roads tool=break coords=604268,4923570 id=810 threshold=50
π₯ Break selected lines at each intersection
breaking selected lines (the ones with category number 1) at each and every intersection:
v.edit map=roads tool=break cat=1
π§² Snap lines
snapping all the lines using a threshold distance of 20 map units:
v.edit map=roads id=1-9999 tool=snap threshold=-1,20 type=line
π Connect lines
connecting line id 48 to line id 565:
v.edit map=roads tool=connect id=48,565
or the double-connect β line id 48 to line id 565, and line id 60 to line id 50 β with a maximum threshold distance of 700 map units:
v.edit map=roads tool=connect id=48,565,60,50 threshold=-1,700
β Add vertex
adding a new vertex to the line located at 600952,4926107, threshold set to 1 map unit:
v.edit tool=vertexadd map=roads coords=600952,4926107 threshold=1
β Delete vertices
deleting the vertex located at 593191.608,4925684.849 (threshold set to 0.1 map units) while modifying only lines with category 1:
v.edit tool=vertexdel map=roads coord=593191.608,4925684.849 \
threshold=1-e1 cats=1
π Move vertices
moving the vertices located at 604441,4921088 (threshold set to 100 map units), and modifying only lines with categories 1-10:
v.edit tool=vertexmove map=roads cats=1-10 coord=604441,4921088 \
threshold=100 move=1000,1000
π Select features and print their id's
printing the id's of selected features, like so:
v.edit map=soils@PERMANENT tool=select \
bbox=595733.8125,4919781.75,598536.1875,4917396.75 --q
and here's the same energy but with d.vect:
d.erase;
d.vect roads;
d.vect -i map=roads cats=`v.edit map=roads tool=select \
coord=592542.89243878,4924766.99622811,603389.0625,4918292.1875 \
threshold=1000 --q` col=red
selecting all lines that are shorter than (or equal to) 10 map units:
v.edit map=roads tool=select query=length threshold=-1,0,-10
and selecting, from a given bounding box, all lines longer than 200 map units:
v.edit map=roads tool=select bbox=598260,4919730,605100,4926240 query=length threshold=-1,0,200
β°οΈ Fix height of contours
okay so, your input vector map has 2D lines representing contours. you can assign height to those contours using tool=zbulk. but first β first β those 2D lines need to become 3D lines:
v.extrude input=line2 output=line3 height=0 type=line
after that, all lines which intersect with the line given by coordinates will be modified. the first found line gets height 1000 map units, and the height of the other selected lines gets increased by 10 map units:
v.edit a2 tool=zbulk bbox=586121.25049368,4911970.21547109,603092.60466035,4927071.25713776 \
zbulk=1000,10
π SEE ALSO π
v.in.ascii, v.info, v.build, v.build.polylines, v.clean, v.extrude, v.split
also go peek at the wxGUI vector digitizer π
π AUTHORS π
- Original author: Wolf Bergenheim - independent developer
- Initial updates: Jachym Cepicky, Mendel University of Agriculture and Forestry in Brno, Czech Republic
- Major update by Martin Landa, FBK-irst (formerly ITC-irst), Trento, Italy
- Extend tools by Huidae Cho
π SOURCE CODE π
Available at: v.edit source code (history)
Latest change: Saturday Aug 23 21:41:42 2025 in commit: 5c461f9c6bdbb810700ee7615ad223f9abf46974
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
and that's the whole entire page bestie, you ate π«Ά this was GRASS 8.5.0, v.edit(1grass), last touched Saturday Aug 23 21:41:42 2025 β go forth and edit some vectors, you've got this π
β¨π
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms