Opened 14 years ago
Closed 14 years ago
#1159 closed defect (fixed)
v.in.ascii points import fails in WinGRASS-6.4.0-1
Reported by: | Luigi Ponti | Owned by: | |
---|---|---|---|
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)
comment:1 by , 14 years ago
follow-up: 3 comment:2 by , 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
comment:3 by , 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 , 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
follow-up: 6 comment:5 by , 14 years ago
level 2 debug messages added to db_close_database_shutdown_driver() in trunk and devbr6
comment:6 by , 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.
follow-ups: 8 9 comment:7 by , 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
comment:8 by , 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
follow-up: 10 comment:9 by , 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.
follow-ups: 11 12 comment:10 by , 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
comment:11 by , 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
comment:12 by , 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 , 14 years ago
Priority: | normal → blocker |
---|---|
Summary: | v.in.ascii fails with long text file in WinGRASS-6.4.0-1 → v.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
follow-up: 15 comment:14 by , 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
follow-up: 16 comment:15 by , 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
comment:16 by , 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
follow-up: 18 comment:17 by , 14 years ago
comment:18 by , 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
follow-up: 20 comment:19 by , 14 years ago
eye be blind. louder version of debug message applied to trunk in r43610 so it is not forgotten.
follow-up: 21 comment:20 by , 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
comment:21 by , 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 , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
tested in 6.4svn and 6.5svn nightly wingrass builds on XP. all working now.
Replying to lponti:
I've tried this with the nc-sample-dataset in a WinVista32-box with the WinGrass64-installer:
=> point mode
the message above is partly translated from german to english.
and with DEEBUG=3
Helmut