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

Union with snapping heuristic is very slow #485

Closed
dr-jts opened this issue Oct 10, 2019 · 3 comments
Closed

Union with snapping heuristic is very slow #485

dr-jts opened this issue Oct 10, 2019 · 3 comments

Comments

@dr-jts
Copy link
Contributor

dr-jts commented Oct 10, 2019

Original source: GEOS 997.

Union of two large geometries runs the snapping heuristic due to a noding robustness error. Because of the size of the geometries snapping is extremely slow.

A fix is not currently obvious. Some options are:

  • Instead of the snapping heuristic use the buffer(0) hack (which in this case also invokes some rounding to handle the noding issue, so does round all output vertices somewhat)
  • It might be possible to a priori decide if snapping will take "too long" and only then use buffer(0)
  • The new overlay code in the works does not use snapping. However, it does requires rounding to a defined precision model (which is generally a Good Thing, but is a small change in semantics)
@dr-jts
Copy link
Contributor Author

dr-jts commented Oct 10, 2019

Test case reproducing the slowness.

geos997-slow-union.xml.zip

@dr-jts
Copy link
Contributor Author

dr-jts commented Oct 10, 2019

Interestingly, the polygons causing the issue are a result of buffering polygons from a polygonal coverage. The failure point is a point on the buffer outline which is computed slightly differently in each polygon. This is likely due to imprecision when computing the round buffer fillets where one segment of the base convex angle is the same, and the other different.

This kind of effect could be avoided by computing the buffers using a defined precision model. (In fact, the original problem was worked around by snapping the buffer results to a grid with grid size 0.001)

@dr-jts
Copy link
Contributor Author

dr-jts commented Jun 13, 2020

OverlayNG using the SnappingNoder fixes this issue.

@dr-jts dr-jts closed this as completed Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant