[GRASSLIST:9503] dbf - v.in.ascii import

hi to all,
I have a problem with importing ascii points into grass:
I need to import a vector ascii map into grass, grass is connected to a
.dbf database. Following the manpage, it seems that the v.in.ascii
command is the same whatever is the database I want to connect to, so I
type:

#############################################
v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab columns='cat integer, x double precision, y double precision, cdp_number varchar(20), line_name varchar(20), acquisition_year varchar(20)' x=2 y=3 cat=1
#############################################

but I get:
#############################################
DBMI-DBF driver error:
Incompatible value type.
Error in db_execute_immediate()

ERROR: Cannot insert values: insert into prova_ar_dbf values ( 1,
       11.919589, 43.679116, 101, 'ar315', 1981)
GRASS 6.0.1 (fogli_geo):~ >
#############################################

I think it is related to the names that I want for the columns of the
table, but I can't see what to do.

can someone help??

cheers,
Francesco

On Thu, Dec 15, 2005 at 02:06:45PM +0100, Francesco Mirabella wrote:

hi to all,
I have a problem with importing ascii points into grass:
I need to import a vector ascii map into grass, grass is connected to a
.dbf database. Following the manpage, it seems that the v.in.ascii
command is the same whatever is the database I want to connect to, so I
type:

#############################################
v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab columns='cat integer, x double precision, y double precision, cdp_number varchar(20), line_name varchar(20), acquisition_year varchar(20)' x=2 y=3 cat=1
#############################################

but I get:
#############################################
DBMI-DBF driver error:
Incompatible value type.
Error in db_execute_immediate()

ERROR: Cannot insert values: insert into prova_ar_dbf values ( 1,
       11.919589, 43.679116, 101, 'ar315', 1981)

I think that cdp_number and acquisition_year are of integer type, not varchar.
At least they are not quoted.

Markus

GRASS 6.0.1 (fogli_geo):~ >
#############################################

I think it is related to the names that I want for the columns of the
table, but I can't see what to do.

can someone help??

cheers,
Francesco

> .dbf database. Following the manpage, it seems that the v.in.ascii
> command is the same whatever is the database I want to connect to, so I
> type:
>
> #############################################
> v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab columns='cat integer, x double precision, y double precision, cdp_number varchar(20), line_name varchar(20), acquisition_year varchar(20)' x=2 y=3 cat=1
> #############################################
>
> but I get:
> #############################################
> DBMI-DBF driver error:
> Incompatible value type.
> Error in db_execute_immediate()
>
> ERROR: Cannot insert values: insert into prova_ar_dbf values ( 1,
> 11.919589, 43.679116, 101, 'ar315', 1981)

I think that cdp_number and acquisition_year are of integer type, not varchar.
At least they are not quoted.

Markus

I tried with integer, but I get the same error....

Francesco

> GRASS 6.0.1 (fogli_geo):~ >
> #############################################
>
> I think it is related to the names that I want for the columns of the
> table, but I can't see what to do.
>
> can someone help??
>
> cheers,
> Francesco
>

Hi again to all,
looking up in the web at:

http://article.gmane.org/gmane.comp.gis.grass.devel/6655/match=v+in+ascii+dbf
http://article.gmane.org/gmane.comp.gis.grass.devel/8073/match=v+in+ascii+dbf

I found the same problem described below, can someone say if and how it
was solved?

many thanks to all of you,
cheers
Francesco

On Thu, Dec 15, 2005 at 02:06:45PM +0100, Francesco Mirabella wrote:
> hi to all,
> I have a problem with importing ascii points into grass:
> I need to import a vector ascii map into grass, grass is connected to a
> .dbf database. Following the manpage, it seems that the v.in.ascii
> command is the same whatever is the database I want to connect to, so I
> type:
>
> #############################################
> v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab columns='cat integer, x double precision, y double precision, cdp_number varchar(20), line_name varchar(20), acquisition_year varchar(20)' x=2 y=3 cat=1
> #############################################
>
> but I get:
> #############################################
> DBMI-DBF driver error:
> Incompatible value type.
> Error in db_execute_immediate()
>
> ERROR: Cannot insert values: insert into prova_ar_dbf values ( 1,
> 11.919589, 43.679116, 101, 'ar315', 1981)

I think that cdp_number and acquisition_year are of integer type, not varchar.
At least they are not quoted.

Markus

> GRASS 6.0.1 (fogli_geo):~ >
> #############################################
>
> I think it is related to the names that I want for the columns of the
> table, but I can't see what to do.
>
> can someone help??
>
> cheers,
> Francesco
>

--
**********************************************
Francesco Mirabella,
Structural Geology and Geophysics
address: University of Perugia,
Dipartimento di Scienze della Terra
Piazza Universita', 1 06100 Perugia (Italy)
tel: ++39.(0)75.585 2651
fax: ++39.(0)75.585 2603
e-mail: mirabell@unipg.it
web: http://www.unipg.it/~mirabell/
**********************************************

I found the same problem described below, can someone say if and how
it was solved?

..

> > I have a problem with importing ascii points into grass:
> > I need to import a vector ascii map into grass, grass is connected
> > to a .dbf database. Following the manpage, it seems that the
> > v.in.ascii command is the same whatever is the database I want to
> > connect to, so I type:
> >
> > #############################################
> > v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab
> > columns='cat integer, x double precision, y double precision,
> > cdp_number varchar(20), line_name varchar(20), acquisition_year
> > varchar(20)' x=2 y=3 cat=1
> > #############################################
> >
> > but I get:
> > #############################################
> > DBMI-DBF driver error:
> > Incompatible value type.
> > Error in db_execute_immediate()
> >
> > ERROR: Cannot insert values: insert into prova_ar_dbf values ( 1,
> > 11.919589, 43.679116, 101, 'ar315', 1981)
>
> I think that cdp_number and acquisition_year are of integer type,
> not varchar. At least they are not quoted.

try:

v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab x=2 y=3 cat=1 \
  columns='cat integer, x double, y double, cdp_number integer, line_name varchar(20), acquisition_year integer'

i.e. change varchar() to integer in the integer only columns. I had
thought that Radim had modified v.in.ascii to let column types defined
in columns= override what was scanned. Maybe not, or maybe this is only
in the 6.1 development branch.

Hamish

Thanks Hamish and list,

that worked, I previously tried INT4, thinking that it was the same, but
it is not.

Now it looks ok
cheers,
Francesco

On Sat, Dec 17, 2005 at 12:25:55AM +1300, Hamish wrote:

> I found the same problem described below, can someone say if and how
> it was solved?
..
> > > I have a problem with importing ascii points into grass:
> > > I need to import a vector ascii map into grass, grass is connected
> > > to a .dbf database. Following the manpage, it seems that the
> > > v.in.ascii command is the same whatever is the database I want to
> > > connect to, so I type:
> > >
> > > #############################################
> > > v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab
> > > columns='cat integer, x double precision, y double precision,
> > > cdp_number varchar(20), line_name varchar(20), acquisition_year
> > > varchar(20)' x=2 y=3 cat=1
> > > #############################################
> > >
> > > but I get:
> > > #############################################
> > > DBMI-DBF driver error:
> > > Incompatible value type.
> > > Error in db_execute_immediate()
> > >
> > > ERROR: Cannot insert values: insert into prova_ar_dbf values ( 1,
> > > 11.919589, 43.679116, 101, 'ar315', 1981)
> >
> > I think that cdp_number and acquisition_year are of integer type,
> > not varchar. At least they are not quoted.

try:

v.in.ascii input=ascii_file.txt output=prova_dbf fs=tab x=2 y=3 cat=1 \
  columns='cat integer, x double, y double, cdp_number integer, line_name varchar(20), acquisition_year integer'

i.e. change varchar() to integer in the integer only columns. I had
thought that Radim had modified v.in.ascii to let column types defined
in columns= override what was scanned. Maybe not, or maybe this is only
in the 6.1 development branch.

Hamish

--
**********************************************
Francesco Mirabella,
Structural Geology and Geophysics
address: University of Perugia,
Dipartimento di Scienze della Terra
Piazza Universita', 1 06100 Perugia (Italy)
tel: ++39.(0)75.585 2651
fax: ++39.(0)75.585 2603
e-mail: mirabell@unipg.it
web: http://www.unipg.it/~mirabell/
**********************************************