[GRASS-user] g.copy vect=... DBF/SQLITE in GRASS6.4.2

Markus Neteler neteler at osgeo.org
Mon Jul 16 13:53:23 PDT 2012


On Mon, Jul 16, 2012 at 4:44 PM, "Peter Löwe" <peter.loewe at gmx.de> wrote:
> Hi all,
>
> I just noticed that copying a vector amongs mapsets in GRASS6.4.2 is nontrivial for differing database backends:

... which OS?
(it should be trivial indeed)

> Let vector A reside in mapset Alpha, which is connected to a DBF "database".
>
> Let there be vector B residing in mapset Beta, which is set to a SQLITE database.
>
> Using "g.copy vect=A at ALPHA,A_test" to copy A into mapset Beta works without producing any errors or warnings.
>
> Unfortunately the attribute table is not copied in the process:  Is the user/operator really forced to fix this by hand every time ? Is there an elegant way to handle this ?

Not at all! Also the attribute table should be transferred of course.
I just tried with North Carolina:


GRASS 6.4.3svn (nc_spm_08):~ > g.copy vect=firestations at PERMANENT,myfirestations
Copy vector <firestations at PERMANENT> to current mapset as <myfirestations>

GRASS 6.4.3svn (nc_spm_08):~ > v.info -c firestations
Displaying column types/names for database connection of layer 1:
INTEGER|cat
INTEGER|ID
CHARACTER|LABEL
CHARACTER|LOCATION
...


GRASS 6.4.3svn (nc_spm_08):~ > v.db.select firestations
cat|ID|LABEL|LOCATION|CITY|MUN_COUNT|PUMPERS|PUMPER_TAN|TANKER|MINI_PUMPE|RESCUE_SER|AERIAL|BRUSH|OTHERS|WATER_RESC|MUNCOID|BLDGCODE|AGENCY|STATIONID|RECNO|CV_SID2|CVLAG
1|24|Morrisville #3|6804 Carpenter Fire Station
Rd|Morrisville|M|0|3|0|0|0|0|1|0|0|1|240|FD|MF3A|1|MF3A|1.4
2|23|Morrisville #1|100 Morrisville-Carpenter
Rd|Morrisville|M|0|1|0|0|1|0|1|3|0|1|241|FD|MF1A|2|MF1A|1.4
3|40|Apex #2|3045 New Hill Holleman
Rd|Apex|C|1|1|1|0|0|0|1|0|0|2|242|FD|AF2A|3|AF2A|1.4
...


GRASS 6.4.3svn (nc_spm_08):~ > v.db.connect -p firestations
Vector map <firestations at PERMANENT> is connected by:
layer <1> table <firestations> in database
</home/neteler/grassdata/nc_spm_08/PERMANENT/dbf/> through driver
<dbf> with key <cat>

... all as desired.

Please check the settings with v.db.connect, also the file permissions
of the DBF table (if unreadable, g.copy *should* say something).

Markus


More information about the grass-user mailing list