Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the Visvalingam-Whyatt algorithm as an alternative simplification method.
This works by eliminating those points which create the smallest triangular area. It therefore picks up 'spikes' - long, thin protuberances from the line - which Douglas-Peucker would tolerate. It's often used for coastlines and for landuse polygons.
The code is almost exactly @e-n-f's (MIT-licensed) implementation from tippecanoe, based on a Go original by @paulmach. My contribution is just gluing it into tilemaker!
make_valid
after simplifying a multipolygon, which should catch the most egregious self-intersections.combine_below
is used. The latter can create V-shaped road polylines, particularly in the case where a dual carriageway merges into a single carriageway. Visvalingam-Whyatt will see that as a spike and eliminate it entirely.simplify_algorithm
layer parameter is a string rather than a bool.Douglas-Peucker airfield:
Visvalingam-Whyatt airfield:
Douglas-Peucker coastline:
Visvalingam-Whyatt coastline - note that the inlets have been simplified away:
Running a Europe extract with the ocean layer set to
visvalingam
seems to be reliable and not produce any leaky tiles that I've found so far, so I'm inclined to change the OMT-compatible JSON accordingly.