mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-03 00:45:41 +02:00
Add MLT (MapLibre Tile) output format
Integrate the C++ MLT encoder from maplibre-tile-spec as a submodule. Tiles are encoded by converting the existing mvt_tile to mlt::Encoder::Layer and calling the encoder library directly. New CLI flags: --output-format=mlt Encode tiles as MLT instead of MVT --pretessellate Pre-triangulate polygons (MLT only) --no-mlt-feature-sort Disable within-tile Hilbert sorting (MLT only) MLT tiles use .mlt extension in directory output and format=mlt in mbtiles metadata. Compression and all existing flags work unchanged.
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "serial.hpp"
|
||||
#include "options.hpp"
|
||||
#include "main.hpp"
|
||||
#include "mlt.hpp"
|
||||
#include "write_json.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "evaluator.hpp"
|
||||
@@ -2847,7 +2848,12 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
|
||||
std::string compressed;
|
||||
std::string pbf = tile.encode();
|
||||
std::string pbf;
|
||||
if (output_format == OUTPUT_MLT) {
|
||||
pbf = encode_as_mlt(tile, mlt_sort_features, mlt_pretessellate);
|
||||
} else {
|
||||
pbf = tile.encode();
|
||||
}
|
||||
|
||||
tile.layers.clear();
|
||||
|
||||
@@ -3022,7 +3028,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
if (outdb != NULL) {
|
||||
mbtiles_write_tile(outdb, z, tx, ty, compressed.data(), compressed.size());
|
||||
} else if (outdir != NULL) {
|
||||
dir_write_tile(outdir, z, tx, ty, compressed);
|
||||
const char *tile_ext = (output_format == OUTPUT_MLT) ? ".mlt" : ".pbf";
|
||||
dir_write_tile(outdir, z, tx, ty, compressed, tile_ext);
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(&db_lock) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user