db.in.ogr(1grass)
β¨ db.in.ogr β¨
okay bestie, welcome to db.in.ogr from the GRASS User's Manual β it's the little import icon of the database world and honestly? iconic π
π« NAME π«
db.in.ogr β imports attribute tables in various formats. slay.
π·οΈ KEYWORDS π·οΈ
database, import, attribute table
π SYNOPSIS π
db.in.ogr
db.in.ogr --help
db.in.ogr input=name [gdal_config=string] [gdal_doo=string]
[db_table=name] [output=name] [key=string] [encoding=string]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π© Flags π©
--overwriteβ allow output files to overwrite existing files (yes it will just β¨replaceβ¨ them, be aware)--helpβ print usage summary, your little cheat sheet--verboseβ verbose module output, chatty mode activated--quietβ quiet module output, shhh mode--uiβ force launching GUI dialog
π§ Parameters π§
input=name[required] β table file to be imported, or a DB connection string. like, you literally cannot skip this one bestiegdal_config=stringβ GDAL configuration options. comma-separated list ofkey=valuepairsgdal_doo=stringβ GDAL dataset open options. also a comma-separated list ofkey=valuepairsdb_table=nameβ name of table from given DB to be importedoutput=nameβ name for output tablekey=stringβ name for auto-generated unique key columnencoding=stringβ encoding value for attribute data
πΈ DESCRIPTION πΈ
so db.in.ogr imports attribute tables in various formats, as supported by the OGR library on your local system β think DBF, CSV, PostgreSQL, SQLite, MySQL, ODBC, etc. π
and optionally? a unique key (ID) column can be added to the table. cute, right?
π EXAMPLES π
π Import CSV file
limited type recognition can be done for Integer, Real, String, Date, Time and DateTime columns β through a descriptive file with same name as the CSV file, but with a .csvt extension (see details here). iykyk.
# NOTE: create koeppen_gridcode.csvt first for automated type recognition
db.in.ogr input=koeppen_gridcode.csv output=koeppen_gridcode gdal_doo="AUTODETECT_TYPE=YES"
db.describe koeppen_gridcode -c
db.select table=koeppen_gridcode
π¦ Import DBF table
import of a DBF table with an additional unique key column (e.g., needed for v.in.db). like, that key column? she's doing important work.
db.in.ogr input=/path/to/mydata.dbf output=census_raleigh key=myid
db.describe -c census_raleigh
π Import of a SQLite table
db.in.ogr input=/path/to/sqlite.db db_table=census_raleigh output=census_raleigh
π«Ά Import of a PostgreSQL table
# HINT: if the database contains spatial tables, but you want to import a non-spatial
table, set the environmental variable PG_LIST_ALL_TABLES to YES before importing
db.in.ogr input="PG:host=localhost dbname=ecad user=neteler" \
db_table=ecad_verona_tmean output=ecad_verona_tmean
db.select table=ecad_verona_tmean
db.describe -c ecad_verona_tmean
π Import XLS file
to force reading headers, define the environmental variable OGR_XLS_HEADERS=βFORCEβ. parameter db_table refers to the list within the XLS file.
export OGR_XLS_HEADERS=βFORCEβ
db.in.ogr input=address.xls db_table=address_data
β SEE ALSO β
db.select,v.in.ogr,v.in.db- GRASS SQL interface
π AUTHOR π
Markus Neteler
π₯ SOURCE CODE π₯
available at: db.in.ogr source code (history)
latest change: Tuesday May 20 22:51:55 2025 in commit: 6f8ee15f43b0425f1bee79306540f3221004d255
main index | database index | topics index | keywords index | graphical index | full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
okay that's the whole thing babes, no cap, every last flag accounted for π
β¨ GRASS 8.5.0, the db.in.ogr(1grass) page β go import something cute, bestie ππ¦π
π¦ 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