Bug report #13893

Short arcs/curves have wrong center and radius and results big circles to map

Added by Timo Iipponen over 8 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:Marco Hugentobler
Category:Geometry
Affected QGIS version:2.12.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21915

Description

Hi

I have noticed that short circular arc/curve geometries in QGIS gets wrong center and radius and so they are also drawn incorrectly.
As a result there can be seen big circles in many places in map data.

I made one example for you to see incorrect result.

I attached three CSV (WKT) files.
You can add them in QGIS separately to three layers with following parameters:

Files:
arc_endpoints_line.txt
arc_points_linestring.txt
arc_wrong_circle.txt

Separator: ";"
First row has attribute names
Geometry format: Well known text (WKT)
Geometry attribute: wkt_geom
Geometry type: lookup
Coordinate system: EPSG:3879 (ETRS89 / GK25FIN)

In levels window, put off level "arc_wrong_circle"
Put on levels "arc_endpoints_line" and "arc_points_linestring"
Zoom to full.
Put different colors for levels to identify them and zoom more near line centers.
See that "arc_endpoints_line" is on right side of "arc_points_linestring" which means that correct circle center should be on right side too.
Geometry "arc_wrong_circle" shows that QGIS calculates circle center on wrong side and it's radius is also wrong

I find one place in your code, that I would like to make better (I don't know if there are more functions of same kind).

void QgsGeometryUtils::circleCenterRadius
Definition at line 269 of file qgsgeometryutils.cpp

My replacement code is in attachment file QgsGeometryUtils_circleCenterRadius.txt

I have tested my code with Python in Safe Software FME environment and also in PostGIS environment with 17000 arcs inside different kind of geometries and it has looked good.

Our staff in City of Helsinki is using QGIS more and more, so it would be nice if someone has time to make this correction to code.

Sincerely yours

Timo Iipponen
GIS expert
City of Helsinki, Finland

QgsGeometryUtils_circleCenterRadius.txt Magnifier (1.28 KB) Timo Iipponen, 2015-11-28 10:16 AM

arc_endpoints_line.txt Magnifier (127 Bytes) Timo Iipponen, 2015-11-28 10:16 AM

arc_points_linestring.txt Magnifier (171 Bytes) Timo Iipponen, 2015-11-28 10:16 AM

arc_wrong_circle.txt Magnifier (159 Bytes) Timo Iipponen, 2015-11-28 10:16 AM

History

#1 Updated by Giovanni Manghi over 8 years ago

  • Category set to Geometry
  • Pull Request or Patch supplied changed from No to Yes
  • Priority changed from High to Normal
  • Assignee set to Marco Hugentobler
  • Status changed from Open to Feedback

Hi Timo, thanks for the patch. May I ask you to submit it as pull request on QGIS github repository?

https://github.com/qgis/QGIS

Thanks!

#2 Updated by Timo Iipponen over 8 years ago

Can I please skip that and some more experienced can do. Help pages looked quite complicated and I am leaving to travel for one week. After than I can look more if needed.

The meaning of this bug fix is that without it, the QGIS is complete useless for data with curves. I hope somebody finds interest to do this while I am away. Either I try to do after my travel.

Anyway afterwards I can do big testing with real data.

#3 Updated by Giovanni Manghi over 8 years ago

  • Status changed from Feedback to Open

#4 Updated by Marco Hugentobler over 8 years ago

Will try the patch in the next days.

#5 Updated by Marco Hugentobler over 8 years ago

  • Status changed from Open to Closed

Applied to master branch. Thanks, Timo.

Also available in: Atom PDF