[gdal-dev] ogr2ogr problem with DECIMAL big int columns

Luca Sigfrido Percich sigfrido at tiscali.it
Thu Oct 13 04:49:53 EDT 2011


Hi all,

I'm trying to convert with ogr2ogr a shapefile having a decimal(15,0) ID
column containig very long integer unique IDs (for example,
113800200319004)
For whom it may concern, it is a TeleAtlas MultiNet file.

When converting to shapefile, I get the same column type in out.shp -
decimal(15, 0) - but all the values are truncated to the lowest long
integer, -2147483648, so it looks like a conversion to long integer is
taking place somewhere:

ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3003 -f "ESRI Shapefile"
test/out.shp in.shp

When converting to MapInfo TAB, the column is converted to Float (8
bytes), which could lead to loss of information when the number is
really big and thus gets approximated when stored in floating point
format:

ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3003 -f "MapInfo file" test/out.tab
in.shp

Please note that MapInfo supports the Decimal column type, so a straight
type mapping should be implemented.

I tried the -fieldTypeToString option, which in this case could do the
trick, but the "decimal" type is not supported:

> Unhandled type for fieldtypeasstring option : decimal

It works fine with the "real" type, though:

ogr2ogr -fieldTypeToString real -s_srs EPSG:4326 -t_srs EPSG:3003 -f
"MapInfo file" test/out.tab in.shp

but all the decimal and real columns are converted into character, which
is a negative but not critical drawback.

Should I open a ticket? Or could you suggest a workaround other than
converting all floating point columns to char?

Thank you in advance

Sig

_____________
PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e' consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema e a distruggere le varie copie o stampe, dandone gentilmente comunicazione all’indirizzo mail del mittente. Ogni utilizzo improprio e' contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

PRIVACY
Le informazioni contenute in questo messaggio sono riservate e confidenziali. Il loro utilizzo e' consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo dal Suo Sistema e a distruggere le varie copie o stampe, dandone gentilmente comunicazione all’indirizzo mail del mittente. Ogni utilizzo improprio e' contrario ai principi del D.lgs 196/03 e alla legislazione europea (Direttiva 2002/58/CE).

-- 
This email was Anti Virus checked by Astaro Security Gateway. http://www.amat-mi.it


More information about the gdal-dev mailing list