[gdal-dev] dbf data types
Even Rouault
even.rouault at spatialys.com
Sun Jun 14 02:47:49 PDT 2015
Hi Martin,
>
> recently I was converting dbf files [1] to PostgreSQL database. Some
> fields are recognized as characters even they contain numeric types,
> eg.
>
> ogrinfo OBCE.DBF OBCE -so
> INFO: Open of `OBCE.DBF'
> using driver `ESRI Shapefile' successful.
>
> Layer name: OBCE
> ICOB: String (6.0)
>
> ICOB is ID of a city, OGR driver defines this attribute as character.
Yes, looking in the DBF header shows that it is declared as 'C' (character)
field
> I tried ADJUST_TYPE option, but it didn't make difference.
ADJUST_TYPE in the shapedriver only does Real->Integer/Integer64 or Integer64-
>Integer field types adjustment as documented
>
> Thanks in advance for any hint, Martin
One workaround is to convert to CSV and use the AUTODETECT_TYPE=YES open
option:
ogr2ogr -f CSV OBCE.CSV OBCE.DBF
ogr2ogr -f PostgreSQL PG:xxxx OBCE.CSV -oo AUTODETECT_TYPE=YES
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list