Simplify/rounding leads to visible artifacts
Opened this issue · 0 comments
Example 1: https://6ug7hetxl9.execute-api.us-east-2.amazonaws.com/data/v3/#19/42.3479612/-71.0453793
Ramp disconnects from highway.
Described on Slack https://osmus.slack.com/archives/C031V9E9RMG/p1657919128131109
Example 2: https://6ug7hetxl9.execute-api.us-east-2.amazonaws.com/data/v3/#19/51.9659155/5.6627435
Described in ZeLonewolf/openstreetmap-americana#541
Gaps and overlaps are introduced in buildings.
In both these cases the data is z14 and viewed at z19.
I conjecture that it might be possible to do a topology-preserving simplification, but that's probably quite complicated.
@msbarry's comments from Slack:
ok so it looks it's using douglas peucker to simplify that geometry with a tolerance equal to the output grid size (1/4096th of the tile, or about 9 inches at boston's latitude), then it slices up the feature into tile and when emitting the tile feature, it rounds points to the 4096x4096 tile grid.
9 inches sounds about right since the 2 lanes of summer street there are ~30 feet apart
if I set the simplify tolerance to 1/2 the grid size (1/8192 of a tile) then it looks right
I'm wondering if there's a tolerance you can confidently set to be sure it won't introduce artifacts like this, or if there's always a possibility
running over all of massachusetts, cutting simplify_tolerance_at_max_zoom from 1/4096 to 1/8192 (9" to 4.5") adds about 1% to mbtiles size and intermediate feature storage, so not too big of a deal