mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +02:00
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
This commit is contained in:
+13
-3
@@ -24,6 +24,7 @@
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
#include "mvt.hpp"
|
||||
#include "mlt.hpp"
|
||||
#include "projection.hpp"
|
||||
#include "mbtiles.hpp"
|
||||
#include "geometry.hpp"
|
||||
@@ -871,7 +872,7 @@ void *join_worker(void *v) {
|
||||
}
|
||||
|
||||
if (anything) {
|
||||
std::string pbf = outtile.encode();
|
||||
std::string pbf = encode_tile(outtile, output_format);
|
||||
std::string compressed;
|
||||
|
||||
if (!pC) {
|
||||
@@ -958,7 +959,7 @@ void dispatch_tasks(std::map<zxy, std::vector<std::string>> &tasks, std::vector<
|
||||
if (outdb != NULL) {
|
||||
mbtiles_write_tile(outdb, ai->first.z, ai->first.x, ai->first.y, ai->second.data(), ai->second.size());
|
||||
} else if (outdir != NULL) {
|
||||
dir_write_tile(outdir, ai->first.z, ai->first.x, ai->first.y, ai->second);
|
||||
dir_write_tile(outdir, ai->first.z, ai->first.x, ai->first.y, ai->second, tile_format_extension(output_format));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1335,6 +1336,9 @@ int main(int argc, char **argv) {
|
||||
{"tile-stats-sample-values-limit", required_argument, 0, '~'},
|
||||
{"tile-stats-values-limit", required_argument, 0, '~'},
|
||||
{"unidecode-data", required_argument, 0, '~'},
|
||||
{"output-format", required_argument, 0, '~'},
|
||||
{"pretessellate", no_argument, 0, '~'},
|
||||
{"no-mlt-feature-sort", no_argument, 0, '~'},
|
||||
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
@@ -1515,6 +1519,12 @@ int main(int argc, char **argv) {
|
||||
exclude_all_tile_attributes = true;
|
||||
} else if (strcmp(opt, "exclude-all-tile-geometries") == 0) {
|
||||
exclude_all_tile_geometries = true;
|
||||
} else if (strcmp(opt, "output-format") == 0) {
|
||||
set_output_format(argv, optarg);
|
||||
} else if (strcmp(opt, "pretessellate") == 0) {
|
||||
mlt_pretessellate = true;
|
||||
} else if (strcmp(opt, "no-mlt-feature-sort") == 0) {
|
||||
mlt_sort_features = false;
|
||||
} else {
|
||||
fprintf(stderr, "%s: Unrecognized option --%s\n", argv[0], opt);
|
||||
exit(EXIT_ARGS);
|
||||
@@ -1636,7 +1646,7 @@ int main(int argc, char **argv) {
|
||||
st.maxlon2 = st.maxlon;
|
||||
}
|
||||
|
||||
metadata m = make_metadata(name.c_str(), st.minzoom, st.maxzoom, st.minlat, st.minlon, st.maxlat, st.maxlon, st.minlat2, st.minlon2, st.maxlat2, st.maxlon2, st.midlat, st.midlon, attribution.size() != 0 ? attribution.c_str() : NULL, layermap, "pbf", description.c_str(), !pg, attribute_descriptions, "tile-join", generator_options, strategies, st.maxzoom, 2.5, 1);
|
||||
metadata m = make_metadata(name.c_str(), st.minzoom, st.maxzoom, st.minlat, st.minlon, st.maxlat, st.maxlon, st.minlat2, st.minlon2, st.maxlat2, st.maxlon2, st.midlat, st.midlon, attribution.size() != 0 ? attribution.c_str() : NULL, layermap, tile_format_name(output_format), description.c_str(), !pg, attribute_descriptions, "tile-join", generator_options, strategies, st.maxzoom, 2.5, 1);
|
||||
|
||||
if (outdb != NULL) {
|
||||
mbtiles_write_metadata(outdb, m, true);
|
||||
|
||||
Reference in New Issue
Block a user