v.db.addtable(1)
β¨ v.db.addtable β¨
okay bestie, welcome to v.db.addtable from the GRASS GIS User's Manual π this is the one that builds you a brand-new attribute table and hooks it up to a layer of a vector map you already have. it's giving glow-up for your vector data π¦
πΈ NAME πΈ
v.db.addtable β creates and connects a new attribute table to a given layer of an existing vector map. no cap, that's literally the whole job π
π 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, aka the little cheat sheet π§--verboseβ verbose module output, she's chatty π¬--quietβ quiet module output, she's mysterious π€«--uiβ force launching the GUI dialog, for the visual girlies π¨
π Parameters:
map=name[required] β name of vector map. or, plot twist, the data source for direct OGR access πtable=stringβ name of the new attribute table. default is the vector map name, cute and automatic πlayer=integerβ layer number where to add the new attribute table. default:1key=nameβ name of the key column. must refer to an integer column, no funny business. default:catcolumns=name type[,name type,...]β name and type of the new column(s) ('name type [,name type, ...]'). the types depend on the database backend, but all of them supportVARCHAR(),INT,DOUBLE PRECISIONandDATE. example:'label varchar(250), value integer'
π DESCRIPTION π
v.db.addtable creates and adds a new attribute table to a given vector map, then links that table to the layer you picked. and if your vector map isn't linked to any table yet? bestie, don't even worry β a new database link gets established for you based on the MAPSET database settings (peep db.connect for that) β¨
π¦ NOTES π¦
v.db.addtable is a front-end to db.execute, because we like our lives easy and our commands easier π
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 the rest, you've got options:
- add the category values automatically with
v.categoryπ§ - or manually with the wxGUI vector digitizer, before running
v.db.addtable - or run
v.db.addtablefirst, then use either a combo ofv.category+v.to.db, or the wxGUI vector digitizer, to add the relevant lines to the table
the supported types of columns depend on the database backend. however, all backends should support VARCHAR, INT, DOUBLE PRECISION and DATE β
and your existing database connection(s)? you can verify those with v.db.connect, always good to double-check before you commit to a whole new table π
π 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 β icon behavior, honestly π«Ά
β SOURCE CODE β
available at: v.db.addtable source code (history)
accessed: Saturday Jan 17 05:41:52 2026
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
okay that's the whole page bestie, you ate that π
this was GRASS 8.4.2, v.db.addtable(1), go build yourself a table and slay πβ¨ππ¦
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· 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