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

Retry with boost::geometry::intersection if fast_clip fails #597

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

systemed
Copy link
Owner

As per #594 and #574/#580, Maplibre GL Native objects to the 0-width borders around tile margins that fast_clip can create.

This PR falls back to boost::geometry::intersection when we're in a situation where self-intersections persist. We don't use make_valid (i.e. the custom correct code) at all in this case, just plain vanilla boost::geometry::correct. I've tested it with the original problem regions of Venice and Copenhagen, and with the additional problem areas of Athens and Shetland, and it appears to work reliably.

Performance is downgraded but less than I expected:

  • Antarctica was 7hr29 in 2.0, was 2hr59 with fast_clip, now 3hr04
  • Maine (canonical example for horrid multipolygons) was 34m37 in 2.0, was 4m23 with fast_clip, now 5m32
  • Great Britain was 7m03 recently, 7m26 with make_valid, now 7m39

Given that this retains most of the performance gain while reliably producing correct geometries, I'm inclined to merge this. We can look at options for other clipping algorithms in the future.

There is one remaining issue where South Uist can disappear at z5, but I think this is a simplify problem rather than a clipping problem - simplify is creating a 0-width connection between the two islands.

@systemed systemed merged commit 1c2037f into master Dec 1, 2023
5 checks passed
@systemed systemed deleted the retry_invalid branch December 1, 2023 13: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