5

At 3.8.3, when I Export > Save As a Geopackage point layer to a shapefile, fields with type = double are output with 15(!!!) significant digits. Here are the before and after field widths:

Input:
Type:    double
Length:   10
Precision:  2

Output:
Type:    double
Length:   23
Precision: 15

Furthermore, the output values are modified by a slight amount. Here are some examples:

Input    Output
150.62   150.620000000000005
150.51   150.509999999999991
221.86   221.860000000000014

Unfortunately, based on the comment by @user30184, the QGIS shapefile output appears to be the default action.

Now I'm curious about the passage that @user30184 quoted, particularly the phrase "...Real (floating point) fields without an explicit width..." This implies that my fields did not have explicit widths.

How do I make my real field widths explicit, either by modifying the source layer, or in the GDAL output process, or some other method?

2
  • 1
    Precision value seems to be close to GDAL default value gdal.org/drivers/vector/shapefile.html Real (floating point) fields without an explicit width are treated as width 24 with 15 decimal places of precision..
    – user30184
    Commented Nov 14, 2019 at 8:14
  • 1
    You can use the Vector - Table - Refactor Fields tool to change field attributes like precision. When adding a new field using the Field Calculator you tell it the field type, length and precision.
    – John
    Commented Nov 14, 2019 at 20:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.