Bug report #11755

Real precision (Shapefile)

Added by Loïc BARTOLETTI about 5 years ago. Updated about 4 years ago.

Status:Closed
Priority:Normal
Assignee:Jürgen Fischer
Category:-
Affected QGIS version:2.6.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:19987

Description

I think there is a bug with QGis 2.6 and dev (a68958f) with real attribute.

Into a column with real QGis round the last digit.

Example :
Add a column ELEVATION real "Length 6" and "Precision 2"
Add a point and into attribute "1000.25"
After saving the modification Qgis show as attribute "1000.20"

Normaly the "point" isn't into length.


Related issues

Related to QGIS Application - Bug report #12985: Shapefile: The length of real type field is reduced by 1 ... Closed 2015-06-17
Related to QGIS Application - Bug report #15188: Importing .shp files into PostGIS fails (Error 7) Closed 2016-07-01

Associated revisions

Revision 2fcbc8bb
Added by Jürgen Fischer over 4 years ago

ogr provider: increase width by one for decimal point if precision is given (fixes #11755)

Revision c9803324
Added by Jürgen Fischer over 4 years ago

ogr provider: increase width by one for decimal point if precision is given
(fixes #11755, fixes #12985)

(cherry picked from commit 2fcbc8b and 513cfad)

History

#1 Updated by Jürgen Fischer over 4 years ago

  • Pull Request or Patch supplied changed from No to Yes

#2 Updated by Jürgen Fischer over 4 years ago

  • Status changed from Open to Closed

#3 Updated by Loïc BARTOLETTI about 4 years ago

  • Assignee set to Jürgen Fischer
  • Status changed from Closed to Reopened

This hack preserve last digit but allow unhautorized value. When you add a value you can do something like this: "12345.78". Normally, the max is "9999.99".

Probleme is that when you create a field with real(6,2) QGis create a DBF with real(7,2). Also, ShapeFile with real(6,2) are shown with real(5.2). You can see that with ogrinfo.

Thanks.

#4 Updated by Jürgen Fischer about 4 years ago

  • Resolution set to fixed/implemented
  • Status changed from Reopened to Closed

Loïc BARTOLETTI wrote:

This hack preserve last digit but allow unhautorized value. When you add a value you can do something like this: "12345.78". Normally, the max is "9999.99".
Probleme is that when you create a field with real(6,2) QGis create a DBF with real(7,2). Also, ShapeFile with real(6,2) are shown with real(5.2). You can see that with ogrinfo.

Actually that is just what the fix is supposed to do. QGIS (and for instance PostgreSQL) don't count the decimal point in - so 12345.78 corresponds to width 7, precision 2. OGR however includes the decimal point in the width - so 7,2 in QGIS has to become 8,2 in OGR.

Also available in: Atom PDF