Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#3796 closed defect (fixed)

Saving in shapefile fails if field names are longer than 10 characters

Reported by: pcav Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

If I try to save the MapInfo file https://trac.osgeo.org/qgis/attachment/ticket/3137/contour.mif.zip, I get:

Export to vector file failed. Error: trimming attribute name 'PM10_AVG_max' to ten significant characters produces duplicate column name.

and export fails. The logic for disambiguation for shortened names should be smart enough to deal with these cases. See also https://trac.osgeo.org/qgis/ticket/3137

Change History (3)

comment:1 by Even Rouault, 12 years ago

Resolution: fixed
Status: newclosed

You're probably using a too old version of OGR, or qgis doesn't query the actual field name that got inserted in the layer definition after the call to OGRLayer::CreateField()

With gdal trunk, I get:

C:\gdal_trunk>ogr2ogr contour.shp contour.mif
Warning 6: Normalized/laundered field name: 'PM10_AVG_min' to 'PM10_AVG_m'
Warning 6: Normalized/laundered field name: 'PM10_AVG_max' to 'PM10_AVG_1'

And I believe this works since OGR 1.7.0

comment:2 by pcav, 12 years ago

OK, so the problem should reside in QGIS. Thanks for clarifying.

comment:3 by jef, 12 years ago

duplicate of #3247

Note: See TracTickets for help on using tickets.