[gdal-dev] the same names of attribute types in shapefile after ogr2ogr: a problem for us

Vitali Diatchkov vitali at arbonaut.com
Mon Mar 10 13:32:39 EDT 2008


Hello!

We use GDAL library (actually OGR part of it) for conversion from TAB to
Shapefile. This functionality is called from JVM through JNI (Java Native
Interface): we wrapped necessary functionality of ogr2ogr with required
changes into java native methods and call OGR routines from java code. This
is a background. This solves our specific tasks. But we  have a problem that
our customers have many TAB files where there are attribute types with the
same long prefix in name. During conversion the attribute type name is cut
for 10 characters (may be because of DBF spec) and as a result a shapefile
has several attribute types with the same names. OGR library produces this
kind of files without worrying but later on ShapefileDataStore (a GeoTools'
java library driver for shapefiles) fails to handle them.

What is the easiest solution to catch these cases at the stage of conversion
inside of OGR and rename attribute types on the fly based on some simple
rules?   The exact matching of names is unimportant; the shapefile with
unique (fixed) attribute type names is required.

Thanks in advance, Vitali.



More information about the gdal-dev mailing list