Repository navigation
Conversation
Add an optional MLT writer, built with -DTILEMAKER_WITH_MLT=ON and selected with "tile_format": "mlt". The tile writing code is templated over an MVT (vtzero) and an MLT backend; MLT tiles are encoded with the maplibre-tile-spec C++ encoder, fetched at a pinned commit. - PMTiles tile type 0x06, MBTiles format=mlt, .mlt directory output - feature order (ZOrder) preserved; mixed int/float columns kept numeric - fast encoder settings for compressed output - CMake build moves to C++20, with fixes for Boost 1.74 Asio and the bundled sqlite_modern_cpp; Dockerfile and Linux CI build with MLT Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
|
Thank you - this is brilliant. Fully supportive of the opt-in approach because of the increased system requirements but we can maybe move to opt-out some time in the future. I'll take a proper look in the next couple of days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds optional MapLibre Tile (MLT) output, as discussed in #856. It's off by default at build time and in the config; MVT output is unchanged.
Results (Switzerland, bundled OpenMapTiles profile, .pmtiles; details below):
Usage
Build with
-DTILEMAKER_WITH_MLT=ON, then set"tile_format": "mlt"insettings. Lua profiles and layer configs don't change. In MapLibre styles, the source needs"encoding": "mlt".0x06(MapLibre Tile)formatismltz/x/y.mlt--mergeis rejected with MLT (merging needs to decode existing tiles; could be added later with the MLT decoder)How it works
FetchContentat a pinned commit. Only the encoder target and its two needed submodules (fsst, earcut) are used.FETCHCONTENT_SOURCE_DIR_MLTcan point at a local checkout for offline builds.tile_worker.cpp's write functions are templated over a small backend. The MVT backend is plain vtzero, so the MVT code path compiles to the same thing as before. The MLT backend (mlt_writer.h) has builders with the same method names that collect a tile's features, then encodes once per tile with a thread-local encoder.sortFeaturesoff), soZOrderstill controls draw order.AttributeIntegerandAttributeNumericon the same key in one layer stay numeric.BOOST_ASIO_DISABLE_CO_AWAIT(Boost 1.74's Asio coroutine header doesn't compile as C++20; tilemaker doesn't use coroutines), andstd::uncaught_exceptions()instead of the removedstd::uncaught_exception()in the bundled sqlite_modern_cpp (MSVC). The Makefile build is unchanged and has no MLT support. MLT itself needs CMake 3.25+ (required by maplibre-tile-spec).gitandca-certificatesfor the fetch). The Linux CMake CI job builds with MLT and writes an MLT .pmtiles of Liechtenstein.Testing
class=trackinstead ofpath. That turned out to be an existing intermittent issue on master (in 4 of 5 runs of unmodified master on Luxembourg); I'll report it separately.AttributeIntegerandAttributeNumericto the same key gives aDOUBLEcolumn with the expected values.make testpasses, including a new config validator test fortile_format.Benchmarks
Switzerland (548 MB .osm.pbf), bundled OpenMapTiles profile, .pmtiles output, 22 threads, average of 3 interleaved runs:
MVT is unchanged within noise. MLT is about 8% slower with under 1% more memory, for tiles 12% smaller.
Encoder settings, single-threaded, Luxembourg tiles, sizes after zlib:
Open questions
EncoderConfig::geometryEncodingOptionis commented upstream as "primarily for testing". The commit is pinned, but it may be worth asking maplibre-tile-spec to treat it as supported.🤖 Generated with Claude Code