Files
tippecanoe/mlt.hpp
T
Claude 13f1c3b6e4 Let tile-join and tippecanoe-overzoom write MLT tiles too
Both tools could read MapLibre Tiles but only ever wrote Mapbox Vector
Tiles, so there was no way to convert a tileset into MLT, or to keep a
tileset in MLT once it had been through either of them.

Give them the same --output-format, --pretessellate, and
--no-mlt-feature-sort options that tippecanoe has. tile-join writes the
chosen format to mbtiles files, PMTiles archives, and tile directories,
naming directory tiles and the tileset metadata format accordingly, and
tippecanoe-overzoom writes it to its output tile. Either tool will read
whichever format its sources are in regardless of what it is writing.

The output format selection and the MLT encoder options now live in
mlt.cpp, shared by all three tools rather than defined in main.cpp for
tippecanoe alone, along with encode_tile() for encoding a tile in the
selected format. overzoom() takes the format as a parameter, since
tile-join uses it internally to rescale tiles that will be re-encoded
afterward, and those intermediate tiles should stay MVT.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LxhELiLtpUFwrPSWwTYdHG
2026-08-06 17:34:02 +00:00

38 lines
1.2 KiB
C++

#ifndef MLT_HPP
#define MLT_HPP
#include <string>
#include "mvt.hpp"
// The tile format to write, and the MLT encoder options to write it with,
// as selected on the command line.
extern int output_format;
extern bool mlt_sort_features;
extern bool mlt_pretessellate;
// Set output_format from an --output-format argument, complaining and
// exiting if it names a format we can't write.
void set_output_format(char **argv, const char *format);
// What this tile format is called in tileset metadata
const char *tile_format_name(int format);
// What tiles of this format are named in a tile directory
const char *tile_format_extension(int format);
// Encode a tile in the specified format, using whichever MLT encoder
// options were selected on the command line
std::string encode_tile(mvt_tile &tile, int format);
std::string encode_as_mlt(const mvt_tile &tile, bool sort_features, bool pretessellate);
// Does this (already decompressed) tile look like MapLibre Tile rather than
// Mapbox Vector Tile data?
bool is_mlt(const std::string &message);
// Decode a MapLibre Tile into the equivalent vector tile, returning false
// (and complaining to stderr) if it can't be parsed.
bool decode_mlt(const std::string &message, mvt_tile &out);
#endif