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: 1
  • key=name β€” name of the key column. must refer to an integer column, no funny business. default: cat
  • columns=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 support VARCHAR(), INT, DOUBLE PRECISION and DATE. 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.addtable first, then use either a combo of v.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