[GRASSLIST:10821] v.in.ascii error

Dear GRASS users,

I need to import an ascii file into a point vector file, and I'm using
v.in.ascii command.
My ascii file have three columns (x coordinates, y coordinates, ppm value)
with fields separator "|" (pipe).
the string command I used is:

v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc format=point fs=|
'columns='\''x double precision, y double precision, ppm double
precision'\''' x=1 y=2 z=0 cat=0

but I have this error

DBMI-DBF driver error:
SQL parser error in statement:
create table zinc ( cat integer, 'x double precision, y double precision, ppm
double precision' )
Error in db_execute_immediate()

GRASS_INFO_ERROR(5553,1): Cannot create table: create table zinc ( cat
integer, 'x double precision, y double precision, ppm double precision' )

Can anyone tell me why I find this driver DBF error??
Thanks
Pierluigi

--

Pierluigi De Rosa

Department of Enviromental & Civil engineering
Faculty of Engineering
Perugia (Italy)

Alle 15:19, mercoledì 8 marzo 2006, hai scritto:

On 08.03.2006, at 14:47, Pierluig De Rosa wrote:
> My ascii file have three columns (x coordinates, y coordinates,
> ppm value)
> with fields separator "|" (pipe).
> v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc
> format=point fs=|

The | is interpreted by the shell as a pipe command.
Try fs='|' or, better, a different character as field separator (','
or a tab)

I tried fs='|' , but also changing the fields separator i have the same error:
DBMI-DBF driver error:
SQL parser error in statement:
create table zinc ( cat integer, 'x double precision, y double precision, ppm
double precision' )
Error in db_execute_immediate()

ERROR: Cannot create table: create table zinc ( cat integer, 'x double
       precision, y double precision, ppm double precision' )

Flo.

Florian Kindl
Dept. of Geography
University of Innsbruck, Austria

I think the error is in dbf driver error (??) but can anyone tell me more?
--

Pierluigi De Rosa

Department of Enviromental & Civil engineering
Faculty of Engineering
Perugia (Italy)

Hi!
I think your command should look something like this:

v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc format=point
fs=| columns='x double, y double, ppm double' x=1 y=2

I realised that the gui of v.in.ascii usually puts together the command
incorrectly, so I always use the cli to import ascii files.

Regards,
Istvan

On Wed, 2006-03-08 at 14:47 +0100, Pierluig De Rosa wrote:

Dear GRASS users,

I need to import an ascii file into a point vector file, and I'm using
v.in.ascii command.
My ascii file have three columns (x coordinates, y coordinates, ppm value)
with fields separator "|" (pipe).
the string command I used is:

v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc format=point fs=|
'columns='\''x double precision, y double precision, ppm double
precision'\''' x=1 y=2 z=0 cat=0

but I have this error

DBMI-DBF driver error:
SQL parser error in statement:
create table zinc ( cat integer, 'x double precision, y double precision, ppm
double precision' )
Error in db_execute_immediate()

GRASS_INFO_ERROR(5553,1): Cannot create table: create table zinc ( cat
integer, 'x double precision, y double precision, ppm double precision' )

Can anyone tell me why I find this driver DBF error??
Thanks
Pierluigi

I think your command should look something like this:

v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc format=point
fs=| columns='x double, y double, ppm double' x=1 y=2

From the command line yes, but quote the pipe (|).

so if you try:

G6> v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc \
  format=point fs='|' columns='x double, y double, ppm double' x=1 y=2

It should be ok. The shell needs to be protected from special chars
(pipe is the redirect command) and also needs to be told that multiword
answers belong with a single option. The GUI and SQL don't need to be
protected as such.

If you are running from the GUI, you should not quote the pipe (|) or
the column names/types:

SQL parser error in statement:
create table zinc ( cat integer, 'x double precision, y double
precision, ppm double precision' )

The ' before the x and after precision should not be there. You are
quoting too much.

I realised that the gui of v.in.ascii usually puts together the
command incorrectly, so I always use the cli to import ascii files.

How so? If it is broken we can fix it, but I don't think it is broken.

Hamish

About a month ago I started a thread 'v.in.ascii quirk' (Grasslist 10237) and after some backwards and forwards with Maciek Sieczka, he determined that there was a bug (at least one IMO) and forwarded it to the developers list. I've never heard of a resolution. It does seem that this is a fundamental issue for data input and while I can now work with the command, it is probably one of the most syntax sensitive commands for the *nix impaired user to execute.

Stuart Edwards
On Mar 8, 2006, at 5:32 PM, Hamish wrote:

I think your command should look something like this:

v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc format=point
fs=| columns='x double, y double, ppm double' x=1 y=2

From the command line yes, but quote the pipe (|).

so if you try:

G6> v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc \
  format=point fs='|' columns='x double, y double, ppm double' x=1 y=2

It should be ok. The shell needs to be protected from special chars
(pipe is the redirect command) and also needs to be told that multiword
answers belong with a single option. The GUI and SQL don't need to be
protected as such.

If you are running from the GUI, you should not quote the pipe (|) or
the column names/types:

SQL parser error in statement:
create table zinc ( cat integer, 'x double precision, y double
precision, ppm double precision' )

The ' before the x and after precision should not be there. You are
quoting too much.

I realised that the gui of v.in.ascii usually puts together the
command incorrectly, so I always use the cli to import ascii files.

How so? If it is broken we can fix it, but I don't think it is broken.

Hamish

On Thu, 2006-03-09 at 11:32 +1300, Hamish wrote:

> I think your command should look something like this:
>
> v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc format=point
> fs=| columns='x double, y double, ppm double' x=1 y=2

>From the command line yes, but quote the pipe (|).

so if you try:

G6> v.in.ascii input=/home/pierluigi/Desktop/zinc output=zinc \
  format=point fs='|' columns='x double, y double, ppm double' x=1 y=2

It should be ok. The shell needs to be protected from special chars
(pipe is the redirect command) and also needs to be told that multiword
answers belong with a single option. The GUI and SQL don't need to be
protected as such.

If you are running from the GUI, you should not quote the pipe (|) or
the column names/types:

> SQL parser error in statement:
> create table zinc ( cat integer, 'x double precision, y double
> precision, ppm double precision' )

The ' before the x and after precision should not be there. You are
quoting too much.

> I realised that the gui of v.in.ascii usually puts together the
> command incorrectly, so I always use the cli to import ascii files.

How so? If it is broken we can fix it, but I don't think it is broken.

I tried to run import from gui, and it run well, though the generated
command is a bit strange because it qoutes the whole column parameter,
not only the part after the "=" sign:

v.in.ascii input=/home/stefi/Munka/TokolB/terepszint-total-grassba.csv
output=furasok2 format=point fs=| skip=0 'columns=furasjel varchar(10),
x double, y double, mbf double' x=2 y=3 z=0 cat=0

In cli the coulmn parameter should be written like this:
columns='furasjel varchar(10), x double, y double, mbf double'

And I think that the gui is a bit misleeding, because it says for the
column parameters that they should be qouted. But if I qoute them, the
generated command will look like this:
v.in.ascii input=/home/stefi/Munka/TokolB/terepszint-total-grassba.csv
output=furasok3 format=point fs=| skip=0 'columns='\''furasjel
varchar(10), x double, y double, mbf double'\''' x=2 y=3 z=0 cat=0

That's why a lot of people get error when try to import using the gui.

Best regards,
Istvan

On Wed, 8 Mar 2006 18:37:22 -0500
Stuart Edwards <sedwards2@cinci.rr.com> wrote:

About a month ago I started a thread 'v.in.ascii quirk' (Grasslist
10237) and after some backwards and forwards with Maciek Sieczka, he
determined that there was a bug (at least one IMO) and forwarded it
to the developers list.

Yup. Here it is.
http://grass.itc.it/pipermail/grass5/2006-February/021179.html

<snip>

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/