Shapefile driver truncated field names, sometimes causing duplicates
|Reported by:||Daniel Morissette||Owned by:||chaitanya|
|Cc:||warmerdam, Even Rouault|
Since the DBF format limits field/attribute names to 10 chars, the shapefile driver has to truncate the name of fields longer than 10 chars. However, this is done without checking for potential duplicates field names.
For instance, if a dataset contains fields "mylongattr1" and "mylongattr2", they are both written as "mylongattr". We should change the dups to have a unique name, presumably by adding a unique number at the end.
I will attach a mif/mid dataset that can be used to reproduce the problem. Simply convert this file to shapfile using ogr2ogr and you see that the "POPPLACE_test1" and "POPPLACE_test2" fields end up being written as duplicate "POPPLACE_t" fields.
For an example of the right thing to do, see the pgsql2shp command: http://trac.osgeo.org/postgis/attachment/ticket/34/pgsql2shp.c#L2654
Change History (15)
comment:1 by , 13 years ago