Rich Shepard wrote:

On Sat, 12 Mar 2011, Micha Silver wrote:

Furthermore, if you're going to change the whole project over to database stored attribs, then the best method is to set the new database connection for your mapset (db.connect + db.login) then just run db.copy on all your vectors. All the new "copies" will have their data tables in the (now default) database.

Micha,

  I set db.connect to the postgres server at localhost (using db_driver=pg)
and don't need to explicitly login. Following the example on the manual page
I must have missed something:

GRASS 6.5.svn (Nevada-aea):~/grassdata > db.copy from_driver=dbf
from_database=$HOME/grassdata/nevada-aea/PERMANENT/dbf
from_table=at_risk_species to_driver=pg
to_database="host=localhost,dbname=nevada" to_table=at_risk_species
DBMI-DBF driver error:
Cannot create dbf database:
/home/rshepard/grassdata/nevada-aea/PERMANENT/dbf

WARNING: Unable to open database <dbf> by driver
         </home/rshepard/grassdata/nevada-aea/PERMANENT/dbf>
Segmentation fault

  I don't want to create the dbf database, but copy the data from it. Must
be a syntax error I made that I don't see. But, it caused grass to segfault.
Hmmm-m-m-m.

Hmmm is right.
On my (debian) I get:

# check columns in a vector
GRASS 6.4.0RC6 (ITM):~ > v.info -c idan_catchments
Displaying column types/names for database connection of layer 1:
INTEGER|cat
CHARACTER|label
DOUBLE PRECISION|area_sqm
INTEGER|area_dunam

# Which current db connection?
GRASS 6.4.0RC6 (ITM):~ > v.db.connect -p idan_catchments
Vector map <idan_catchments@idan> is connected by:
layer <1> table <idan_catchments> in database </home/micha/geodata/grass/ITM/idan/dbf/> through driver <dbf> with key <cat>
GRASS 6.4.0RC6 (ITM):~ >

# Copy to postgres
GRASS 6.4.0RC6 (ITM):~ > db.copy from_dri=dbf to_dri=pg to_data="host=localhost,dbname=geodata" from_tab=idan_catchments to_tab=idan_catchments

# Check for data in new table
GRASS 6.4.0RC6 (ITM):~ > psql -d geodata -c "SELECT * FROM idan_catchments"
 cat | label |   area_sqm   | area_dunam
-----+-------+--------------+------------
   2 |       |   455240.625 |        455
   4 |       |    9070862.5 |       9070
   6 |       |  1637971.875 |       1637
   8 |       |     11677375 |      11677
  10 |       |    2449587.5 |       2449
  12 |       |  4955384.375 |       4955
  14 |       |  5248571.875 |       5248
  16 |       |  7726990.625 |       7726
  18 |       |      2845550 |       2845
......


Why don't you try with g.copy?



Clue appreciated,

Rich

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.



_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to