Opened 13 years ago

Closed 13 years ago

#3137 closed bug (fixed)

Save as shapefile fails if field names are longer than 10 characters

Reported by: pcav Owned by: nobody
Priority: major: does not work as expected Milestone: Version 1.6.0
Component: Data Provider Version:
Keywords: Cc: warmerdam, borysiasty
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

Description

If I try to save the attached MapInfo file, 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. It seems a limitation of OGR, but perhaps we could be smarter and replace the last character with a serial. Otherwise better forward this ticket to GDAL trac?

Attachments (1)

contour.mif.zip (10.7 KB ) - added by pcav 13 years ago.

Download all attachments as: .zip

Change History (9)

by pcav, 13 years ago

Attachment: contour.mif.zip added

comment:1 by pcav, 13 years ago

Cc: borysiasty added

BTW, the external plugin Table Manager fails to rename the fields, hanging QGIS

in reply to:  description comment:2 by jef, 13 years ago

Replying to pcav:

and export fails. It seems a limitation of OGR, but perhaps we could be smarter and replace the last character with a serial.

AFAIK it's not a limitation of OGR, but a limitation of D-Base format.

comment:3 by pcav, 13 years ago

I mean: the lack of a proper truncation method, adding a serial in case of too long field names, may be a limitation of OGR.

comment:4 by warmerdam, 13 years ago

If the ticket is filed against GDAL, I can have Chaitanya look into clean logic for disambiguation for shortened names.

comment:5 by jef, 13 years ago

If this is fixed in OGR we need to keep in mind to adapt http://trac.osgeo.org/qgis/browser/trunk/qgis/src/core/qgsvectorfilewriter.cpp#L312 accordingly.

comment:7 by pcav, 13 years ago

Apparently the problem has been solved in GDAL 1.7. The method in QGIS should then be updated. See http://trac.osgeo.org/gdal/ticket/3796#comment:1

comment:8 by jef, 13 years ago

Resolution: fixed
Status: newclosed

fixed in r15238.

Note: See TracTickets for help on using tickets.