systemed / tilemaker

Make OpenStreetMap vector tiles without the stack
https://tilemaker.org/
Other
1.44k stars 229 forks source link

Clipping monster polygons 2 #607

Closed cldellow closed 9 months ago

cldellow commented 9 months ago

This replaces https://github.com/systemed/tilemaker/pull/606, fixes #605

When writing, we keep a cache of previously clipped geometries. Higher zooms will prefer to clip a cached, clipped geometry over an uncached, unclipped geometry.

With this PR:

Antarctica doesn't max out the CPU due to https://github.com/systemed/tilemaker/issues/596 - I think a next step there could be to have a buffer so workers can just enqueue a tile (up to some limit) and move on with their work.

I also noticed that the Antarctica mbtiles couldn't be converted by the pmtiles convert command. I suspect this is a pre-existing issue, but I've never generated Antarctica before. My guess is it's related to https://github.com/systemed/tilemaker/blob/06b68df2a969fc6ddc1e579ee6747458661d8683/src/tile_worker.cpp#L187, and we need to not write a tile at all if it has no features, not just remove the empty feature.

Probably it's OK to tackle that as a separate issue.

cldellow commented 9 months ago

This and https://github.com/systemed/tilemaker/pull/590 lets me generate North America in 43 minutes! The resulting mbtiles was able to be converted to a pmtiles file, which gives me some comfort that the Antarctica thing is probably unique to Antarctica.

Runtime looked like it was also impacted by #596, so hopefully we can do better than 43 minutes, too. (updated: with #608, it takes a little less than 40 minutes)

systemed commented 9 months ago

This is a really neat, elegant solution! Thank you.