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

Polygon clipping performance #129

Open
asinghvi17 opened this issue Apr 24, 2024 · 8 comments
Open

Polygon clipping performance #129

asinghvi17 opened this issue Apr 24, 2024 · 8 comments
Labels
bug Something isn't working clipping About polygon clipping or processing help wanted Extra attention is needed juliacon To be implemented for JuliaCon

Comments

@asinghvi17
Copy link
Member

For a lot of geospatial usecases, polygons of size > 100 are de rigueur. GeometryOps' performance on these polygons is horrible, more than 10x slower than LibGEOS.

This could probably be improved by a monotone chain optimization, which we should add. This will probably also need the prepared geometry interface.

@asinghvi17 asinghvi17 added bug Something isn't working help wanted Extra attention is needed juliacon To be implemented for JuliaCon clipping About polygon clipping or processing labels Apr 24, 2024
@skygering
Copy link
Collaborator

Polygons with holes are also pretty bad. For example:

import GeoInterface as GI
import LibGEOS as GO
p25 = GI.Polygon([[(0.0, 0.0), (5.0, 0.0), (5.0, 8.0), (0.0, 8.0), (0.0, 0.0)], [(4.0, 0.5), (4.5, 0.5), (4.5, 3.5), (4.0, 3.5), (4.0, 0.5)], [(2.0, 4.0), (4.0, 4.0), (4.0, 6.0), (2.0, 6.0), (2.0, 4.0)]])
p26 = GI.Polygon([[(3.0, 1.0), (8.0, 1.0), (8.0, 7.0), (3.0, 7.0), (3.0, 5.0), (6.0, 5.0), (6.0, 3.0), (3.0, 3.0), (3.0, 1.0)], [(3.5, 5.5), (6.0, 5.5), (6.0, 6.5), (3.5, 6.5), (3.5, 5.5)],  [(5.5, 1.5), (5.5, 2.5), (3.5, 2.5), (3.5, 1.5), (5.5, 1.5)]])
Screenshot 2024-04-24 at 2 11 41 PM Screenshot 2024-04-24 at 2 18 14 PM

@asinghvi17
Copy link
Member Author

asinghvi17 commented Apr 24, 2024

Huh! We should add the test suite polygons as benchmarks as well, so that all the bases are covered. That could be a good start to a PkgBenchmark type of thing, since the current benchmarks are more focused on scaling across number of vertices which there isn't really a good solution for (yet) in the benchmark world.

This timing is without ExactPredicates as well I assume, so that probably isn't the issue. Is the timing done with ExactPredicates enabled?

@skygering
Copy link
Collaborator

This is with ExactPredicates since I was just testing a few of things in the REPL.

@asinghvi17
Copy link
Member Author

I just ran an example with the number of vertices increased (using segmentize) and found the following:
download-10
(this is pre-ExactPredicates but I will check that branch and post a plot as well)

@asinghvi17
Copy link
Member Author

Huh...exactpredicates is really hitting performance hard here.
download-11

@rafaqz
Copy link
Member

rafaqz commented Apr 24, 2024

The problem is scaling... not ExactPredicates

Ugh no if that is one point on the left then the scaling is just from our head start.

@asinghvi17
Copy link
Member Author

Yeah, looks like it...on the bright side, we at least have a head start :D

@asinghvi17
Copy link
Member Author

The code for that plot is in Caltech-OCTO#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working clipping About polygon clipping or processing help wanted Extra attention is needed juliacon To be implemented for JuliaCon
Projects
None yet
Development

No branches or pull requests

3 participants