[gdal-dev] ogr2ogr with append fails to convert truncated fields

Even Rouault even.rouault at mines-paris.org
Fri Mar 1 09:35:14 PST 2013


Le lundi 25 février 2013 19:53:22, Tamas Szekeres a écrit :
> So we seem to have 3 divergent options to provide a work around:
> 
> 1. Expose fieldmap setting to let the user decide the order of the fields
> to be copied.
> 2. Modify GetFieldIndex to provide the name based lookup by the truncated
> name (for the shape driver specifically)
> 3. Provide an option to instruct ogr2ogr to consider the source and the
> destination has the same field structure (order).
> 
> Which would be the most reasonable?
> 
> I personally in favour of #3 or #1.  #3 is easier to implement, but #1 is
> more customizable.
> With regards to #2 we might continue to encounter non trivial matches.

There's even a 4th option that doesn't require any code change. Create a OGR 
VRT file that renames the source fields to the truncated shapefile field names (or 
the reverse : creates a OGR VRT that renames the truncated shapefile field names 
to the original field names, since OGR VRT now supports since a few versions 
CreateFeature())


More information about the gdal-dev mailing list