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

Avoid creating small artefacts when scaling #602

Merged
merged 2 commits into from
Dec 5, 2023
Merged

Conversation

systemed
Copy link
Owner

@systemed systemed commented Dec 4, 2023

When we scale geometries from projected lat / lon to vector tile coordinates, we often create small spikes and self-intersecting triangles/squares, particularly on intricate geometries like coastlines at lower zoom levels. Although the simplify operation does a good job of removing these, we stand a better chance of producing valid geometries if we don't create these artefacts in the first place.

This PR uses a naive algorithm to minimise the chance of small artefacts. When scaling, for each point, it checks the last five points to see if it duplicates any of them. If so, we backtrack to that point and discard the intervening points.

This appears to fix geometry issues in Andros and the Hebrides. Output tilesize is very slightly reduced and there's no discernible impact on runtimes.

@systemed systemed merged commit d470dc9 into master Dec 5, 2023
5 checks passed
@systemed systemed deleted the scale_backtrack branch December 5, 2023 09:46
@systemed systemed mentioned this pull request Dec 6, 2023
@cldellow cldellow mentioned this pull request Dec 27, 2023
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