Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float fields created in ArcGIS are converted into Real 12, 11 - Precision is too high #51849

Closed
2 tasks
epc-aac opened this issue Feb 14, 2023 · 8 comments
Closed
2 tasks
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)

Comments

@epc-aac
Copy link

epc-aac commented Feb 14, 2023

What is the bug or the crash?

float_vs_real

Float fields of a shapefile created with other platform / software are converted into real(12,11). You can see the values correctly but if you try to overwrite them you can only add values from -9,99999999999 to 9,99999999999.

float_vs_real_attribute_table

Steps to reproduce the issue

  1. Add a vector file with fields defined as 'Float'
  2. Start editing
  3. Try to insert a 2 digit number, it is not possible

Versions

3.22.8-Białowieża
3.28.2-Firenze

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@epc-aac epc-aac added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Feb 14, 2023
@elpaso
Copy link
Contributor

elpaso commented Feb 14, 2023

Can you add a test shapefile please?

Also, can you attach a snapshot of your language settings from

immagine

@elpaso elpaso added Vectors Related to general vector layer handling (not specific data formats) Feedback Waiting on the submitter for answers labels Feb 14, 2023
@epc-aac
Copy link
Author

epc-aac commented Feb 14, 2023

Yes, of course!

options

Here is a shapefile with the same problem:

@elpaso elpaso self-assigned this Feb 14, 2023
@elpaso elpaso removed the Feedback Waiting on the submitter for answers label Feb 14, 2023
@elpaso
Copy link
Contributor

elpaso commented Feb 14, 2023

@epc-aac your shapefile does not contain any field (missing dbf?).

@epc-aac
Copy link
Author

epc-aac commented Feb 14, 2023

Yes, sorry, you can telll this is my first report
Test.zip

@elpaso
Copy link
Contributor

elpaso commented Feb 14, 2023

Ok, this is what happens (to my understanding):

GDAL reports width 13 and precision 11.

Carr_PK_I: Real (13.11)

But, according to https://issues.qgis.org/issues/11755 the width includes the decimal separator (and the minus sign) , so we reduce the width by 1 to accomodate QGIS field model (based on PostGIS where the decimal point is not included)

This was discussed before: #23127

I'm not sure if there is something we can do here because there is not an exact solution to the problem.

IIRC an application can ignore the width and precision in a DBF, in your test file for instance there is

Tram_IMD (Real) = 6000.00000000000

which seems out of bounds to me.

See also https://trac.osgeo.org/gdal/ticket/6960

@elpaso elpaso closed this as completed Feb 14, 2023
@elpaso
Copy link
Contributor

elpaso commented Feb 14, 2023

Note that we might enhance GDAL to handle different conventions when reporting width and precision, this would make it easier to access these informations from QGIS and other applications consistently.

@epc-aac
Copy link
Author

epc-aac commented Feb 14, 2023

Ok, thank you! I get an idea of the issue.

The thing is that someone created shapefile templates for a project and we can't handle them with QGIS. I've used 'refactorfields', so I've changed the template. Hope there will be no problem this time because it is not a final delivery.

@elpaso
Copy link
Contributor

elpaso commented Feb 17, 2023

For reference: OSGeo/gdal#7264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

2 participants