GRASS logo

NAME

v.db.join.py - Joins a database table to a vector map table.

KEYWORDS

vector, attribute table, database

SYNOPSIS

v.db.join.py
v.db.join.py --help
v.db.join.py map=name [layer=string] column=name other_table=name other_column=name [subset_columns=name[,name,...]] [--help] [--verbose] [--quiet] [--ui]

Flags:

--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

map=name [required]
Name of vector map
Vector map to which to join other table
layer=string
Layer number or name
Layer where to join
Default: 1
column=name [required]
Identifier column (e.g.: cat) in the vector table to be used for join
other_table=name [required]
Other table name
other_column=name [required]
Identifier column (e.g.: id) in the other table used for join
subset_columns=name[,name,...]
Subset of columns from the other table

Table of contents

DESCRIPTION

v.db.join joins the content of another table into the connected attribute table of a vector map.

NOTES

v.db.join is a front-end to db.execute to allow easier usage. The vector attribute table must be stored in a SQL database (SQLite, PostgreSQL, MySQL, ODBC, ...). The DBF backend is not supported. Tables can be imported with db.in.ogr.

The vector map-database connection(s) can be verified with v.db.connect.

EXAMPLE

Joining the soil type explanations from table soils_legend into the Spearfish soils map (download legend):
g.copy vect=soils,mysoils

# import legend table
db.in.ogr soils_legend.csv out=soils_legend

# get join column names
v.info -c mysoils
db.describe -c soils_legend

# look at original table
v.db.select mysoils
cat|label
1|Aab
2|Ba
3|Bb
4|BcB
5|BcC
...

# look at legend
db.select soils_legend
db.select soils_legend | head -7
id|shortname|longname
0|no data|no data
0|AaB|Alice fine sandy loam, 0 to 6
0|Ba|Barnum silt loam
0|Bb|Barnum silt loam, channeled
0|BcB|Boneek silt loam, 2 to 6
0|BcC|Boneek silt loam, 6 to 9
...

# join soils_legend into mysoils attribute table
v.db.join mysoils col=label other_table=soils_legend ocol=shortname

# verification of join
v.db.select mysoils
cat|label|id|shortname|longname
1|Aab|||
2|Ba|2|Ba|Barnum silt loam
3|Bb|3|Bb|Barnum silt loam, channeled
4|BcB|4|BcB|Boneek silt loam, 2 to 6
5|BcC|5|BcC|Boneek silt loam, 6 to 9
...

SEE ALSO

db.execute, db.in.ogr, v.db.update
GRASS SQL interface

AUTHOR

Markus Neteler

Last changed: $Date: 2014-11-28 17:25:40 +0100 (pá, 28 11 2014) $


Main index | Vector index | Topics index | Keywords index | Full index

© 2003-2015 GRASS Development Team, GRASS GIS 7.0.1 Reference Manual