Opened 7 years ago

Closed 5 years ago

#6803 closed defect (wontfix)

ogr2ogr complains possibly due to too larger number

Reported by: mbernasocchi Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: 1.11.3
Severity: normal Keywords:


when doing ogr2ogr -f "ESRI Shapefile" test2.shp in.gpkg

with the attached files ogr2ogr complains that: " Warning 1: Value ...... of field structural of feature ..... not successfully written. Possibly due to too larger number with respect to field width

" but the data is converted correctly, I looked at the source [1], and


Attachments (1)

in.gpkg (12.0 KB ) - added by mbernasocchi 7 years ago.

Download all attachments as: .zip

Change History (4)

by mbernasocchi, 7 years ago

Attachment: in.gpkg added

comment:1 by Even Rouault, 7 years ago

The error message is a bit misleading but there's indeed an issue. You cannot serialize 1.01336003777999994e+23, 1225970000 or 1962330000123456 with the default %24.15f formatting used by the shapefile driver when there's no explicit width/precision in the source dataset. Here there's no real corruption are decimals are removed, but those numbers are no longer 24.15 and thus a pedantic reader could complain. There will be always issue when converting from IEEE754 (GPKG) to decimal (DBF). We could potentially have an ogr2ogr option that would do a full scan of the input dataset to determine the best formatting, but in the meantime you can do that manually:

ogr2ogr out.shp in.gpkg -sql "select cast(nonstructu as numeric(30,5)) from example" -overwrite -dialect ogrsql

comment:2 by mbernasocchi, 7 years ago

Merci Even, indeed, I think that fixing the warning would be a good solution.

comment:3 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to if it is not already reported there.

Note: See TracTickets for help on using tickets.