Note: A new GRASS GIS stable version has been released: GRASS GIS 7.6, available here.
Updated manual page: here
v.in.db creates key column "cat" automatically when key option is not given. Note that this operation is possible to perform only when -t flag is not given. Currently, automated creation of key column is supported only when default DB driver for output vector map is SQLite driver otherwise key option must be specified by the user. Default DB driver is defined by db.connect.
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 present in the PostgreSQL table, a new column should be added. See PostgreSQL DB driver page for details.
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 present in the PostgreSQL table, a new column should be added. See PostgreSQL DB driver page for details.
Alternatively a vector point map can be imported from PostGIS database using v.in.ogr.
# preview table structure with OGR tool (table name is "Layer name" here): ogrinfo -al -so meteodata.ods # import sheet from ODS into map v.in.db key=ID table=mysheet x=long y=lat z=height output=meteodata \ driver=ogr database=meteodata.ods
v.in.db table=List1 x=long y=lat z=height output=meteodata \ driver=ogr database=meteodata.xls
v.in.db driver=dbf database=/home/user/tables/ table=pointsfile x=x y=y z=z \ key=idcol out=dtmpoints
v.info dtmpoints v.info -c dtmpoints
If DB driver for output vector map is different from SQLite driver and an ID column is missing in the DBF file, it has to be added beforehand, e.g. with OpenOffice. Alternatively, import the table with db.in.ogr into GRASS and then with v.in.db from the imported table (db.in.ogr optionally adds an unique ID column).
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"
v.in.db driver=sqlite database=/home/user/tables/mysqlite.db table=pointsfile x=x y=y z=z \ key=idcol out=dtmpoints
Last changed: $Date: 2017-01-02 03:33:51 -0800 (Mon, 02 Jan 2017) $
Available at: v.in.db source code (history)
Note: A new GRASS GIS stable version has been released: GRASS GIS 7.6, available here.
Updated manual page: here
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
© 2003-2019 GRASS Development Team, GRASS GIS 7.2.4svn Reference Manual