[GRASS-dev] v.in.ascii issues

Hamish hamish_nospam at yahoo.com
Sat Jul 15 06:33:05 EDT 2006


Greetings all,

I just added support to scan dd:mm.mmm format lat/lon strings to libgis,
most GPS units output this way. This change can touch g.region etc, so
I'm not sure if it is worth the risk adding it to the 6.1.0 branch.


Doing this exposed a v.in.ascii bug-like feature- scan type is set to
double for columns which contain DDD:MM:SS data causing a DB insert
error.


if the input lines are like:
  45:15.586S|166:55.207E|-45.25977|166.92012|First Arm|3|First Arm inner

with x=2 and y=1 cat=6, it scans like:
[...]
Maximum input row length: 89
Maximum number of columns: 7
Minimum number of columns: 7
column: 1  type: double
column: 2  type: double
column: 3  type: double
column: 4  type: double
column: 5  type: string  length: 11
column: 6  type: integer
column: 7  type: string  length: 29

(note column 1,2 are scanned as double)

then you get this error:

DBMI-DBF driver error:
SQL parser error in statement:
insert into site_locations values ( [...])
Error in db_execute_immediate()

ERROR: Cannot insert values: insert into site_locations values ( [...])


as it tries to insert a string (45:15.586S) into a double column.

If you define the column types with columns="" you get a warning, but it
imports ok:

[...]
Maximum input row length: 89
Maximum number of columns: 7
Minimum number of columns: 7
column: 1  type: double
column: 2  type: double
column: 3  type: double
column: 4  type: double
column: 5  type: string  length: 11
column: 6  type: integer
column: 7  type: string  length: 29
WARNING: Column 1 defined as string has double values
WARNING: Column 2 defined as string has double values
Building topology ...
[...]


the table is populated correctly with col1,2 string values.


??,
Hamish




More information about the grass-dev mailing list