[GRASS5] vector import, howto

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@geomancers.net>
<peter.loewe@gmx.de>

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

This has appeared in several recent postings. Also one of my grad students
reported identical problems where he'd been able to do the same kind of
import a couple months back.

Given the little bit of discussion, I'm beginning to suspect that it is a
quoting issue that may be primarily a problem with the TclTk GUI or may also
affect the command more broadly.

Here are a couple suggestions.

1) If you have not done this already, try it from the command line rather
than just from the GUI.

2) Try with different delimiters than |. Maybe try a comma ",".

Let us know what happens.

Michael
____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ 85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

From: Peter Löwe <peter.loewe@gmx.de>
Date: Sat, 5 Feb 2005 15:06:00 +0100 (MET)
To: <grass5@grass.itc.it>
Subject: [GRASS5] vector import, howto

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|822
99|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@geomancers.net>
<peter.loewe@gmx.de>

DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: DSL Vergleich 2024 | GMX.NET