v.net(1grass)
π NAME
v.net(1grass) β straight from the GRASS User's Manual, and bestie, she does network maintenance. That's it, that's the name: v.net - Performs network maintenance.
π·οΈ KEYWORDS
vector, network, network maintenance
β¨ SYNOPSIS β¨
v.net
v.net --help
v.net [-cs] [input=name] [points=name] [output=name]
operation=string [arc_layer=string] [arc_type=string[,string,...]]
[node_layer=string] [threshold=float] [file=name]
[turn_layer=string] [turn_cat_layer=string] [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
π© Flags:
-cβ Assign unique categories to new points. (For operation 'nodes', bestie π )-sβ Snap points to network. For operation 'connect'. By default, a new line from the point to the network is created.--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:
input=nameβ Name of input vector line map (arcs). Required for operation 'nodes', 'connect', 'report' and 'nreport'.points=nameβ Name of input vector point map (nodes). Required for operation 'connect' and 'arcs'.output=nameβ Name for output vector map.operation=string[required] β Operation to be performed. Options: nodes, connect, arcs, report, nreport, turntable- nodes: new point is placed on each node (line end) if doesn't exist
- connect: connect still unconnected points to vector network by inserting new line(s)
- arcs: new line is created from start point to end point
- report: print to standard output {line_category start_point_category end_point_category}
- nreport: print to standard output {point_category line_category[,line_category...]}
- turntable: create turntable on vector network
arc_layer=stringβ Arc layer. 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: 1arc_type=string[,string,...]β Arc type. Input feature type. Options: line, boundary. Default: line,boundarynode_layer=stringβ Node layer. 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: 2threshold=floatβ Threshold. Required for operation 'connect'. Connect points in given threshold.file=nameβ Name of input file. Required for operation 'arcs' ('-' for standard input)turn_layer=stringβ Turntable layer. Layer where turntable will be attached. Format: layer number[/layer name].Required for operation 'turntable'. Default: 3turn_cat_layer=stringβ Layer with unique categories used in turntable. Layer with unique categories for every line in arc_layer and point on every node. The categories are used in turntable. Format: layer number[/layer name]. Required for operation 'turntable'. Default: 4
π DESCRIPTION
So v.net is the girl in charge of network prep and network maintenance. Her main character job is turning vector lines (arcs ) and points (nodes) into a vector network β and she does it three ways: by creating nodes from intersections in a map of vector lines (the node operator), by connecting a vector lines map with a points map (the connect operator), and by creating new lines between pairs of vector points (the arcs operator). Three operators, three vibes. π¦
A GIS network is made of topologically correct lines (arcs). Translation: the lines have to be connected by shared vertices wherever real connections actually exist, no cap. In GRASS you can also add nodes to the network β these are like, specially designated vertices used for analyzing network properties or computing cost/distance measures. So real talk: not all vertices are treated as nodes by default. Only v.net.path can use a network without nodes, and they are required for all the other network modules. In GRASS, network arcs are stored in one data layer (normally layer 1) and nodes are stored in a different data layer (normally layer 2). Periodt. π
v.net offers two ways to add nodes to a network of arcs and one method to add arcs to a set of nodes:
- Use the
connectoperation to create nodes from a vector points file and add these nodes to an existing vector network of arcs (i.e., lines/boundaries). This is useful when the goal is to analyze a set of places (points) in relation to a network β for example travel costs between places. Only points within thethresh(threshold) distance to a line/boundary will be connected as network nodes. There are two ways to connect nodes. By default,v.netwill create new lines connecting each point to the closest line of the network. If you use the-sflag, however, the new nodes will be added on the closest line of the network at the point closest to the point you wish to add. When using theconnectoperation, some lines will share the same category. In order to assign unique costs to each line, a new layer needs to be created with
v.category input=yourmap option=add cat=1 step=1 layer=3
output=newmap
followed by
v.db.addtable map=newmap layer=3 table=tablename.
- Create nodes and arcs from a vector line/boundary file using the
nodeoperation. This is useful if you are mostly interested in the network itself and thus you can use intersections of the network as start and end points. Nodes will be created at all intersections of two or more lines. For an arc that consists of several segments connected by vertices (the typical case), only the starting and ending vertices are treated as network nodes. - Create straight-line arcs between pairs of nodes with the
arcsoption. This produces networks like those of airline flights between airports. It is also similar to the kind of network created with social networking software, making it possible to create georeferenced social networks. Airports and social graphs, iconic honestly. βοΈ
While the arcs created with v.net will retain any attribute information associated with the input vector line/boundary file in data layer 1, nodes created and stored in data layer 2 will not have any associated attribute information. Like, zero, none, nada. π
For nodes created using the connect and arcs operations (methods 1 and 3 above), the nodes can be reconnected to the attribute table of the input vector points file using the attribute table manager ("manage layers" tab) or by running v.db.connect.
For nodes created using the nodes operation (method 2 above), it is possible to create an attribute table for the new nodes in layer 2 using the attribute table manager and connect it to layer 2 ("manage layers" tab) or to create a table with v.db.addtable, connect it to layer 2 with v.db.connect, and update the new table with cat values with v.to.db.
The turntable operation creates a turntable with the costs for every possible turn on every possible node (intersection, crossroad) in given layer (arc_layer). U-turns are taken in account too. Turntable is created in turn_layer and turn_cat_layer. Building the turntable allows you to model e.g. traffic code, where some turns may be prohibited. If features in analyzed network are changed, the turntable must be created again (e.g. it includes v.net connect operation). Turntable name consists of output vector map name + "_turntable_" + "t" + "_" + turn_layer + "_" + "tuc" + "_" + turn_cat_layer + "_" + "a" + "_" + arc_layer, e. g. roads_turntable_t_3_tuc_4_a_1
These modules are able to work with the turntable: v.net.alloc, v.net.iso, v.net.path, v.net.salesman. For more information about turns in the vector network analyses see the "turns" wiki page.
Once a vector network has been created, it can be analyzed in a number of powerful ways using the suite of v.net.* modules. The shortest route between two nodes, following arcs, can be computed (v.net.path), as can the shortest route that will pass through a set of nodes and return to the starting node (v.net.salesman). Least cost routes through the network can be calculated on the basis of distance only or on the basis of distance weighted by an attribute associated with each arc (for example, travel speed along a network segment). A network can be divided into concentric zones of equal travel cost around one or more nodes (v.net.iso) or subdivided so that each node is surrounded by a zone in which all arcs can be reached with the same travel costs as all arcs surrounding each other node (v.net.alloc). In addition to the modules listed above, the GRASS vector networking suite includes numerous other modules for analysis of network costs and connectivity. These include: v.net.allpairs, v.net.bridge, v.net.centrality, v.net.components, v.net.distance, v.net.flow, v.net.spanningtree, v.net.steiner, v.net.timetable, v.net.visibility π
π NOTES
For a vector map prepared for network analysis in GRASS, nodes are represented by the grass-internal geometry type node and arcs by the geometry type line. If vector editing is required to modify the graph, g.gui.vdigit or v.edit can be used. See also the Linear Referencing System available in GRASS. π
πΈ EXAMPLES πΈ
Okay bestie, all of these are built on the North Carolina dataset, so you can literally just run them and vibe. π
β¨ Create nodes globally for all line ends and intersections
Want every single line end and every intersection to become a node? Say less:
v.net input=streets_wake output=streets_node operation=nodes
# verify result
v.category streets_node option=report
That second line is just you checking your work, like a good student. π
π« Merge in nodes from a separate map within given threshold
Now we're pulling nodes in from a whole other map, but only the ones chilling inside a set threshold:
v.net input=streets_wake points=firestations out=streets_net \
operation=connect threshold=500
# verify result
v.category streets_net option=report
Heads up bestie: the nodes get stored in layer 2 unless you pass node_layer=1. Don't say I didn't warn you. π
π¦ Generating network for vector point map
So if you want to generate a network from a given vector point map, you need an input file looking exactly like this:
[category of edge] [category of start node] [category of end node]
Two ways to serve it, pick your fighter. π
Option 1: Save the file and generate the map
Save it (let's say as points.txt) and then:
v.net points=geodetic_swwake_pts output=geodetic_swwake_pts_net \
operation=arcs file=points.txt
# verify result
v.category geodetic_swwake_pts_net option=report
Option 2: Read in from command line
For the girls who don't wanna make a file, feed it straight from the terminal with a heredoc:
v.net points=geodetic_swwake_pts output=geodetic_swwake_pts_net \
operation=arcs file=- << EOF
1 28000 28005
2 27945 27958
3 27886 27897
EOF
# verify result
v.category geodetic_swwake_pts_net option=report
The file=- is the moment, that's how it knows to read from stdin. π
π Generating network with turntable for vector point map
And THIS one generates a vector map with a turntable:
v.net operation=turntable in=railroads out=railroads_ttb
Literal main character energy. πβ¨
π SEE ALSO π
g.gui.vdigitv.edit- Vector Network Analysis Tool
And the whole v.net extended universe, no cap:
v.net.allocv.net.allpairsv.net.bridgev.net.centralityv.net.componentsv.net.connectivityv.net.distancev.net.flowv.net.isov.net.pathv.net.salesmanv.net.spanningtreev.net.steinerv.net.timetablev.net.visibility
π AUTHORS π
Give credit where credit is due, periodt:
- Radim Blazek, ITC-irst, Trento, Italy
- Martin Landa, FBK-irst (formerly ITC-irst), Trento, Italy and CTU in Prague, Czech Republic (operation
'connect'and'arcs') - Markus Metz: important fixes and improvements
π TURNS SUPPORT π
Fun fact bestie, the turns support was implemnented (yes, that's genuinely how it's spelled in the original, I'm not touching it) as part of the GRASS GIS turns cost project at Czech Technical University in Prague, Czech Republic. π
The icons who participated at the project:
- Eliska Kyzlikova
- Stepan Turek
- Lukas Bocan
- Viera Bejdova
And the breakdown:
- Implementation: Stepan Turek
- Documentation: Lukas Bocan
- Mentor: Martin Landa
π₯ SOURCE CODE π₯
Available at: v.net source code (history)
Latest change: Thursday Oct 02 17:25:23 2025 in commit:
52c8278fcfb1568f2dcab64c4657c305cc5f0aa1
Clickable navigation for your scrolling pleasure:
- Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
And that's the whole page, bestie!! π«Ά Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β this beauty is from the GRASS 8.5.0 manual, page v.net(1grass), and yes I love her your honor. πβ¨πΈ
π¦ 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