[GRASS-user] problem parsing rows with nulls in column(s) during
input (was: error importing postgresql db)
Seb
spluque at gmail.com
Tue Jun 2 16:09:21 EDT 2009
Hi again,
I traced one of the problems with my attempts to import vector and
associated attribute tables. I found that if some rows contain null
values for at least one column, then v.in.ascii cannot parse the table
correctly. With an input file as this:
---<--------------------cut here---------------start------------------->---
$ cat /tmp/gmt.XQTuDE/test.dat
sample_id|project|species|sex|flipper_tag|date_time_deployed|claw_marks|mass|body_length|girth|fat_depth|locid|prognum|date_time|class|lon|lat|lon_aea|lat_aea
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27867|01142|2008-8-12 8:28:08|1|-63.076|58.448|-4.44|22.06
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27868|01142|2008-8-12 9:41:28|A|-63.101|58.431|-5.90|20.17
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27869|01142|2008-8-12 11:22:01|A|-63.086|58.407|-5.03|17.49
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27870|01142|2008-8-12 11:48:25|2|-63.086|58.413|-5.03|18.16
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27871|01142|2008-8-12 12:58:22|B|-63.119|58.463|-6.94|23.74
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27872|01142|2008-8-12 13:39:50|0|-63.106|58.428|-6.19|19.84
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27873|01142|2008-8-12 13:51:36|B|-63.067|58.398|-3.92|16.49
AGB-08-0001|Fjord|Ph|male|1316|2008-8-11 18:30:00||25|90|82.5||27874|01142|2008-8-12 14:54:49|A|-63.061|58.442|-3.56|21.39
---<--------------------cut here---------------end--------------------->---
Note the empty columns 7 and 11 for all rows. v.in.ascii produces this
error:
---<--------------------cut here---------------start------------------->---
v.in.ascii in=/tmp/gmt.XQTuDE/test.dat out=test skip=1 x=18 y=19 cat=12 --o --v
Scanning input for column types...
Maximum input row length: 159
Maximum number of columns: 19
Minimum number of columns: 19
Column: 1 type: string length: 11
Column: 2 type: string length: 5
Column: 3 type: string length: 2
Column: 4 type: string length: 4
Column: 5 type: integer
Column: 6 type: string length: 18
Column: 7 type: string length: 0
Column: 8 type: integer
Column: 9 type: integer
Column: 10 type: double
Column: 11 type: string length: 0
Column: 12 type: integer
Column: 13 type: integer
Column: 14 type: string length: 18
Column: 15 type: string length: 1
Column: 16 type: double
Column: 17 type: double
Column: 18 type: double
Column: 19 type: double
Importing points...
Populating table...
dbmi: Protocol error
Building topology for vector map <test>...
Registering primitives...
8 primitives registered
8 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Topology was built
Number of nodes: 8
Number of primitives: 8
Number of points: 8
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.in.ascii complete.
---<--------------------cut here---------------end--------------------->---
The error only occurs if the null values are present.
Cheers,
--
Seb
More information about the grass-user
mailing list