v.db.addtable(1grass)
π v.db.addtable π (that's the manual page name bestie, v.db.addtable(1grass), from the GRASS User's Manual)
β¨ NAME β¨
okay so v.db.addtable makes a brand new attribute table and hooks it up to whichever layer of an existing vector map you point at. it's giving matchmaker π«Ά
π·οΈ KEYWORDS
vector, attribute table, database
π SYNOPSIS
v.db.addtable
v.db.addtable --help
v.db.addtable map=name [table=string] [layer=integer] [key=name]
[columns=name type[,name type,...]] [--help] [--verbose] [--quiet]
[--ui]
π© Flags
--helpβ prints the usage summary, the classic "what do i even type" rescue π--verboseβ verbose module output, she's chatty π¬--quietβ quiet module output, she's mysterious π€«--uiβ forces the GUI dialog to launch, main character energy in a window πͺ
π Parameters
map=name[required] β the name of the vector map. can also be a data source for direct OGR access, iykyktable=stringβ name of the new attribute table. default? the vector map name, cute and convenient β¨layer=integerβ which layer number you want the new attribute table on. default:1key=nameβ name of the key column, and no cap it must refer to an integer column. default:catπ±columns=name type[,name type,...]β name and type of the new column(s), written like'name type [,name type, ...]'. the types depend on your database backend, but literally all of them supportVARCHAR(),INT,DOUBLE PRECISIONandDATE. example:'label varchar(250), value integer'
π DESCRIPTION
v.db.addtable creates a new attribute table and adds it to a given vector map. it links that table to the layer you specified. and if your vector map isn't linked to any table yet? don't stress β a new database link gets established based on the MAPSET database settings (go peek at db.connect) π
ποΈ NOTES
v.db.addtable is basically a front-end to db.execute, there to make your life easier. obsessed with the convenience honestly.
here's the tea though: v.db.addtable will only insert category values into the table for those features which actually have a category value in the relevant layer. so if you want those category values in there, you can add them automatically with v.category, or do it manually with the wxGUI vector digitizer, before you run v.db.addtable. or flip the order β run v.db.addtable first, then use either a combination of v.category + v.to.db, or the wxGUI vector digitizer, to add the relevant lines into the table. both paths eat, pick your fighter π
the supported types of columns depend on the database backend. however, all backends should support VARCHAR, INT, DOUBLE PRECISION and DATE β
and if you wanna double check the existing database connection(s), just verify them with v.db.connect.
π EXAMPLE
adding a new attribute table with a single column to default layer 1:
g.copy vect=roadsmajor,myroads
v.db.addtable myroads columns="slope double precision"
v.db.connect -p myroads
v.info -c myroads
adding a new attribute table with two columns to layer 2:
g.copy vect=roadsmajor,myroads
v.db.addtable myroads columns="slope double precision, roadname varchar(15)" layer=2
v.db.connect -p myroads
v.info -c myroads
v.info -c myroads layer=2
π SEE ALSO
db.connect, db.droptable, db.execute, v.db.connect, v.db.dropcolumn, v.db.droptable, v.db.select, v.db.update
GRASS SQL interface
π AUTHOR
Markus Neteler
π SOURCE CODE
available at: v.db.addtable source code (history)
latest change: Monday Aug 11 18:59:23 2025 in commit: edc87a4920570efe1d80b06033a435fc2f419d8f
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 page bestie, you ate π β¨ this was brought to you by GRASS 8.5.0, so when you're done slaying your attribute tables just remember where you got the lore πππ¦
π¦ 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