[GRASS5] vector import, howto

"Peter Löwe" peter.loewe at gmx.de
Sat Feb 5 09:06:00 EST 2005


Dear List:

I am trying to ingest a ASCII-CSV-List into GRASS 6beta1.

The list conists of lines which look
like
this:

900000001|09|1|79|149|001||10||4431350.18|5329876.12|Sankt-Ottilien-Straße|82299|Türkenfeld|b
Furstenfeldbruck 

The coordinate info sits in the fields tent and eleven
(4431350.18|5329876.12), "category" resides in field one.

The locations database is dbf:
GRASS 6.0.cvs:> db.connect -p
driver:dbf
database:$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
schema:(null)
group:(null)


The first attempt was made through v.in.ascii, since its HTML-Documentation
gives a similar example (at the very bottom of the HTML-document)

GRASS 6.0.cvs:~ > v.in.ascii in=adressen_grass.txt out=adr_dbx1 
 y=11 x=10 cat=1 columns='cat int, var2 int, var3 int, var4 int, 
 var5 int, var6 int, var7 varchar(3), var8 int, var9 varchar(4), x 
 double, y double, var12 varchar(30),var13 int,var14 varchar(30),var15
varchar(40)'

This approach fails:


WARNING: DOS text format found, attempting import anyway 
Maximum input row length: 115 
Maximum number of columns: 15 
Minimum number of columns: 15 
column: 1  type: integer 
column: 2  type: integer 
column: 3  type: integer 
column: 4  type: integer 
column: 5  type: integer 
column: 6  type: integer 
column: 7  type: integer 
column: 8  type: integer 
column: 9  type: string  length: 1 
column: 10  type: double 
column: 11  type: double 
column: 12  type: string  length: 23 
column: 13  type: integer 
column: 14  type: string  length: 10 
column: 15  type: string  length: 18 
WARNING: Column 7 defined as string has only integer values 
DBMI-DBF driver error: 
SQL parser error in statement: 
insert into adr_dbx2 values ( 900000001, 09, 1, 79, 149, 001, , 
10, '', 4431350.18, 5329876.12, 'Sankt-Ottilien-Straße', 82299, 
'Türkenfeld', 'b Furstenfeldbruck') 
Error in db_execute_immediate() 
 
ERROR: Cannot insert values: insert into adr_dbx2 values 
( 900000001, 09, 
       1, 79, 149, 001, , 10, '', 4431350.18, 5329876.12, 
       'Sankt-Ottilien-Straße', 82299, 'Turkenfeld', 'b 
Fürstenfeldbruck') 
 
The warning message regarding column 7 is irrelevant, the same error occurs
when it is set to string.

Question 1: Is my attempt reasonable or is the module unsuitable for the
task ?

Otto Dassau advised me to try v.in.db instead.
Sorry Otto, still no luck:

After converting the data source into a DBF-file by OpenOffice, this
happens:

First step:
cp address.dbf $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/address.dbf

Second step:
GRASS 6.0.cvs: > v.in.db table=address.dbf y=11 x=10 cat=1 out=foo
DBMI-DBF driver error:
SQL parser error in statement:
select 1, 10, 11 from address.dbf
Error in db_open_select_cursor()

ERROR: Cannot open select cursor: 'select 1, 10, 11 from address.dbf'

Question 2: See question 1

Can anybody please help me out?

Thanks,
Peter


-- 
Dr. Peter Löwe

Diplom-Geograph

<loewe at geomancers.net>
<peter.loewe at gmx.de>

DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl




More information about the grass-dev mailing list