v.in.db

Langue: en

Autres versions - même langue

Version: 145947 (fedora - 04/07/09)

Section: 1 (Commandes utilisateur)

NAME

v.in.db - Creates new vector (points) map from database table containing coordinates.

KEYWORDS

vector, import

SYNOPSIS

v.in.db
v.in.db help
v.in.db table=name [driver=name] [database=name] x=name y=name [z=name] key=name [where=sql_query] output=name [--overwrite] [--verbose] [--quiet]

Flags:

--overwrite

Allow output files to overwrite existing files
--verbose

Verbose module output
--quiet

Quiet module output

Parameters:

table=name

Input table name
driver=name

Driver name
Options: odbc,pg,dbf,mesql,mysql,ogr,sqlite
Default: dbf
database=name

Database name
Default: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
x=name

Name of column containing x coordinate
y=name

Name of column containing y coordinate
z=name

Name of column containing z coordinate
key=name

Must refer to an integer column
where=sql_query

WHERE conditions of SQL statement without 'where' keyword
Example: income = 10000
output=name

Name for output vector map

DESCRIPTION

v.in.db creates new vector (points) map from database table containing coordinates.

EXAMPLE

1) 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 not present in the PostgreSQL table, a new column should be added. See pg driver page for detail.

2) 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 not present in the PostgreSQL table, a new column should be added. See pg driver page for detail.

3) Import of a points table (x, y, z) from DBF file to vector points map:


#create vector map from DBF table (here, 'idcol' contains unique row IDs, 'z' is optional):
#the 'database' parameter 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

#check result:
v.info dtmpoints
v.info -c dtmpoints

If an ID column is missing in the DBF file, it has to be added beforehand, e.g. with OpenOffice.

4) Import of a points table (x, y, z) from SQLite file to vector points map:


#create vector map from table in SQLITE database file (here, 'idcol' contains unique row IDs, 'z' is optional):
#the 'database' parameter is the the SQLite database file with path:
v.in.db driver=sqlite database=/home/user/tables/mysqlite.db table=pointsfile x=x y=y z=z \

        key=idcol out=dtmpoints

#check result:
v.info dtmpoints
v.info -c dtmpoints

If an ID column is missing in the table, it has to be added beforehand with 'sqlite3' or db.execute.

5) Import of a points table (x, y, z) from DBF file to vector points map for selected points 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"

SEE ALSO

db.execute, v.info, v.in.ogr, v.to.db,
SQL support in GRASS GIS

AUTHOR

Radim Blazek

Last changed: $Date: 2007-07-16 11:48:58 +0200 (Mon, 16 Jul 2007) $

Full index

Š 2003-2008 GRASS Development Team