felt/tippecanoe

Incorrect header maxzoom for Google-Microsoft Open Building dataset PMTiles

Closed this issue · 7 comments

giswqs commented

The Google-Microsoft Open Buildings on source.coop @jedsundwall has an incorrect header of 15 when it should be 13 to over zoom correctly. See PMTiles Viewer. The building layer disappears when zoom level is higher than 13, making it infeasible to see the details of building footprints. According to the tweet by @bdon, there might be a missing piece of functionality in tippecanoe's tile-join.

I'm not sure how PMTiles are built, but on a global scale you may be looking at a billion tiles at zoom 15. That zoom level could be intentional for size reasons.

giswqs commented

I understand the size reasons. However, if we can't see the details of the building footprints, then the dataset become less useful. The screenshot below shows the max zoom level we can see. They are too small to see.

image

if we can't see the details of the building footprints, then the dataset become less useful.

I couldn't agree more. If you're using OSM base map, it has footprints, that's where the > 13 zoom becomes critical. FlatGeobuf is lossless, easy to consume, perfect for high zoom and you can interact with them on Leaflet. Bonus, you don't have to wrestle with the whole parquet debacle.

bdon commented

Viewer: https://protomaps.github.io/PMTiles/?url=https%3A%2F%2Fdata.source.coop%2Fvida%2Fgoogle-microsoft-open-buildings%2Fpmtiles%2Fgo_ms_building_footprints.pmtiles#map=16.52/9.527198/-7.790635&inspector=14/7837/7786

There are certain parts of the dataset that include z15 data, so the maxzoom is actually correct

Based on the metadata the tileset was generated using many tile-join operations. If you tile-join tilesets with different maxzooms, then the lower-maxzoom tileset needs to have its data over zoomed to match the higher-maxzoom tileset. @e-n-f should this be the default behavior? Otherwise it's easy to create tilesets without proper overzooming.

bdon commented
ogr2ogr naturalearth/110m_cultural/ne_110m_admin_1_states_provinces.shp -f GeoJsonSeq | tippecanoe -o states.pmtiles --maximum-zoom=5
ogr2ogr naturalearth/110m_cultural/ne_110m_admin_0_countries.shp -f GeoJsonSeq | tippecanoe -o countries.pmtiles --maximum-zoom=4

creates correct archives with maxzoom=5 and maxzoom=4 respectively.

./tile-join countries.pmtiles states.pmtiles -o joined.pmtiles
Warning: mismatched maxzooms: 4 in countries.pmtiles vs previous 5

Reproduces the display problem.

Screenshot 2023-09-27 at 11 49 40
./tile-join countries.pmtiles states.pmtiles -o joined.pmtiles --overzoom

correct!

Screenshot 2023-09-27 at 11 51 22

So the publishers of the original dataset need to be passing --overzoom to tile-join. A warning is being emitted, but it should probably be a scarier warning about broken overzoom behavior, or we should make overzooming the default (and add a --no-overzoom option?

dvd3v commented

Publisher of the dataset here, thanks for picking this up 🙏

We indeed used tile-join in order to apply a parallel processing strategy by first creating PMTiles per country in parallel and then tile-joining them. This needs quite a bit of memory but is a significantly faster approach compared to using Tippecanoe directly on the global dataset. We were aware of some overzooming issues, but did not know that tile-joining different zoom levels does not work correctly without the --overzoom flag. We've updated the dataset on Source Cooperative (created using the direct Tippecanoe approach), with the correct zoom levels up to 15.

I will create a MR for:

  • updating the docs, mentioning the broken overzoom behaviour when tile-joining dataset with different zoom levels
  • A better warning, stating the broken overzoom behaviour.
giswqs commented

@dvd3v Thank you for fixing it so quickly and thank you @bdon for debugging the issue. So nice to see the crystal clear building footprints!

Web app: https://apps.opengeos.org/buildings.html
Notebook: https://leafmap.org/notebooks/82_pmtiles

Screenshot 2023-09-27 at 7 38 51 AM