Bug report #7638

MSSQL data provider rounds geometry on save

Added by Matthew Schubert over 11 years ago. Updated about 11 years ago.

Status:Closed
Priority:High
Assignee:Tamas Szekeres
Category:Data Provider/MSSQL
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16559

Description

I've been using a data source coming from an MS SQL server table. I noticed on copying across points to the layer and saving it, the points end up in a slightly different position to the source.

More investigation points to the MS SQL data provider using WKT to insert/update geometry. Because it uses QgsGeometry::exportToWkt(), the WKT is rounded to 6 decimal places. For my source data, this resulted in inaccuracies of approximately 50mm or so.

There is a mUseWkb flag used in QgsMssqlProvider to determine whether WKT or WKB is used, but I have no idea how to set that option from within QGIS. Shouldn't the provider avoid rounding on updating, anyway?

Associated revisions

Revision b1efd479
Added by Jürgen Fischer about 11 years ago

- introduce qgsDoubleToString for format double with maximum precision
- usage in mssql provider fixes #7638
- read precision in mssql provider (fixes #5966)
- commit errors are only shown once

History

#1 Updated by Matthew Schubert over 11 years ago

Further investigation indicates that QgsGeometry::exportToWkt() now rounds to 8 decimal places instead of 6, as of 63e8188bb9d62c9a810ee41f63f36c76db3cc3a1. Still, I think the code should be change to introduce NO rounding errors on save.

#2 Updated by Nathan Woodrow over 11 years ago

  • Priority changed from Normal to High
  • Assignee set to Tamas Szekeres

Tamas would be able to take a look at this?

#3 Updated by Paolo Cavallini about 11 years ago

  • Category set to Data Provider/MSSQL

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

  • Status changed from Open to Closed

Also available in: Atom PDF