v.in.db(1)
π v.in.db π
okay bestie, welcome to the v.in.db page from the GRASS GIS User's Manual β yes it's a version 8.4.2 era manual page, yes it's a whole vibe, and yes, I'm about to make a database-to-vector-point-map tool sound like the most iconic thing you've ever heard. because honestly? it kind of is. π¦
β¨ NAME β¨
v.in.db β creates a brand new vector (points) map from a database table that's holding coordinates. like, the table has the numbers, and this module turns them into a whole map. slay.
π·οΈ KEYWORDS π·οΈ
vector, import, database, points
π SYNOPSIS π
v.in.db
v.in.db --help
v.in.db [-t] table=name [driver=name] [database=name] x=name y=name
[z=name] [key=name] [where=sql_query] output=name [--overwrite]
[--help] [--verbose] [--quiet] [--ui]
π© Flags
-tβ use the imported table as the attribute table for the new map. periodt.--overwriteβ allow output files to overwrite existing files (aka permission to be messy π )--helpβ print usage summary--verboseβ verbose module output--quietβ quiet module output--uiβ force launching GUI dialog
π Parameters
table=name[required] β input table namedriver=nameβ name of database driver- Options:
dbf,mesql,mysql,odbc,ogr,pg,sqlite - Default:
sqlite
- Options:
database=nameβ name of database- Default:
$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
- Default:
x=name[required] β name of the column that's holding the x coordinatey=name[required] β name of the column that's holding the y coordinatez=nameβ name of the column that's holding the z coordinatekey=nameβ name of the column containing the category number. must refer to an integer column, no cap.where=sql_queryβ WHERE conditions of an SQL statement, without theβwhereβkeyword- Example:
income < 1000 and population >= 10000
- Example:
output=name[required] β name for output vector map
πΈ DESCRIPTION πΈ
v.in.db creates a new vector point map from a database table or file that contains coordinates. that's it, that's the whole job, and it eats every single time. π₯
π NOTES π
If GRASS comes with OGR support, then v.in.db allows importing data from different input files, e.g. CSV or MS Excel (assuming the GDAL/OGR library was compiled with that support). so like, your spreadsheet can just. become a map. iconic behavior.
v.in.db creates the key column "cat" automatically when the key option is not given. but heads up bestie: this operation is only possible to perform when the -t flag is not given. also, currently the automated creation of the key column is supported only when the default DB driver for the output vector map is the SQLite driver β otherwise the key option must be specified by the user. the default DB driver is defined by db.connect. so basically: check your driver before you assume the magic is gonna happen, okay? π
π EXAMPLES π
π Creating a map from PostgreSQL table
v.in.db driver=pg database="host=myserver.itc.it,dbname=mydb" \
table=pat_stazioni x=east y=north z=quota key=id output=pat_stazioni
If an ID column is not present in the PostgreSQL table, a new column should be added. see the PostgreSQL DB driver page for details. π
πΊοΈ Creating a map from PostGIS
To extract coordinate values from PostGIS, functions have to be used:
v.in.db driver=pg database="host=myserver.itc.it,dbname=mydb" \
table=station x="x(geom)" y="y(geom)" z="z(geom)" key=id out=meteostations
If an ID column is not present in the PostgreSQL table, a new column should be added. see the PostgreSQL DB driver page for details.
Alternatively, a vector point map can be imported from a PostGIS database using v.in.ogr. two ways to get the same snack, love that for us. β¨
π Creating a map from Open Document spreadsheet (ODS) file
A new vector point map is created from a given sheet in an ODS file. the database option points to the ODS file. the table option is the name of the selected spreadsheet list, and the key option is the identifier column:
# preview table structure with OGR tool (table name is "Layer name" here):
ogrinfo -al -so meteodata.ods
# import sheet from ODS into map
v.in.db key=ID table=mysheet x=long y=lat z=height output=meteodata \
driver=ogr database=meteodata.ods
π Creating a map from MS Excel file
A new vector point map is created from a given sheet in an MS Excel file. the database option points to the file in MS Excel format. the table option is the name of the selected spreadsheet "List1":
v.in.db table=List1 x=long y=lat z=height output=meteodata \
driver=ogr database=meteodata.xls
Note that in this example the key option is omitted. in this case v.in.db tries to add the key column automatically. this requires SQLite to be the default DB driver. no pressure, just saying. π«Ά
ποΈ Creating a map from DBF table
A new 3D point vector map is created from a DBF table. the column βidcolβ contains unique row IDs. the database option is the directory where the DBF file is stored.
v.in.db driver=dbf database=/home/user/tables/ table=pointsfile x=x y=y z=z \
key=idcol out=dtmpoints
To check the result:
v.info dtmpoints
v.info -c dtmpoints
If the DB driver for the output vector map is different from the SQLite driver and an ID column is missing in the DBF file, it has to be added beforehand, e.g. with OpenOffice. Alternatively, import the table with db.in.ogr into GRASS and then use v.in.db from the imported table (db.in.ogr optionally adds a unique ID column). flexible? we love to see it.
π Creating a point map from DBF table for selected records only
The user can import only selected vector points from a table using the where parameter (see above for general DBF handling):
v.in.db driver=dbf database=/home/user/tables/ table=pointsfile x=x y=y z=z \
key=idcol out=dtmpoints where="x NOT NULL and z > 100"
πͺΆ Creating a map from SQLite table
A new vector point map is created from a table in a SQLite database file. the column βidcolβ contains unique row IDs. the database option is the SQLite database file.
v.in.db driver=sqlite database=/home/user/tables/mysqlite.db table=pointsfile x=x y=y z=z \
key=idcol out=dtmpoints
π SEE ALSO π
db.execute, db.in.ogr, v.info, v.in.geonames, v.in.ogr, v.to.db
SQL support in GRASS GIS
π AUTHORS π
- Radim Blazek
- Various updates for GRASS 7 by Martin Landa, Czech Technical University in Prague, Czech Republic
π» SOURCE CODE π»
Available at: v.in.db source code (history)
Accessed: Saturday Jan 17 05:41:21 2026
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page bestie!! π this little manual page is Β© 2003-2025 GRASS Development Team, and it's serving the GRASS GIS 8.4.2 Reference Manual energy β accessed on that Saturday Jan 17 05:41:21 2026 timestamp up there. now go make some points maps, you absolute main character. πβ¨π¦
π¦ 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