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.
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 usemake_valid
(i.e. the custom correct code) at all in this case, just plain vanillaboost::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:
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.