Opened 12 years ago

Closed 11 years ago

#1915 closed defect (invalid)

v.out.ogr: problem to export certain column(s)

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Vector Version: svn-trunk
Keywords: v.out.ogr, wxGUI Cc:
CPU: All Platform: Linux

Description

When trying to export a density vector polygon map, some strange column export problem occurs:

GRASS 7.0.svn (ll_wgs84):~ > v.out.ogr dep_new_clean dsn=dep_new_clean.shp type=area
Warning 1: Field PROVDEP of width 1000 truncated to 255.
Warning 1: Field MIN_NOMDEP of width 1000 truncated to 255.
Warning 1: Field JURISDICC of width 1000 truncated to 255.
Warning 1: Field MIN_DEPTO of width 1000 truncated to 255.
Warning 1: Field MIN_PROV of width 1000 truncated to 255.
Warning 1: Field PROVINCIA of width 1000 truncated to 255.
ERROR 6: Failed to add field named 'normalization'   <<----- !
Exporting 702 areas (may take some time)...
 100%
v.out.ogr complete. 702 features written to <dep_new_clean>
(ESRI_Shapefile).

Indeed, the column "normalization" is lacking, checked with

ogrinfo -so dep_new_clean.shp dep_new_clean

The GRASS attribute columns are:

v.info -c dep_new_clean
Displaying column types/names for database connection of layer <1>:
INTEGER|cat
TEXT|PROVDEP
TEXT|MIN_NOMDEP
TEXT|JURISDICC
TEXT|MIN_DEPTO
TEXT|MIN_PROV
TEXT|PROVINCIA
INTEGER|COD_NUM
INTEGER|pob_1991
INTEGER|pob_2001
INTEGER|pob_2010
DOUBLE PRECISION|perimetro
DOUBLE PRECISION|superficie
DOUBLE PRECISION|dens_2001
DOUBLE PRECISION|dens_2010
DOUBLE PRECISION|incid
DOUBLE PRECISION|n_sph
DOUBLE PRECISION|normalization

More detailed:

...
D2/3: cat x dens_2001 -> cat x dens_2001 -> keycol = 0
D3/3: col 14: dens_2010 sqltype=6 ctype=3 width=20
D2/3: ogr_ftype = 2
D2/3: cat x dens_2010 -> cat x dens_2010 -> keycol = 0
D3/3: col 15: incid sqltype=6 ctype=3 width=20
D2/3: ogr_ftype = 2
D2/3: cat x incid -> cat x incid -> keycol = 0
D3/3: col 16: n_sph sqltype=6 ctype=3 width=20
D2/3: ogr_ftype = 2
D2/3: cat x n_sph -> cat x n_sph -> keycol = 0
D3/3: col 17: normalization sqltype=6 ctype=3 width=20
D2/3: ogr_ftype = 2
D2/3: cat x normalization -> cat x normalization -> keycol = 0
ERROR 6: Failed to add field named 'normalization'
Exporting 702 areas (may take some time)...
D3/3: Vect_get_area_centroid(): area = 1
D3/3: Vect_read_line(): line = 525
D3/3: V2_read_line_nat(): line = 525
D3/3: Vect__Read_line_nat: offset = 3782596
D3/3:     type = 8, do_cats = 1 dead = 0
D3/3:     n_cats = 1
D3/3:     n_points = 1
D3/3:     off = 3782625
D3/3: area = 1 centroid = 525 ncats = 1
D3/3: Vect_get_area_points(): area = 1
...

DB driver:

v.db.connect -p dep_new_clean
Vector map <dep_new_clean> is connected by:
layer <1/dep_new> table <dep_new_clean> in database </home/user/grassdata//ll_wgs84/argentina/sqlite/sqlite.db> through driver <sqlite> with key <cat>
g.version -b
...
revision=55619
build_date=2013-03-04

Idea: is "normalization" a reserved SQL word? If so, the user should not be even able to use it as column name (this column was added in the wxGUI, Attribute manager, Manage tables, Add column).

Change History (3)

comment:1 by neteler, 12 years ago

Keywords: wxGUI added

Renaming the column help:

GRASS 7.0.svn (ll_wgs84):~ > v.db.renamecolumn dep_new_clean column=normalization,area_norm

GRASS 7.0.svn (ll_wgs84):~ > v.out.ogr dep_new_clean dsn=dep_new_clean.shp type=area
Warning 1: Field PROVDEP of width 1000 truncated to 255.
Warning 1: Field MIN_NOMDEP of width 1000 truncated to 255.
Warning 1: Field JURISDICC of width 1000 truncated to 255.
Warning 1: Field MIN_DEPTO of width 1000 truncated to 255.
Warning 1: Field MIN_PROV of width 1000 truncated to 255.
Warning 1: Field PROVINCIA of width 1000 truncated to 255.
Exporting 702 areas (may take some time)...
 100%
v.out.ogr complete. 702 features written to <dep_new_clean>
(ESRI_Shapefile).

Hence this is a bug (non-feature) in either v.db.addcolumn or the wxGUI Attribute manager.

in reply to:  1 comment:2 by mmetz, 12 years ago

Replying to neteler:

Renaming the column help:

Hence this is a bug (non-feature) in either v.db.addcolumn or the wxGUI Attribute manager.

No, it is a limitation of dbf as used by the OGR ESRI_Shapefile driver. The column name 'normalization' is too long for dbf.

Markus M

comment:3 by neteler, 11 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.