[GRASSLIST:195] trouble using v.in.ascii

Hi all,

I’m trying to bring in a comma separated text file as a point vector file in GRASS using v.in.ascii, before i try to link it to a large 33Mb dbf data file.

The csv file looks like this with 39 rows and i removed the header because grass60 (on Ubuntu breezy) does not have the skip option in the v.in.ascii command: the columns are WMOID, cityname, Latitude and Longitude. I want to use the WMOID as ‘cat’ in order to link my dbf data later.

420710,AMRITSAR,31.63,74.86
421010,PATIALA,30.33,76.46
421310,HISSAR,29.16,75.73
421820,DELHI,28.58,77.20
423390,JODHPUR,26.30,73.01
423480,JAIPUR,26.81,75.80
423690,LUCKNOW,26.75,80.88
424100,GAUHATI,26.10,91.58

I Tried the following command and got the error:

cat reformat/STATIONS2.dat | v.in.ascii output=stations2 fs=‘,’ columns=‘cat int, name(varchar(30), y double, x double’ x=4 y=3 cat=1
WARNING: DOS text format found, attempting import anyway
Maximum input row length: 39
Maximum number of columns: 4
Minimum number of columns: 4
column: 1 type: integer
column: 2 type: string length: 18
column: 3 type: double
column: 4 type: double
DBMI-DBF driver error:
SQL parser error in statement:
create table stations2 ( cat int, name(varchar(30), x double, y double )
Error in db_execute_immediate()

ERROR: Cannot create table: create table stations2 ( cat int,
name(varchar(30), x double, y double )

I also get the same error with

v.in.ascii input=reformat/STATIONS.csv output=gstations fs=‘,’ skip=1 columns=‘cat int, label(varchar(30), y double, x double’ x=4 y=3 cat=1

help!
vishal

www.people.cornell.edu/pages/vkm2

On Fri, 2006-03-17 at 11:30 +0530, Vishal Mehta wrote:

Hi all,

I'm trying to bring in a comma separated text file as a point vector
file in GRASS using v.in.ascii, before i try to link it to a large
33Mb dbf data file.

The csv file looks like this with 39 rows and i removed the header
because grass60 (on Ubuntu breezy) does not have the skip option in
the v.in.ascii command: the columns are WMOID, cityname, Latitude and
Longitude. I want to use the WMOID as 'cat' in order to link my dbf
data later.

420710,AMRITSAR,31.63,74.86
421010,PATIALA,30.33,76.46
421310,HISSAR,29.16,75.73
421820,DELHI,28.58,77.20
423390,JODHPUR,26.30,73.01
423480,JAIPUR,26.81,75.80
423690,LUCKNOW,26.75,80.88
424100,GAUHATI,26.10,91.58

I Tried the following command and got the error:

cat reformat/STATIONS2.dat | v.in.ascii output=stations2 fs=','
columns='cat int, name(varchar(30), y double, x double' x=4 y=3 cat=1
WARNING: DOS text format found, attempting import anyway
Maximum input row length: 39
Maximum number of columns: 4
Minimum number of columns: 4
column: 1 type: integer
column: 2 type: string length: 18
column: 3 type: double
column: 4 type: double
DBMI-DBF driver error:
SQL parser error in statement:
create table stations2 ( cat int, name(varchar(30), x double, y
double )
Error in db_execute_immediate()

ERROR: Cannot create table: create table stations2 ( cat int,
       name(varchar(30), x double, y double )

I also get the same error with

v.in.ascii input=reformat/STATIONS.csv output=gstations fs=',' skip=1
columns='cat int, label(varchar(30), y double, x double' x=4 y=3 cat=1

There is an additional "(" sign in your columns definition. You should
write columns='cat int, label varchar(30), y double, x double'.
The other problem maybe that your file is in MSDOS format, but it could
be that it doesn't bother Grass. Try to use dos2unix command to convert
it to unix format.

Regards,
Istvan

Breezy also has the "flip" command (search synaptic) for converting
line endings.

-David

On 3/16/06, Stefan Istvan <stefi@geohidroterv.hu> wrote:

On Fri, 2006-03-17 at 11:30 +0530, Vishal Mehta wrote:
> Hi all,
>
> I'm trying to bring in a comma separated text file as a point vector
> file in GRASS using v.in.ascii, before i try to link it to a large
> 33Mb dbf data file.
>
> The csv file looks like this with 39 rows and i removed the header
> because grass60 (on Ubuntu breezy) does not have the skip option in
> the v.in.ascii command: the columns are WMOID, cityname, Latitude and
> Longitude. I want to use the WMOID as 'cat' in order to link my dbf
> data later.
>
> 420710,AMRITSAR,31.63,74.86
> 421010,PATIALA,30.33,76.46
> 421310,HISSAR,29.16,75.73
> 421820,DELHI,28.58,77.20
> 423390,JODHPUR,26.30,73.01
> 423480,JAIPUR,26.81,75.80
> 423690,LUCKNOW,26.75,80.88
> 424100,GAUHATI,26.10,91.58
>
> I Tried the following command and got the error:
>
> cat reformat/STATIONS2.dat | v.in.ascii output=stations2 fs=','
> columns='cat int, name(varchar(30), y double, x double' x=4 y=3 cat=1
> WARNING: DOS text format found, attempting import anyway
> Maximum input row length: 39
> Maximum number of columns: 4
> Minimum number of columns: 4
> column: 1 type: integer
> column: 2 type: string length: 18
> column: 3 type: double
> column: 4 type: double
> DBMI-DBF driver error:
> SQL parser error in statement:
> create table stations2 ( cat int, name(varchar(30), x double, y
> double )
> Error in db_execute_immediate()
>
> ERROR: Cannot create table: create table stations2 ( cat int,
> name(varchar(30), x double, y double )
>
> I also get the same error with
>
> v.in.ascii input=reformat/STATIONS.csv output=gstations fs=',' skip=1
> columns='cat int, label(varchar(30), y double, x double' x=4 y=3 cat=1
>
There is an additional "(" sign in your columns definition. You should
write columns='cat int, label varchar(30), y double, x double'.
The other problem maybe that your file is in MSDOS format, but it could
be that it doesn't bother Grass. Try to use dos2unix command to convert
it to unix format.

Regards,
Istvan

--
David Finlayson

Hi all,

ok i was able to get the points vector file done- silly syntax mistake on my part-sorry.
But i could use some input on my attempts to connect my data dbf file to the vector points file as layer 2.

What i did is, that i prepared a dbf file in Windows, then brought it into my /dbf folder in Linux/Grass. Now this file is recognized when i do db.describe(below):

GRASS 6.0.1 (ncdc):~/Desktop/NCDC > db.describe -c Data
ncols:11
Column 1: WMOID
Column 2: CITY
Column 3: YEAR
Column 4: YDAY
Column 5: TMAX
Column 6: TMIN
Column 7: TDAY
Column 8: RAIN
Column 9: VPD
Column 10: SRAD
Column 11: DAYLEN

BUT, the column ‘WMOID’ which i want to use as key, has suddenly become float (it was integer when i made it in windows), and in fact all numeric columns are assigned double precision now when they were not originally. How do i rectify this, since to identify a key tolink my vector points to this data file, the key column should be integer?

I dont know postgresql, mysql etc, therefore i’m trying things this way…

thanks,
vishal

On 3/17/06, David Finlayson <david.p.finlayson@gmail.com> wrote:

Breezy also has the “flip” command (search synaptic) for converting
line endings.

-David

On 3/16/06, Stefan Istvan <stefi@geohidroterv.hu> wrote:

On Fri, 2006-03-17 at 11:30 +0530, Vishal Mehta wrote:

Hi all,

I’m trying to bring in a comma separated text file as a point vector
file in GRASS using v.in.ascii , before i try to link it to a large
33Mb dbf data file.

The csv file looks like this with 39 rows and i removed the header
because grass60 (on Ubuntu breezy) does not have the skip option in
the v.in.ascii command: the columns are WMOID, cityname, Latitude and
Longitude. I want to use the WMOID as ‘cat’ in order to link my dbf
data later.

420710,AMRITSAR, 31.63,74.86
421010,PATIALA,30.33,76.46
421310,HISSAR,29.16,75.73
421820,DELHI,28.58,77.20
423390,JODHPUR,26.30,73.01
423480,JAIPUR,26.81,75.80
423690,LUCKNOW, 26.75,80.88
424100,GAUHATI,26.10,91.58

I Tried the following command and got the error:

cat reformat/STATIONS2.dat | v.in.ascii output=stations2 fs=‘,’
columns=‘cat int, name(varchar(30), y double, x double’ x=4 y=3 cat=1
WARNING: DOS text format found, attempting import anyway
Maximum input row length: 39
Maximum number of columns: 4
Minimum number of columns: 4
column: 1 type: integer
column: 2 type: string length: 18
column: 3 type: double
column: 4 type: double
DBMI-DBF driver error:
SQL parser error in statement:
create table stations2 ( cat int, name(varchar(30), x double, y
double )
Error in db_execute_immediate()

ERROR: Cannot create table: create table stations2 ( cat int,
name(varchar(30), x double, y double )

I also get the same error with

v.in.ascii input=reformat/STATIONS.csv output=gstations fs=‘,’ skip=1
columns=‘cat int, label(varchar(30), y double, x double’ x=4 y=3 cat=1

There is an additional “(” sign in your columns definition. You should
write columns=‘cat int, label varchar(30), y double, x double’.
The other problem maybe that your file is in MSDOS format, but it could
be that it doesn’t bother Grass. Try to use dos2unix command to convert
it to unix format.

Regards,
Istvan


David Finlayson

The other problem maybe that your file is in MSDOS format, but it
could be that it doesn't bother Grass. Try to use dos2unix command to
convert it to unix format.

GRASS (6.1-cvs anyway) can handle UNIX, DOS, and Mac OS9 newlines.
There might be a few places left where it doesn't, if you find one
report it as a bug. In the source code: lib/gis/getl.c G_getl2()

Hamish