v.in.db(1)

NAME
v.in.db - Create new vector (points) from database table containing coordinates.

SYNOPSIS
v.in.db
v.in.db help
v.in.db driver=string database=string table=string x=string y=string [z=string] key=string output=string

  Parameters:

driver=string
    Input driver name Options: dbf,pg,ogr

database=string
    Input database name

table=string
    Input table name

x=string
    x column name

y=string
    y column name

z=string
    z column name

key=string
    category column name

output=string
    Name of vector output file

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,user=name" \
         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, the 'object ID' of PostgreSQL can be used. In this case set:
  cat=OID

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,user=name" \
         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, the 'object ID' of PostgreSQL can be used. In this case set:
  cat=OID

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

The DBF file has to be copied into $MAPSET/dbf/ (to be created if not existing yet). Then the DBMI needs to be connected to this directory:
 #check current DB settings:
 db.connect -p
 #only needed, if not already defined:
 db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
 #create dbf/ directory if not yet existing:
 mkdir `g.gisenv get=GISDBASE`/`g.gisenv get=LOCATION_NAME`/`g.gisenv get=MAPSET`/dbf

 #copy DBF table to this directory:
 cp pointsfile.dbf `g.gisenv get=GISDBASE`/`g.gisenv get=LOCATION_NAME`/`g.gisenv get=MAPSET`/dbf/
 #verify table columns
 db.tables -p
 db.describe -c pointsfile
 #create vector map from DBF table ('idcol' is containing unique row IDs, z is optional):
 v.in.db driver=dbf 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, such a column with unique IDs has to be added beforehand.

AUTHOR
Radim Blazek

Last changed: $Date: 2005/08/08 16:26:04 $

Help Index