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: | |
Cc: |
Description
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
[1] https://github.com/OSGeo/gdal/blob/tags/1.11.3/gdal/ogr/ogrsf_frmts/shape/dbfopen.c#L1262
Attachments (1)
Change History (4)
by , 7 years ago
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Merci Even, indeed, I think that fixing the warning would be a good solution.
comment:3 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
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 https://github.com/OSGeo/gdal/issues if it is not already reported there.
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