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.
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.