Opened 14 years ago

Closed 13 years ago

#1159 closed defect (fixed)

v.in.ascii points import fails in WinGRASS-6.4.0-1

Reported by: Luigi Ponti Owned by: grass-dev@…
Priority: blocker Milestone: 6.4.1
Component: Vector Version: 6.4.0
Keywords: v.in.ascii Cc:
CPU: x86-32 Platform: MSWindows 7

Description

My settings: WinGRASS-6.4.0-1 on Windows 7. Performing example v.in.ascii task showed in manual:

v.in.ascii input=coords.txt output=mymap

works fine in Spearfish location.

Using this text file: https://docs.google.com/leaf?id=0B0EpsfMZ-IZYNGZlNWZkMWEtNzhiNS00OGRiLTgyNzctYzk4ODUxODk1NzI1&sort=name&layout=list&num=50

in a latlong location with the following command:

v.in.ascii input=C:\cygwin\home\andy\models_temp\Bloomday_Olive_11set10_Avg output=test_US_import fs=\t

yields an error:

v.in.ascii input=C:\cygwin\home\andy\models_temp\Bloomday_Olive_11set10_Avg output=test_US_import fs=\t
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Importando punti ...
Populating table...
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes  

Trying same test with an old (May 29) WinGRASS-6.4.svn installed on the same machine (same command), everything seems ok:

v.in.ascii --overwrite input=C:\cygwin\home\andy\models_temp\Bloomday_Olive_11set10_Avg output=test_US_import fs=\t
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Importando punti ...
Populating table...
Building topology for vector map <test_US_import>...
Registering primitives...
   10001157 primitives registered
1157 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 1154
Number of primitives: 1157
Number of points: 1157
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.in.ascii completo.

Change History (22)

in reply to:  description comment:1 by hellik, 14 years ago

Replying to lponti:

I've tried this with the nc-sample-dataset in a WinVista32-box with the WinGrass64-installer:

=> point mode

v.out.ascii --verbose input=firestations@PERMANENT output=C:\wd\grassascii\pointmodeout.txt dp=4 columns=LOCATION,CITY
v.in.ascii -n --verbose input=C:\wd\grassascii\pointmodeout.txt output=testvascii_import
BUG in description, Option 'point' in <format> doesn't exist.
BUG in descriptions, Option 'Standard' in <format> doesn't exist.
Scanne die Eingabe zur Ermittelung der Spaltentypen...
Maximale Länge der Inputzeile: 69
Maximale Anzahl der Spalten: 5
Minimale Anzahl der Spalten: 5
Column: 1  type: double
Column: 2  type: double
Column: 3  type: integer
Column: 4  type: string length: 30
Column: 5  type: string length: 13
Importiere Punkte...
Fülle Tabelle...
ERROR: Could not close attribute table. DBMI-driver doesn't accept all attributes.

the message above is partly translated from german to english.

and with DEEBUG=3

v.in.ascii -n --verbose input=C:\wd\grassascii\pointmodeout.txt output=testvascii_import2
BUG in Beschreibungen, Option 'Punkt' in <format> existiert nicht.
BUG in Beschreibungen, Option 'Standard' in <format> existiert nicht.
D2/3: Vect_open_new(): name = testvascii_import2
D1/3: Vect_set_thresh(): thresh = 0.000000
D1/3: V1_open_new_nat(): name = testvascii_import2
D1/3: Vect_get_thresh(): thresh = 0.000000
D1/3: dig__write_head()
D1/3: write coor size (0) to head
D2/3: coor body offset 14
D3/3: dig_init_plus()
D1/3: dig_spidx_init()
D3/3: dig_cidx_init()
D3/3: Vect_hist_command()
D3/3: G_recreate_command()
Scanne die Eingabe zur Ermittelung der Spaltentypen...
D2/3: G__read_Cell_head
D2/3: G__read_Cell_head_array
D3/3: region item: proj:       99
D3/3: region item: zone:       0
D3/3: region item: north:      228513
D3/3: region item: south:      214975.5
D3/3: region item: east:       645012
D3/3: region item: west:       629992.5
D3/3: region item: cols:       527
D3/3: region item: rows:       475
D3/3: region item: e-w resol:  28.5
D3/3: region item: n-s resol:  28.5
D3/3: region item: top:        1
D3/3: region item: bottom:     0
D3/3: region item: cols3:      527
D3/3: region item: rows3:      475
D3/3: region item: depths:     1
D3/3: region item: e-w resol3: 28.5
D3/3: region item: n-s resol3: 28.5
D3/3: region item: t-b resol:  1
D3/3: row 1 : 68 chars
D3/3: row 2 : 66 chars
D3/3: row 3 : 56 chars
D3/3: row 4 : 47 chars
D3/3: row 5 : 56 chars
D3/3: row 6 : 55 chars
D3/3: row 7 : 45 chars
D3/3: row 8 : 49 chars
D3/3: row 9 : 46 chars
D3/3: row 10 : 48 chars
D3/3: row 11 : 49 chars
D3/3: row 12 : 48 chars
D3/3: row 13 : 48 chars
D3/3: row 14 : 50 chars
D3/3: row 15 : 49 chars
D3/3: row 16 : 52 chars
D3/3: row 17 : 58 chars
D3/3: row 18 : 53 chars
D3/3: row 19 : 51 chars
D3/3: row 20 : 52 chars
D3/3: row 21 : 52 chars
D3/3: row 22 : 46 chars
D3/3: row 23 : 48 chars
D3/3: row 24 : 53 chars
D3/3: row 25 : 47 chars
D3/3: row 26 : 49 chars
D3/3: row 27 : 51 chars
D3/3: row 28 : 50 chars
D3/3: row 29 : 48 chars
D3/3: row 30 : 53 chars
D3/3: row 31 : 51 chars
D3/3: row 32 : 52 chars
D3/3: row 33 : 50 chars
D3/3: row 34 : 49 chars
D3/3: row 35 : 56 chars
D3/3: row 36 : 50 chars
D3/3: row 37 : 53 chars
D3/3: row 38 : 52 chars
D3/3: row 39 : 62 chars
D3/3: row 40 : 53 chars
D3/3: row 41 : 57 chars
D3/3: row 42 : 57 chars
D3/3: row 43 : 51 chars
D3/3: row 44 : 51 chars
D3/3: row 45 : 49 chars
D3/3: row 46 : 46 chars
D3/3: row 47 : 52 chars
D3/3: row 48 : 50 chars
D3/3: row 49 : 51 chars
D3/3: row 50 : 59 chars
D3/3: row 51 : 56 chars
D3/3: row 52 : 56 chars
D3/3: row 53 : 53 chars
D3/3: row 54 : 56 chars
D3/3: row 55 : 52 chars
D3/3: row 56 : 51 chars
D3/3: row 57 : 48 chars
D3/3: row 58 : 51 chars
D3/3: row 59 : 49 chars
D3/3: row 60 : 59 chars
D3/3: row 61 : 47 chars
D3/3: row 62 : 57 chars
D3/3: row 63 : 55 chars
D3/3: row 64 : 58 chars
D3/3: row 65 : 61 chars
D3/3: row 66 : 54 chars
D3/3: row 67 : 51 chars
D3/3: row 68 : 50 chars
D3/3: row 69 : 32 chars
D3/3: row 70 : 59 chars
D3/3: row 71 : 60 chars
Maximale Länge der Inputzeile: 69
Maximale Anzahl der Spalten: 5
Minimale Anzahl der Spalten: 5
D1/3: Vect_default_field_info(): map = testvascii_import2
field = 1
D2/3: drv = dbf db = $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
D3/3: Vect_subst_var(): in =
$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/, map =
testvascii_import2, mapset = user1
D3/3:   -> C:\gisdata\grassdata/nc_spm_08/user1/dbf/
D3/3: db_start_driver_open_database():
  drvname = dbf, dbname =
C:\gisdata\grassdata/nc_spm_08/user1/dbf/
D2/3: dbDbmscap(): opendir [c:\Program
Files\GRASS-64\driver\db\]
D3/3: win_spawn: args = C:\windows\system32\cmd.exe /c
""c:\Program Files\GRASS-64\driver\db\dbf.exe""
D2/3: DBF: db__driver_open_database() name =
'C:\gisdata\grassdata/nc_spm_08/user1/dbf/'
D2/3: db.name = C:\gisdata\grassdata/nc_spm_08/user1/dbf/
D2/3: add_table(): table = helli name = helli.dbf
D2/3: add_table(): table = testvascii_import name =
testvascii_import.dbf
D2/3: Begin transaction
Column: 1  type: double
Column: 2  type: double
Column: 3  type: integer
Column: 4  type: string length: 30
Column: 5  type: string length: 13
D3/3: Field number <1>, name <(null)>
D3/3: Vect_check_dblink: field 1
D1/3: Vect_write_dblinks(): map = testvascii_import2, mapset
= user1
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/user1/vector
/testvascii_import2/dbln
D1/3: 1 testvascii_import2 cat
$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/3: Dblinks written
D3/3: create table testvascii_import2 ( cat integer, dbl_1
double precision, dbl_2 double precision, int_1 integer,
str_1 varchar(30), str_2 varchar(13) )
D3/3: SQL statement parsed successfully: create table
testvascii_import2 ( cat integer, dbl_1 double precision,
dbl_2 double precision, int_1 integer, str_1 varchar(30),
str_2 varchar(13) )
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D3/3: Doing SQL command <1> on DBF table... (see
include/sqlp.h)
D2/3: add_table(): table = testvascii_import2 name =
testvascii_import2.dbf
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D3/3: add_column(): tab = 2, type = 2, name = cat, width =
11, decimals = 0
D3/3: add_column(): tab = 2, type = 3, name = dbl_1, width =
20, decimals = 6
D3/3: add_column(): tab = 2, type = 3, name = dbl_2, width =
20, decimals = 6
D3/3: add_column(): tab = 2, type = 2, name = int_1, width =
11, decimals = 0
D3/3: add_column(): tab = 2, type = 1, name = str_1, width =
30, decimals = 0
D3/3: add_column(): tab = 2, type = 1, name = str_2, width =
13, decimals = 0
D1/3: Vect_write_dblinks(): map = testvascii_import2, mapset
= user1
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/user1/vector
/testvascii_import2/dbln
D1/3: Dblinks written
D3/3: Field number <1>, name <(null)>
D3/3: Vect_check_dblink: field 1
D1/3: Vect_write_dblinks(): map = testvascii_import2, mapset
= user1
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/user1/vector
/testvascii_import2/dbln
D1/3: 1 testvascii_import2 cat
$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/3: Dblinks written
Importiere Punkte...
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 1,
620856.9586, 230066.3831, 1, '6804 Carpenter Fire Station
Rd', 'Morrisville')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 1, 620856.9586, 230066.3831, 1,
'6804 Carpenter Fire Station Rd', 'Morrisville')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 2,
625331.9186, 229990.8216, 2, '100 Morrisville-Carpenter Rd',
'Morrisville')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 2, 625331.9186, 229990.8216, 2,
'100 Morrisville-Carpenter Rd', 'Morrisville')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 3,
615797.6655, 213363.9926, 3, '3045 New Hill Holleman Rd',
'Apex')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 3, 615797.6655, 213363.9926, 3,
'3045 New Hill Holleman Rd', 'Apex')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 4,
623113.7142, 219859.0622, 4, '210 N. Salem St.', 'Apex')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 4, 623113.7142, 219859.0622, 4,
'210 N. Salem St.', 'Apex')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 5,
627926.2843, 203208.6161, 5, '301 S. Fuquay Av', 'Fuquay-
Varina')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 5, 627926.2843, 203208.6161, 5,
'301 S. Fuquay Av', 'Fuquay-Varina')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 6,
634666.6648, 207474.4939, 6, '5617 Hilltop Rd', 'Fuquay-
Varina')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 6, 634666.6648, 207474.4939, 6,
'5617 Hilltop Rd', 'Fuquay-Varina')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 7, 642099.61,
208679.4695, 7, '9115 Sauls Rd', 'Raleigh')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 7, 642099.61, 208679.4695, 7,
'9115 Sauls Rd', 'Raleigh')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 8,
636078.5716, 213276.0477, 8, '7401 Ten-Ten Rd', 'Raleigh')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 8, 636078.5716, 213276.0477, 8,
'7401 Ten-Ten Rd', 'Raleigh')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 9,
630420.5003, 215694.0281, 9, '4501 Ten-Ten Rd', 'Apex')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 9, 630420.5003, 215694.0281, 9,
'4501 Ten-Ten Rd', 'Apex')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 10,
627041.5491, 224084.2533, 10, '1401 Old Apex Rd', 'Cary')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 10, 627041.5491, 224084.2533,
10, '1401 Old Apex Rd', 'Cary')
D2/3: find_table(): table = testvascii_import2
[...]
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D3/3: Vect_write_line(): name = testvascii_import2, format =
0, level = 1
D3/3: insert into testvascii_import2 values ( 71,
623658.6433, 209478.2433, 71, '1140 Avent Ferry Rd', 'Holly
Springs')
D3/3: SQL statement parsed successfully: insert into
testvascii_import2 values ( 71, 623658.6433, 209478.2433,
71, '1140 Avent Ferry Rd', 'Holly Springs')
D2/3: find_table(): table = testvascii_import2
D2/3:   ? helli
D2/3:   ? testvascii_import
D2/3:   ? testvascii_import2
D2/3: load_table_head(): tab = 2, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//testvascii_import2.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 2
D2/3: Commit transaction
D2/3: save_table 0
D2/3: save_table 1
D2/3: save_table 2
D2/3: Write table to tempfile:
'C:\gisdata\grassdata/nc_spm_08/user1/.tmp/6896.dbf'
D2/3: Write 71 rows
D2/3: Written 71 records
Fülle Tabelle...
ERROR: Konnte Attributetabelle nicht schliessen. Der DBMI-Treiber hat nicht alle Attribute akzeptiert.

Helmut

comment:2 by hamish, 14 years ago

[file is 3 column 'x y fp_value', with CRLF newlines]

tested in 6.4.0svn and 6.5svn on linux, works fine there.

v.in.ascii in=Bloomday_Olive_11set10_Avg.dat fs=tab out=test_US_import

(only thing I changed was 'fs=tab'; I think it is good to explicitly give x= and y=..)

does it work if you switch to the SQLite DB backend? (see db.connect module help page)

what if you add "columns='x double, y double, value varchar(20)'" ?

or "-z z=3" ? (but no columns= to avoid creating a table at all)

Helmut:

BUG in description, Option 'point' in <format> doesn't exist.
BUG in descriptions, Option 'Standard' in <format> doesn't exist.

I suspect this is because somewhere the options got translated as well as the option descriptions: (??)

v.in.ascii/in.c:

format_opt->descriptions = _("point;simple x,y[,z] list;"
                             "standard;GRASS vector ASCII format");

"point" and "standard" must match exactly the line:

 format_opt->options = "point,standard"

Hamish

in reply to:  2 comment:3 by Luigi Ponti, 14 years ago

Replying to hamish:

[...] I think it is good to explicitly give x= and y=..

Right, I forgot that. For sake of completeness, it does not help in this case:

v.in.ascii input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 z=0
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Importando punti ...
Populating table...
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes

Neither does specifying column type:

v.in.ascii input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 z=0 columns='x double, y double, value varchar(20)'
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Column number 3 <value> defined as string has double values
Importando punti ...
Populating table...
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes

Same with third column as double:

v.in.ascii input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 z=0 columns='x double, y double, value double'
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Importando punti ...
Populating table...
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes

does it work if you switch to the SQLite DB backend?

db.connect driver=sqlite database=$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db    
                                            
db.connect -p                                                                   
driver:sqlite
database:$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db
schema:
group:

This does not work:

v.in.ascii input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 z=0
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Importando punti ...
Populating table...
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes

nor does this:

v.in.ascii input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 z=0 columns=x double, y double, value varchar(20)
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Column number 3 <value> defined as string has double values
Importando punti ...
Populating table...
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes

or this:

v.in.ascii input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 z=0 columns=x double, y double, value double
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1  type: double
Column: 2  type: double
Column: 3  type: double
Importando punti ...
Populating table...
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes

Note: the --overwrite flag does not work because of Ticket #1158, so after each v.in.ascii one needs to run g.remove twice on output file.

what if you add "columns='x double, y double, value varchar(20)'" ?

See above.

or "-z z=3" ? (but no columns= to avoid creating a table at all)

This works in sqlite (but no table, as you said):

v.in.ascii input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 -z z=3
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Importando punti ...
Building topology for vector map <test_US_import>...
Registering primitives...
   10001157 primitives registered
1157 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 1156
Number of primitives: 1157
Number of points: 1157
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.in.ascii completo.
(Wed Sep 15 10:19:46 2010) Command finished (0 sec)                    

and with dbf (surprisingly the --overwrite flag works):

v.in.ascii --overwrite input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab x=1 y=2 -z z=3
Vector map <test_US_import> already exists and will be overwritten
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 3
Minimum number of columns: 3
Importando punti ...
Building topology for vector map <test_US_import>...
Registering primitives...
   10001157 primitives registered
1157 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 1156
Number of primitives: 1157
Number of points: 1157
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.in.ascii completo.

Sounds like the table is the problem?

Regards,

Luigi

comment:4 by hamish, 14 years ago

The error message in question is from v.in.ascii/in.c,

if (driver) {
    G_message(_("Populating table..."));
    db_commit_transaction(driver);
    if(db_close_database_shutdown_driver(driver) == DB_FAILED)
        G_fatal_error(_("Could not close attribute table. The DBMI driver did not accept all attributes"));
}

db_close_database_shutdown_driver() can be found in lib/db/dbmi_client/db.c

it is not clear from the code which failed, closing the database or shutting down the driver. I'll add debug messages to tell that, maybe later today.

Hamish

comment:5 by hamish, 14 years ago

level 2 debug messages added to db_close_database_shutdown_driver() in trunk and devbr6

in reply to:  5 comment:6 by hellik, 14 years ago

Replying to hamish:

level 2 debug messages added to db_close_database_shutdown_driver() in trunk and devbr6

tested with a self compiled Grass65 in the Osgeo4w-stack (WinVista32) nc-sample-data-set

test ascii-point file created with

v.out.ascii input=firestations@PERMANENT output=C:\wd\grassascii\firestation_ascii_point_g56.txt columns=CITY

this reimported with:

v.in.ascii -n input=C:\wd\grassascii\firestation_ascii_point_g56.txt output=vinascii_with_table
BUG in Beschreibungen, Option 'Punkt' in <format> existiert nicht.
BUG in Beschreibungen, Option 'Standard' in <format> existiert nicht.
D2/3: Vect_open_new(): name = vinascii_with_table
D1/3: Vect_set_thresh(): thresh = 0.000000
D1/3: V1_open_new_nat(): name = vinascii_with_table
D1/3: Vect_get_thresh(): thresh = 0.000000
D1/3: dig__write_head()
D1/3: write coor size (0) to head
D2/3: coor body offset 14
D3/3: dig_init_plus()
D1/3: dig_spidx_init()
D3/3: dig_cidx_init()
D3/3: Vect_hist_command()
D3/3: G_recreate_command()
Scanne die Eingabe zur Ermittelung der Spaltentypen...
D2/3: G__read_Cell_head
D2/3: G__read_Cell_head_array
D3/3: region item: proj:       99
D3/3: region item: zone:       0
D3/3: region item: north:      228513
D3/3: region item: south:      214975.5
D3/3: region item: east:       645012
D3/3: region item: west:       629992.5
D3/3: region item: cols:       527
D3/3: region item: rows:       475
D3/3: region item: e-w resol:  28.5
D3/3: region item: n-s resol:  28.5
D3/3: region item: top:        1
D3/3: region item: bottom:     0
D3/3: region item: cols3:      527
D3/3: region item: rows3:      475
D3/3: region item: depths:     1
D3/3: region item: e-w resol3: 28.5
D3/3: region item: n-s resol3: 28.5
D3/3: region item: t-b resol:  1
D3/3: row 1 : 45 chars
D3/3: row 2 : 45 chars
D3/3: row 3 : 38 chars
D3/3: row 4 : 38 chars
D3/3: row 5 : 46 chars
D3/3: row 6 : 47 chars
D3/3: row 7 : 40 chars
D3/3: row 8 : 41 chars
D3/3: row 9 : 38 chars
D3/3: row 10 : 39 chars
D3/3: row 11 : 38 chars
D3/3: row 12 : 39 chars
D3/3: row 13 : 39 chars
D3/3: row 14 : 39 chars
D3/3: row 15 : 42 chars
D3/3: row 16 : 42 chars
D3/3: row 17 : 42 chars
D3/3: row 18 : 42 chars
D3/3: row 19 : 42 chars
D3/3: row 20 : 42 chars
D3/3: row 21 : 42 chars
D3/3: row 22 : 42 chars
D3/3: row 23 : 41 chars
D3/3: row 24 : 42 chars
D3/3: row 25 : 42 chars
D3/3: row 26 : 42 chars
D3/3: row 27 : 42 chars
D3/3: row 28 : 41 chars
D3/3: row 29 : 41 chars
D3/3: row 30 : 45 chars
D3/3: row 31 : 45 chars
D3/3: row 32 : 42 chars
D3/3: row 33 : 41 chars
D3/3: row 34 : 42 chars
D3/3: row 35 : 42 chars
D3/3: row 36 : 42 chars
D3/3: row 37 : 45 chars
D3/3: row 38 : 46 chars
D3/3: row 39 : 46 chars
D3/3: row 40 : 42 chars
D3/3: row 41 : 46 chars
D3/3: row 42 : 46 chars
D3/3: row 43 : 42 chars
D3/3: row 44 : 42 chars
D3/3: row 45 : 42 chars
D3/3: row 46 : 42 chars
D3/3: row 47 : 42 chars
D3/3: row 48 : 42 chars
D3/3: row 49 : 41 chars
D3/3: row 50 : 42 chars
D3/3: row 51 : 42 chars
D3/3: row 52 : 39 chars
D3/3: row 53 : 37 chars
D3/3: row 54 : 42 chars
D3/3: row 55 : 42 chars
D3/3: row 56 : 42 chars
D3/3: row 57 : 41 chars
D3/3: row 58 : 42 chars
D3/3: row 59 : 41 chars
D3/3: row 60 : 46 chars
D3/3: row 61 : 38 chars
D3/3: row 62 : 46 chars
D3/3: row 63 : 41 chars
D3/3: row 64 : 41 chars
D3/3: row 65 : 48 chars
D3/3: row 66 : 45 chars
D3/3: row 67 : 42 chars
D3/3: row 68 : 42 chars
D3/3: row 69 : 39 chars
D3/3: row 70 : 47 chars
D3/3: row 71 : 48 chars
Maximale Länge der Inputzeile: 49
Maximale Anzahl der Spalten: 4
Minimale Anzahl der Spalten: 4
D1/3: Vect_default_field_info(): map = vinascii_with_table
field = 1
D2/3: drv = dbf db = $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
D3/3: Vect_subst_var(): in =
$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/, map =
vinascii_with_table, mapset = user1
D3/3:   -> C:\gisdata\grassdata/nc_spm_08/user1/dbf/
D3/3: db_start_driver_open_database():
  drvname = dbf, dbname =
C:\gisdata\grassdata/nc_spm_08/user1/dbf/
D2/3: dbDbmscap(): opendir
[c:\OSGeo4W\apps\grass\grass-6.5.svn\driver\db\]
D3/3: win_spawn: args = C:\windows\system32\cmd.exe /c
"c:\OSGeo4W\apps\grass\grass-6.5.svn\driver\db\dbf.exe"
D2/3: DBF: db__driver_open_database() name =
'C:\gisdata\grassdata/nc_spm_08/user1/dbf/'
D2/3: db.name = C:\gisdata\grassdata/nc_spm_08/user1/dbf/
D2/3: add_table(): table = helli name = helli.dbf
D2/3: Begin transaction
Column: 1  type: double
Column: 2  type: double
Column: 3  type: integer
Column: 4  type: string length: 13
D3/3: Field number <1>, name <(null)>
D3/3: Vect_check_dblink: field 1
D1/3: Vect_write_dblinks(): map = vinascii_with_table,
mapset = user1
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/user1/vector
/vinascii_with_table/dbln
D1/3: 1 vinascii_with_table cat
$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/3: Dblinks written
D3/3: create table vinascii_with_table ( cat integer, dbl_1
double precision, dbl_2 double precision, int_1 integer,
str_1 varchar(13) )
D3/3: SQL statement parsed successfully: create table
vinascii_with_table ( cat integer, dbl_1 double precision,
dbl_2 double precision, int_1 integer, str_1 varchar(13) )
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D3/3: Doing SQL command <1> on DBF table... (see
include/sqlp.h)
D2/3: add_table(): table = vinascii_with_table name =
vinascii_with_table.dbf
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D3/3: add_column(): tab = 1, type = 2, name = cat, width =
11, decimals = 0
D3/3: add_column(): tab = 1, type = 3, name = dbl_1, width =
20, decimals = 6
D3/3: add_column(): tab = 1, type = 3, name = dbl_2, width =
20, decimals = 6
D3/3: add_column(): tab = 1, type = 2, name = int_1, width =
11, decimals = 0
D3/3: add_column(): tab = 1, type = 1, name = str_1, width =
13, decimals = 0
D1/3: Vect_write_dblinks(): map = vinascii_with_table,
mapset = user1
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/user1/vector
/vinascii_with_table/dbln
D1/3: Dblinks written
D3/3: Field number <1>, name <(null)>
D3/3: Vect_check_dblink: field 1
D1/3: Vect_write_dblinks(): map = vinascii_with_table,
mapset = user1
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/user1/vector
/vinascii_with_table/dbln
D1/3: 1 vinascii_with_table cat
$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/3: Dblinks written
Importiere Punkte...
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 1,
620856.95858763, 230066.38313211, 1, 'Morrisville')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 1, 620856.95858763,
230066.38313211, 1, 'Morrisville')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 2,
625331.91859749, 229990.82160763, 2, 'Morrisville')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 2, 625331.91859749,
229990.82160763, 2, 'Morrisville')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 3,
615797.66547487, 213363.99261983, 3, 'Apex')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 3, 615797.66547487,
213363.99261983, 3, 'Apex')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 4,
623113.71424165, 219859.06222161, 4, 'Apex')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 4, 623113.71424165,
219859.06222161, 4, 'Apex')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 5,
627926.28432081, 203208.6160536, 5, 'Fuquay-Varina')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 5, 627926.28432081,
203208.6160536, 5, 'Fuquay-Varina')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
[...]
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 68,
649833.80593756, 219907.29347997, 68, 'Raleigh')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 68, 649833.80593756,
219907.29347997, 68, 'Raleigh')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 69,
622136.90859827, 220306.42922513, 69, 'Apex')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 69, 622136.90859827,
220306.42922513, 69, 'Apex')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 70,
625889.8783814, 211478.01839282, 70, 'Holly Springs')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 70, 625889.8783814,
211478.01839282, 70, 'Holly Springs')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D3/3: Vect_write_line(): name = vinascii_with_table, format
= 0, level = 1
D3/3: insert into vinascii_with_table values ( 71,
623658.64334595, 209478.24330292, 71, 'Holly Springs')
D3/3: SQL statement parsed successfully: insert into
vinascii_with_table values ( 71, 623658.64334595,
209478.24330292, 71, 'Holly Springs')
D2/3: find_table(): table = vinascii_with_table
D2/3:   ? helli
D2/3:   ? vinascii_with_table
D2/3: load_table_head(): tab = 1, C:\gisdata\grassdata/nc_sp
m_08/user1/dbf//vinascii_with_table.dbf
D3/3: Doing SQL command <3> on DBF table... (see
include/sqlp.h)
D2/3: load_table(): tab = 1
D2/3: Commit transaction
D2/3: save_table 0
D2/3: save_table 1
D2/3: Write table to tempfile:
'C:\gisdata\grassdata/nc_spm_08/user1/.tmp/6460.dbf'
D2/3: Write 71 rows
D2/3: Written 71 records
Fülle Tabelle...
D2/3: db_close_database() result: 0  (0 means success)
D2/3: db_shutdown_driver() failed
ERROR: Konnte Attributetabelle nicht schliessen. Der DBMI-Treiber hat nicht alle Attribute akzeptiert.

comment:7 by hamish, 14 years ago

ok, thanks,

...
D2/3: Write 71 rows
D2/3: Written 71 records
Fülle Tabelle...
D2/3: db_close_database() result: 0  (0 means success)
D2/3: db_shutdown_driver() failed

ok, from Luigi's tests we know it is DB backend independent, and from Helmut's test we know it is the driver shutdown not the closing of the database.

ERROR: Konnte Attributetabelle nicht schliessen. Der DBMI-Treiber hat
nicht alle Attribute akzeptiert.

(could you run with "LANG=C v.in.ascii ..."? I can guess the meaning but my deutsch is not as good as your english..)

in 6.5svn db_shutdown_driver() for WinGrass effectively boils down to:

#include <stdlib.h>
#include <process.h>
#include <grass/dbmi.h>
#include "macros.h"

/*!
  \brief Closedown the driver, and free the driver structure

  <b>Note:</b> the management of the memory for the driver structure
  probably should be handled differently.
 
  db_start_driver() could take a pointer to driver structure as
  an argument, instead of returning the pointer to allocated
  then there would be no hidden free required

  \param driver db driver

  \return status (?)
*/
int db_shutdown_driver(dbDriver * driver)
{
    int status;

    db__set_protocol_fds(driver->send, driver->recv);
    DB_START_PROCEDURE_CALL(DB_PROC_SHUTDOWN_DRIVER);

    /* close the communication FILEs */
    fclose(driver->send);
    fclose(driver->recv);

    driver->send = NULL;
    driver->recv = NULL;

    /* wait for the driver to finish */
    status = -1;

    /* TODO: convert status to something like from wait? */
    _cwait(&status, driver->pid, WAIT_CHILD);

    driver->pid = 0;

    /* free the driver structure. THIS IS GOOFY */
    free(driver);

    return status;
}


but that's about all the help I can give,
Hamish

in reply to:  7 comment:8 by hellik, 14 years ago

Replying to hamish:

ERROR: Konnte Attributetabelle nicht schliessen. Der DBMI-Treiber hat
nicht alle Attribute akzeptiert.

(could you run with "LANG=C v.in.ascii ..."? I can guess the meaning but my deutsch is not as good as your english..)

ERROR: Could not close attribute table. The DBMI driver did not accept all attributes.

Helmut

in reply to:  7 ; comment:9 by glynn, 14 years ago

Replying to hamish:

in 6.5svn db_shutdown_driver() for WinGrass effectively boils down to:

    _cwait(&status, driver->pid, WAIT_CHILD);

The MSVCRT documentation for _cwait() says:

The value of procHandle passed to _cwait  should be the value returned by
the call to the _spawn  function that created the specified process.

Except, db_start_driver() no longer uses spawn(), it uses G_spawn_ex(), which uses CreateProcess(). See r42651 (7.0) and r42654 (6.5).

You may need to back-port G_wait() (in lib/gis/spawn.c) from 7.0 and use that. On Unix, it doesn't matter, as both approaches result in driver->pid containing a pid_t corresponding to the child process.

in reply to:  9 ; comment:10 by hellik, 14 years ago

Replying to glynn:

Replying to hamish:

in 6.5svn db_shutdown_driver() for WinGrass effectively boils down to:

    _cwait(&status, driver->pid, WAIT_CHILD);

The MSVCRT documentation for _cwait() says:

The value of procHandle passed to _cwait  should be the value returned by
the call to the _spawn  function that created the specified process.

Except, db_start_driver() no longer uses spawn(), it uses G_spawn_ex(), which uses CreateProcess(). See r42651 (7.0) and r42654 (6.5).

My test mentioned above was in WinGrass65.

Helmut

in reply to:  10 comment:11 by hellik, 14 years ago

Replying to hellik:

Replying to glynn:

Replying to hamish:

in 6.5svn db_shutdown_driver() for WinGrass effectively boils down to:

    _cwait(&status, driver->pid, WAIT_CHILD);

The MSVCRT documentation for _cwait() says:

The value of procHandle passed to _cwait  should be the value returned by
the call to the _spawn  function that created the specified process.

Except, db_start_driver() no longer uses spawn(), it uses G_spawn_ex(), which uses CreateProcess(). See r42651 (7.0) and r42654 (6.5).

My test mentioned above was in WinGrass65.

Helmut

I've tested this now in a self built WinGrass7 (nc-sampledata)

v.out.ascii --verbose input=myfireg7@g7 layer=1 output=C:\wd\grassascii\firestation_ascii_point_g7.txt columns=CITY format=point

and the a re-import with v.in.ascii

v.in.ascii -n --verbose input=C:\wd\grassascii\firestation_ascii_point_g7.txt output=vinasciig7withtable2
BUG in Beschreibungen, Option 'Punkt' in <format> existiert nicht.
BUG in Beschreibungen, Option 'Standard' in <format> existiert nicht.
D2/3: Vect_open_new(): name = vinasciig7withtable2
D1/3: Vect_set_thresh(): thresh = 0.000000
D1/3: G_find_vector2(): name=vinasciig7withtable2 mapset=g7
D1/3: V1_open_new_nat(): name = vinasciig7withtable2
D1/3: Vect_get_thresh(): thresh = 0.000000
D1/3: dig__write_head()
D1/3: write coor size (9850026457038848) to head
D2/3: coor body offset 17179869202
D3/3: dig_init_plus()
D3/3: dig_cidx_init()
D1/3: Vect_open_sidx(): name = vinasciig7withtable2 mapset=
g7 mode = new
D2/3: G__read_Cell_head
D2/3: G__read_Cell_head_array
D3/3: region item: proj:       99
D3/3: region item: zone:       0
D3/3: region item: north:      228500
D3/3: region item: south:      215000
D3/3: region item: east:       645000
D3/3: region item: west:       630000
D3/3: region item: cols:       1500
D3/3: region item: rows:       1350
D3/3: region item: e-w resol:  10
D3/3: region item: n-s resol:  10
D3/3: region item: top:        1
D3/3: region item: bottom:     0
D3/3: region item: cols3:      1500
D3/3: region item: rows3:      1350
D3/3: region item: depths:     1
D3/3: region item: e-w resol3: 10
D3/3: region item: n-s resol3: 10
D3/3: region item: t-b resol:  1
D3/3: Vect_hist_command()
D3/3: G_recreate_command()
Scanne die Eingabe zur Ermittelung der Spaltentypen...
D3/3: row 1 : 45 chars
D3/3: row 2 : 45 chars
D3/3: row 3 : 38 chars
D3/3: row 4 : 38 chars
D3/3: row 5 : 46 chars
D3/3: row 6 : 47 chars
D3/3: row 7 : 40 chars
D3/3: row 8 : 41 chars
D3/3: row 9 : 38 chars
D3/3: row 10 : 39 chars
D3/3: row 11 : 38 chars
D3/3: row 12 : 39 chars
D3/3: row 13 : 39 chars
D3/3: row 14 : 39 chars
D3/3: row 15 : 42 chars
D3/3: row 16 : 42 chars
D3/3: row 17 : 42 chars
D3/3: row 18 : 42 chars
D3/3: row 19 : 42 chars
D3/3: row 20 : 42 chars
D3/3: row 21 : 42 chars
D3/3: row 22 : 42 chars
D3/3: row 23 : 41 chars
D3/3: row 24 : 42 chars
D3/3: row 25 : 42 chars
D3/3: row 26 : 42 chars
D3/3: row 27 : 42 chars
D3/3: row 28 : 41 chars
D3/3: row 29 : 41 chars
D3/3: row 30 : 45 chars
D3/3: row 31 : 45 chars
D3/3: row 32 : 42 chars
D3/3: row 33 : 41 chars
D3/3: row 34 : 42 chars
D3/3: row 35 : 42 chars
D3/3: row 36 : 42 chars
D3/3: row 37 : 45 chars
D3/3: row 38 : 46 chars
D3/3: row 39 : 46 chars
D3/3: row 40 : 42 chars
D3/3: row 41 : 46 chars
D3/3: row 42 : 46 chars
D3/3: row 43 : 42 chars
D3/3: row 44 : 42 chars
D3/3: row 45 : 42 chars
D3/3: row 46 : 42 chars
D3/3: row 47 : 42 chars
D3/3: row 48 : 42 chars
D3/3: row 49 : 41 chars
D3/3: row 50 : 42 chars
D3/3: row 51 : 42 chars
D3/3: row 52 : 39 chars
D3/3: row 53 : 37 chars
D3/3: row 54 : 42 chars
D3/3: row 55 : 42 chars
D3/3: row 56 : 42 chars
D3/3: row 57 : 41 chars
D3/3: row 58 : 42 chars
D3/3: row 59 : 41 chars
D3/3: row 60 : 46 chars
D3/3: row 61 : 38 chars
D3/3: row 62 : 46 chars
D3/3: row 63 : 41 chars
D3/3: row 64 : 41 chars
D3/3: row 65 : 48 chars
D3/3: row 66 : 45 chars
D3/3: row 67 : 42 chars
D3/3: row 68 : 42 chars
D3/3: row 69 : 39 chars
D3/3: row 70 : 47 chars
D3/3: row 71 : 48 chars
Maximale Länge der Inputzeile: 49
Maximale Anzahl der Spalten: 4
Minimale Anzahl der Spalten: 4
D1/3: Vect_default_field_info(): map = vinasciig7withtable2
field = 1
D2/3: drv = sqlite db =
$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db
D3/3: Vect_subst_var(): in =
$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db, map =
vinasciig7withtable2, mapset = g7
D3/3:   -> C:\gisdata\grassdata/nc_spm_08/g7/sqlite.db
D3/3: db_start_driver_open_database():
  drvname = sqlite, dbname =
C:\gisdata\grassdata/nc_spm_08/g7/sqlite.db
D2/3: dbDbmscap(): opendir [C:\Program
Files\GRASS-70-SVN\driver\db\]
D3/3: win_spawn: args = C:\windows\system32\cmd.exe /c
""C:\Program Files\GRASS-70-SVN\driver\db\sqlite.exe""
D3/3:
db_driver_open_database()
D3/3: name = 'C:\gisdata\grassdata/nc_spm_08/g7/sqlite.db'
D2/3: name2 = 'C:\gisdata\grassdata/nc_spm_08/g7/sqlite.db'
D3/3: execute: BEGIN
Column: 1  type: double
Column: 2  type: double
Column: 3  type: integer
Column: 4  type: string length: 13
D3/3: Field number <1>, name <(null)>
D3/3: Vect_check_dblink: field 1, name vinasciig7withtable2
D1/3: Vect_write_dblinks(): map = vinasciig7withtable2,
mapset = g7
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/g7/vector/vi
nasciig7withtable2/dbln
D1/3: 1/vinasciig7withtable2|vinasciig7withtable2|cat|$GISDB
ASE/$LOCATION_NAME/$MAPSET/sqlite.db|sqlite
D1/3: Dblinks written
D3/3: create table vinasciig7withtable2 ( cat integer, dbl_1
double precision, dbl_2 double precision, int_1 integer,
str_1 varchar(13) )
D3/3: execute: create table vinasciig7withtable2 ( cat
integer, dbl_1 double precision, dbl_2 double precision,
int_1 integer, str_1 varchar(13) )
D3/3: db__create_index()
D3/3:  SQL: create unique index vinasciig7withtable2_cat on
vinasciig7withtable2 ( cat )
D1/3: Vect_write_dblinks(): map = vinasciig7withtable2,
mapset = g7
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/g7/vector/vi
nasciig7withtable2/dbln
D1/3: Dblinks written
D3/3: Field number <1>, name <(null)>
D3/3: Vect_check_dblink: field 1, name vinasciig7withtable2
D1/3: Vect_write_dblinks(): map = vinasciig7withtable2,
mapset = g7
D1/3: dbln file: C:\gisdata\grassdata/nc_spm_08/g7/vector/vi
nasciig7withtable2/dbln
D1/3: 1/vinasciig7withtable2|vinasciig7withtable2|cat|$GISDB
ASE/$LOCATION_NAME/$MAPSET/sqlite.db|sqlite
D1/3: Dblinks written
Importiere Punkte...
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 1,
620856.95858763, 230066.38313211, 1, 'Morrisville')
D3/3: execute: insert into vinasciig7withtable2 values ( 1,
620856.95858763, 230066.38313211, 1, 'Morrisville')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 2,
625331.91859749, 229990.82160763, 2, 'Morrisville')
D3/3: execute: insert into vinasciig7withtable2 values ( 2,
625331.91859749, 229990.82160763, 2, 'Morrisville')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 3,
615797.66547487, 213363.99261983, 3, 'Apex')
D3/3: execute: insert into vinasciig7withtable2 values ( 3,
615797.66547487, 213363.99261983, 3, 'Apex')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 4,
623113.71424165, 219859.06222161, 4, 'Apex')
D3/3: execute: insert into vinasciig7withtable2 values ( 4,
623113.71424165, 219859.06222161, 4, 'Apex')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 5,
627926.28432081, 203208.6160536, 5, 'Fuquay-Varina')
D3/3: execute: insert into vinasciig7withtable2 values ( 5,
627926.28432081, 203208.6160536, 5, 'Fuquay-Varina')
[...]
D3/3: execute: insert into vinasciig7withtable2 values ( 67,
651050.34524882, 232036.68777768, 67, 'Raleigh')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 68,
649833.80593756, 219907.29347997, 68, 'Raleigh')
D3/3: execute: insert into vinasciig7withtable2 values ( 68,
649833.80593756, 219907.29347997, 68, 'Raleigh')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 69,
622136.90859827, 220306.42922513, 69, 'Apex')
D3/3: execute: insert into vinasciig7withtable2 values ( 69,
622136.90859827, 220306.42922513, 69, 'Apex')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 70,
625889.8783814, 211478.01839282, 70, 'Holly Springs')
D3/3: execute: insert into vinasciig7withtable2 values ( 70,
625889.8783814, 211478.01839282, 70, 'Holly Springs')
D3/3: Vect_write_line(): name = vinasciig7withtable2, format
= 0, level = 1
D3/3: insert into vinasciig7withtable2 values ( 71,
623658.64334595, 209478.24330292, 71, 'Holly Springs')
D3/3: execute: insert into vinasciig7withtable2 values ( 71,
623658.64334595, 209478.24330292, 71, 'Holly Springs')
D3/3: execute: COMMIT
D3/3: db_close_database()
Fülle Tabelle...
D2/3: db_close_database() result: 0  (0 means success)
D2/3: db_shutdown_driver() failed
ERROR: Could not close attribute table. The DBMI driver did not accept all attributes.

also here again the following message about the dbmi-driver:

ERROR: Could not close attribute table. The DBMI driver did not accept all attributes.

BUT the ascii-vector-data (also the table-data) is imported, you can add the imported data in the map display and are able to open the attribute table in the attribute table manager.

Helmut

in reply to:  10 comment:12 by glynn, 14 years ago

Replying to hellik:

My test mentioned above was in WinGrass65.

This issue applies to all branches and to the 6.4.0 release. And to RC7; RC6 was the last version to use _spawnl(). All later versions are likely to be broken on Windows, where db_shutdown_driver() will report failure. The driver itself should terminate correctly, but the client will believe that it failed.

Of the many calls to db_shutdown_driver(), only one actually checks the return code. That is the one in db_close_database_shutdown_driver(), which will return DB_FAILED.

Of the many calls to db_close_database_shutdown_driver(), only one actually checks the return code, and that one is in v.in.ascii.

The net result is that v.in.ascii terminates with a fatal error rather than calling Vect_build() and Vect_close().

This can be "fixed" by removing the check of the return code. We should actually fix db_shutdown_driver(), but in the meantime, we may as well get v.in.ascii working (and why should v.in.ascii be any different to all of the other modules?)

comment:13 by hamish, 14 years ago

Priority: normalblocker
Summary: v.in.ascii fails with long text file in WinGRASS-6.4.0-1v.in.ascii points import fails in WinGRASS-6.4.0-1

even

echo "10|10|abcd" | v.in.ascii out=test

fails for WinGrass (tested in 6.5svn). agree to disable the test while we find a solution in the dev branches; suggest to replace the 6.4.0.exe WinGrass installer link ASAP with a nightly build after that is done, until we release 6.4.1 (which we should start planning for pretty soon).

Hamish

comment:14 by hamish, 14 years ago

patch to replace G_fatal_error() with G_debug() message applied to 6.5svn with r43550. please test..

is this failing in grass7 as well?

Hamish

in reply to:  14 ; comment:15 by Luigi Ponti, 14 years ago

Replying to hamish:

patch to replace G_fatal_error() with G_debug() message applied to 6.5svn with r43550. please test..

is this failing in grass7 as well?

Hamish

Applied Glynn's patch http://osgeo-org.1803224.n2.nabble.com/v-in-ascii-fails-with-long-text-file-in-WinGRASS-6-4-0-1-tp5530779p5553622.html

to changeset 4359 releasebranch_6_4, compiled following instructions at <http://trac.osgeo.org/grass/wiki/CompileOnWindows>, and it works for the your simple test (see <http://trac.osgeo.org/grass/ticket/1159#comment:13>):

    GRASS 6.4> echo "10|10|abcd" | v.in.ascii out=test
    Scanning input for column types...
    Maximum input row length: 11
    Maximum number of columns: 3
    Minimum number of columns: 3
    Column: 1 type: double
    Column: 2 type: double
    Column: 3 type: string length: 4
    Importando punti ...
     100%
    Populating table...
    Building topology for vector map <test>...
    Registering primitives...
    1 primitives registered
    1 vertices registered
    Building areas...
     100%
    0 areas built
    0 isles built
    Attaching islands...
    Attaching centroids...
     100%
    Number of nodes: 1
    Number of primitives: 1
    Number of points: 1
    Number of lines: 0
    Number of boundaries: 0
    Number of centroids: 0
    Number of areas: 0
    Number of isles: 0
    v.in.ascii completo.


The point can be displayed, and the dbf table seems ok. Also works using a longer sample text file I previously linked

    GRASS 6.4> v.in.ascii --overwrite input=Bloomday_Olive_11set10_Avg output=test_US_import fs=tab
    ATTENZIONE: Vector map <test_US_import> already exists and will be
                overwritten
    Scanning input for column types...
    Maximum input row length: 31
    Maximum number of columns: 3
    Minimum number of columns: 3
    Column: 1 type: double
    Column: 2 type: double
    Column: 3 type: double
    Importando punti ...
     100%
    Populating table...
    Building topology for vector map <test_US_import>...
    Registering primitives...
    1157 primitives registered
    1157 vertices registered
    Building areas...
     100%
    0 areas built
    0 isles built
    Attaching islands...
    Attaching centroids...
     100%
    Number of nodes: 1154
    Number of primitives: 1157
    Number of points: 1157
    Number of lines: 0
    Number of boundaries: 0
    Number of centroids: 0
    Number of areas: 0
    Number of isles: 0
    v.in.ascii completo.


Related ticket 1158 <http://trac.osgeo.org/grass/ticket/1158> seems to persist:

    GRASS 6.4> v.in.ascii --overwrite input=C:/cygwin/home/andy/models_temp/Bloomd
    ay_Olive_11set10_Avg output=test_US_import fs=tab
    ATTENZIONE: Vector map <test_US_import> already exists and will be
                overwritten
    ATTENZIONE: Unable to delete file
                'C:\cygwin\home\andy/latlong/luigi/vector/test_US_import/hist'
    ERRORE: Unable to delete vector map <test_US_import>



Still not entirely clear to me which variable I am supposed to set in order to get full English messages.

Thanks and regards,

Luigi

in reply to:  15 comment:16 by hamish, 14 years ago

Replying to lponti:

Applied Glynn's patch [...], compiled [...], and it works for the your simple test

...

The point can be displayed, and the dbf table seems ok. Also works using a longer sample text file I previously linked

great. will port to other branches ASAP

Still not entirely clear to me which variable I am supposed to set in order to get full English messages.

perhaps:

GRASS> LANG=C v.in.ascii ...

? (anyway the idea is to have it be understandable to as many people as possible & be able to grep the code for the exact message text; if it's only 98% english it's not a problem if those other conditions are met)

Hamish

comment:17 by hamish, 14 years ago

r43550 backported to 6.4 in r43601. I don't see db_close_database_shutdown_driver() in trunk so not applied there.

Hamish

in reply to:  17 comment:18 by glynn, 14 years ago

Replying to hamish:

I don't see db_close_database_shutdown_driver() in trunk

http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.in.ascii/main.c#L524

comment:19 by hamish, 14 years ago

eye be blind. louder version of debug message applied to trunk in r43610 so it is not forgotten.

in reply to:  19 ; comment:20 by hellik, 14 years ago

Replying to hamish:

eye be blind. louder version of debug message applied to trunk in r43610 so it is not forgotten.

Glynn suggested also following patch which was confirmed as working by Luigi:

--- vector/v.in.ascii/in.c~	2010-09-04 16:31:59.000000000 +0100
+++ vector/v.in.ascii/in.c	2010-09-21 08:57:12.000000000 +0100
@@ -519,8 +519,7 @@
 	if (driver) {
 	    G_message(_("Populating table..."));
 	    db_commit_transaction(driver);
-	    if(db_close_database_shutdown_driver(driver) == DB_FAILED)
-		G_fatal_error(_("Could not close attribute table. The DBMI driver did not accept all attributes"));
+	    db_close_database_shutdown_driver(driver);
 	}
 	fclose(tmpascii);
     }

(see: http://lists.osgeo.org/pipermail/grass-user/2010-September/057976.html http://lists.osgeo.org/pipermail/grass-user/2010-September/057985.html)

maybe I've missed something (I can't see this in any branches nor in trunk)?

should this also be applied?

best regards Helmut

in reply to:  20 comment:21 by glynn, 14 years ago

Replying to hellik:

Glynn suggested also following patch which was confirmed as working by Luigi:

maybe I've missed something (I can't see this in any branches nor in trunk)?

should this also be applied?

It's an alternative to r43610, r43550, and r43601. It makes v.in.ascii consistent with other modules, none of which check the return code from db_close_database_shutdown_driver().

comment:22 by hamish, 13 years ago

Resolution: fixed
Status: newclosed

tested in 6.4svn and 6.5svn nightly wingrass builds on XP. all working now.

Note: See TracTickets for help on using tickets.