db.in.ogr(1)

πŸ¦‹ db.in.ogr(1) β€” the GRASS GIS User's Manual page πŸ¦‹

okay so bestie, this is the db.in.ogr(1) manual page, and it's lowkey one of the most useful little gremlins in the whole GRASS GIS toolbox. It's giving "let me drag literally any attribute table into your mapset". Buckle up, we're going through the WHOLE thing, no skipping, periodt. πŸ’…


✨ NAME ✨

db.in.ogr β€” imports attribute tables in various formats.

πŸ”‘ 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 β€” lets output files overwrite files that already exist. yes she will bulldoze, be careful babe 😭
  • --help β€” prints the usage summary, aka the "what do I even do here" button
  • --verbose β€” verbose module output, she will talk A LOT
  • --quiet β€” quiet module output, she will not talk at all
  • --ui β€” forces the GUI dialog to launch, main character window energy πŸ‘‘

πŸ’– Parameters:

  • input=name [required] β€” the table file to be imported, OR a DB connection string. required required, no input no party.
  • gdal_config=string β€” GDAL configuration options. it's a comma-separated list of key=value pairs.
  • gdal_doo=string β€” GDAL dataset open options. also a comma-separated list of key=value pairs.
  • db_table=name β€” name of the table from the given DB that you want imported
  • output=name β€” the name for your output table
  • key=string β€” name for an auto-generated unique key column
  • encoding=string β€” encoding value for attribute data

πŸ’œ DESCRIPTION πŸ’œ

db.in.ogr imports attribute tables in various formats as supported by the OGR library on the local system β€” think DBF, CSV, PostgreSQL, SQLite, MySQL, ODBC, etc. ✨ And optionally, a unique key (ID) column can be added to the table. that's it, that's the whole vibe.


🌈 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 .csvt extension (see details here).

# 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 additional unique key column (e.g., needed for v.in.db).

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 environmental variable OGR_XLS_HEADERS=’FORCE’. Parameter db_table refers to the list within 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)

Accessed: Saturday Jan 17 05:41:51 2026

Main index | Database index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual


and that's a wrap bestie πŸŽ€ this whole page lives in GRASS 8.4.2 (db.in.ogr(1), obvi), the source code was accessed Saturday Jan 17 05:41:51 2026, and the copyright belongs to the GRASS Development Team, Β© 2003-2025, from the GRASS GIS 8.4.2 Reference Manual. go import something cute, ily, bye πŸ’œβœ¨

πŸ“¦ where this page comes from