tippecanoe icon indicating copy to clipboard operation
tippecanoe copied to clipboard

Feature request: PMTiles output

Open bdon opened this issue 3 years ago • 6 comments

It's convenient to output PMTiles directly instead of traversing MBTiles first.

bdon avatar Feb 10 '22 04:02 bdon

The part for writing metadata is shared between dirtiles and mbtiles, is a little hairy to extend for pmtiles: https://github.com/protomaps/tippecanoe/blob/master/mbtiles.cpp#L270

bdon avatar Jul 06 '22 07:07 bdon

Sorry, it was easier to do it this way than to write something really generic and then use it for both writers. Does pmtiles use the same metadata format?

e-n-f avatar Jul 06 '22 15:07 e-n-f

it just embeds JSON. However, v3 is going to be a little different by promoting certain metadata fields like minzoom, maxzoom and bounds into fixed-size parts of the header; this enables lower time-to-first-draw since the map viewport can be initialized with a small number of fixed header bytes. Those fields would then be absent from the JSON metadata. So it seems worth refactoring a bit here in order to make metadata not depend on SQLite.

bdon avatar Jul 06 '22 16:07 bdon

https://github.com/protomaps/tippecanoe/tree/refactor-metadata : WIP on moving the metadata logic out of mbtiles.cpp into a new metadata.cpp; to do: split the behavior based on outdb/outdir/outfile instead of going through mbtiles each time

https://github.com/protomaps/tippecanoe/tree/pmtiles writes tiles to a std::ostream, completing the tile-writing part of PMTiles, but does not yet write directories, header information, or metadata

bdon avatar Jul 07 '22 09:07 bdon

  • Need a JSON implementation to write metadata (use the one already in tippecanoe)
  • Need a hash implementation to perform deduplication (either bring in XXHash dependency, implement FNV, or... is there some way in tippecanoe tile generation to shortcut deduplication check?)

bdon avatar Jul 29 '22 15:07 bdon

C++ writer implementation is now here, though it does not choose a leaf level:

https://github.com/protomaps/PMTiles/blob/master/cpp/pmtiles.hpp

likely best way is to just inline this header into tippecanoe source tree like other dependencies.

bdon avatar Jul 30 '22 03:07 bdon

migrated issue to https://github.com/felt/tippecanoe/issues/10

bdon avatar Sep 16 '22 03:09 bdon