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

Oriented Minimum Bounding Box gives incorrect result. #36632

Closed
GeoEugeneK opened this issue May 22, 2020 · 0 comments · Fixed by #36643
Closed

Oriented Minimum Bounding Box gives incorrect result. #36632

GeoEugeneK opened this issue May 22, 2020 · 0 comments · Fixed by #36643
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@GeoEugeneK
Copy link

QGIS 3.12 / Windows 10
Lately I have been using Oriented Minimum Bounding Box a lot and found out it sometimes produces a totally wrong output. I guess the bug happens in the low-level part of the algorithm implementation as it persists with both QgsGeometry.orientedMinimumBoundingBox() method of Python API and when calling corresponding processing algo, regardless of the CRS used (tried with EPSG:3857, EPSG:32631 and WGS 84).

pic

How to reproduce:

  1. Use the following WKT geometry (EPSG:32631):
    Polygon ((-167581.30771802365779877 12253.1009764485170308, -169728.33899063381250016 11811.64286796574924665, -169728.21535189682617784 10929.38266212840426306, -169311.85422288533300161 10223.62778342491401418, -168260.27974171470850706 10709.01371703742006503, -159956.56253779400140047 12916.02958690263949393, -167581.30771802365779877 12253.1009764485170308))

  2. Run QgsGeometry.orientedMinimumBoundingBox() on a newly constructed geometry or add the geometry to a Polygon layer (EPSG:32631) and use Oriented minimum bounding box tool from Processing Toolbox.

In both cases, you should receive the following result:

  • geometry (WKT)
    Polygon ((-2326.23927114296566288 8046.58608674397964933, 5786.00995210356086318 12863.23406304659511079, 3714.32692187554675911 16352.38442974641657202, -4397.92230137097976694 11535.73645344379838207, -2326.23927114296566288 8046.58608674397964933))

  • height: 4057.836968

  • width: 9434.441435

  • area (sq m in EPSG:32631): 38283425.227139

  • perimeter 26984.556806

  • angle: 149.300277

Some general QGIS info:
image

@GeoEugeneK GeoEugeneK added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 22, 2020
@nyalldawson nyalldawson self-assigned this May 22, 2020
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue May 24, 2020
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue May 26, 2020
nyalldawson added a commit that referenced this issue Jun 19, 2020
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!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants