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

Simplify processing algorithm never removes polygon's first/last vertex #39719

Open
uclaros opened this issue Oct 30, 2020 · 3 comments
Open
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! geos Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@uclaros
Copy link
Contributor

uclaros commented Oct 30, 2020

Describe the bug

When using the simplify processing algorithm, if a polygon's first/last vertex is within the specified simplification tolerance it is not removed, resulting a non-simplified polygon. The expected behavior would be to remove the first/last vertex pair and add a new last vertex to the first available vertex.

How to Reproduce

  • Add a polygon layer
  • Digiitize a polygon so that the first vertex is in the middle of a straight segment
  • Run simplify with a tolerance that would cause the first vertex to be removed
  • First vertex is still there

QGIS and OS versions
69faea8 on Debian testing

@uclaros uclaros added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 30, 2020
@uclaros
Copy link
Contributor Author

uclaros commented Oct 30, 2020

It seems like an upstream issue in GEOS, since QgsGeometry::simplify() calls GEOSTopologyPreserveSimplify_r. Or maybe this is by design in geos?

edit: Opened a geos ticket: https://trac.osgeo.org/geos/ticket/1064#ticket

@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Oct 31, 2020
@alexbruy
Copy link
Contributor

@uclaros GEOS ticket is closed, does it work for you now? I still can replicate using the polygon from the GEOS ticket.

@uclaros
Copy link
Contributor Author

uclaros commented Sep 22, 2023

@uclaros GEOS ticket is closed, does it work for you now? I still can replicate using the polygon from the GEOS ticket.

It seems to be partially fixed.
With GEOS 3.12.0-CAPI-1.18.0 only the following two cases still fail:

QgsGeometry.fromWkt('Polygon ((0 42, 42 100, 100 42, 42 42, 0 42))').simplify(1)
QgsGeometry.fromWkt('Polygon ((100 42, 42 42, 0 42, 42 100, 100 42))').simplify(1)

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! geos Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

4 participants