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

Faster polygon combining #681

Merged
merged 2 commits into from
Feb 17, 2024
Merged

Faster polygon combining #681

merged 2 commits into from
Feb 17, 2024

Conversation

systemed
Copy link
Owner

@systemed systemed commented Feb 16, 2024

The combine_polygons_below option significantly slows tile generation (#270). In #383 we moved to faster code but it's still not especially fast.

This PR further improves it by using a neat bit of code from boostorg/geometry#947 (comment). It also successfully merges more adjoining polygons. Newer Boost has merge_elements but we can't rely on users having that yet.

It also removes a bit of template-y indirection by replacing CheckNextObjectAndMerge and MergeIntersecting with a simple while loop.

For Reims using my 2014 Mac mini:

No combine_polygons_below: 12s

Screenshot 2024-02-16 at 10 40 20

Using combine_polygons_below, current master: 122s

Screenshot 2024-02-16 at 10 40 11

Using combine_polygons_below, this PR: 80s

Screenshot 2024-02-16 at 13 38 48

There's clearly still room for improvement (maybe using an rtree to quickly identify polygons that intersect, and only unioning those?) but this is a worthwhile step forward.

@systemed systemed merged commit a393cef into master Feb 17, 2024
8 checks passed
@systemed systemed deleted the combine_polygons branch February 17, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant