mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Update MLT encoder dependency
This commit is contained in:
@@ -11,6 +11,8 @@ jobs:
|
||||
version: ['Release', 'Debug']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install dependencies (Ubuntu)
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get install libsqlite3-dev
|
||||
|
||||
@@ -54,4 +54,3 @@ mlt-build/
|
||||
|
||||
# Nodejs
|
||||
node_modules
|
||||
tmp/
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
[submodule "maplibre-tile-spec"]
|
||||
path = maplibre-tile-spec
|
||||
url = https://github.com/dannote/maplibre-tile-spec.git
|
||||
branch = feature/cpp-encoder
|
||||
url = https://github.com/maplibre/maplibre-tile-spec.git
|
||||
branch = main
|
||||
|
||||
@@ -58,19 +58,24 @@ C = $(wildcard *.c) $(wildcard *.cpp)
|
||||
|
||||
INCLUDES = -I/usr/local/include -I. -Iclipper2/include
|
||||
MLT_INCLUDES = -Imaplibre-tile-spec/cpp/include -isystem maplibre-tile-spec/cpp/vendor/fsst
|
||||
MLT_LIBS = mlt-build/libmlt-cpp-encoder.a mlt-build/libfsst-lib.a
|
||||
MLT_LIBS = mlt-build/libmlt-cpp-encoder.a mlt-build/libfsst-lib.a mlt-build/fastpfor/libFastPFOR.a
|
||||
MLT_BUILD_STAMP = mlt-build/.built
|
||||
LIBS = -L/usr/local/lib
|
||||
|
||||
mlt-build/libmlt-cpp-encoder.a: maplibre-tile-spec/cpp/CMakeLists.txt
|
||||
$(MLT_BUILD_STAMP): maplibre-tile-spec/cpp/CMakeLists.txt
|
||||
cmake -S maplibre-tile-spec/cpp -B mlt-build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DMLT_WITH_FASTPFOR=OFF \
|
||||
-DCMAKE_BUILD_TYPE=$(BUILDTYPE) \
|
||||
-DMLT_WITH_FASTPFOR=ON \
|
||||
-DMLT_WITH_FASTPFOR_SIMD=OFF \
|
||||
-DMLT_WITH_JSON=OFF \
|
||||
-DMLT_WITH_TESTS=OFF \
|
||||
-DMLT_WITH_TOOLS=OFF \
|
||||
-DCMAKE_CXX_STANDARD=20 \
|
||||
$(if $(VERBOSE),,--log-level=WARNING) > /dev/null
|
||||
cmake --build mlt-build --target mlt-cpp-encoder $(if $(VERBOSE),,-- -s) > /dev/null
|
||||
touch $@
|
||||
|
||||
$(MLT_LIBS): $(MLT_BUILD_STAMP)
|
||||
|
||||
tippecanoe: geojson.o jsonpull/jsonpull.o tile.o pool.o mbtiles.o geometry.o projection.o memfile.o mvt.o mlt.o serial.o main.o platform.o text.o dirtiles.o pmtiles_file.o plugin.o read_json.o write_json.o geobuf.o flatgeobuf.o evaluator.o geocsv.o csv.o geojson-loop.o json_logger.o visvalingam.o compression.o clip.o sort.o attribute.o thread.o shared_borders.o clipper2/src/clipper.engine.o $(MLT_LIBS)
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
@@ -605,23 +610,18 @@ mlt-test: tippecanoe
|
||||
./tippecanoe -q --output-format=mlt -z5 -f -o tests/mlt/points.mbtiles tests/mlt/points.geojson
|
||||
./tippecanoe -q -z5 -f -o tests/mlt/points-mvt.mbtiles tests/mlt/points.geojson
|
||||
@test $$(sqlite3 tests/mlt/points.mbtiles "SELECT COUNT(*) FROM tiles") -eq $$(sqlite3 tests/mlt/points-mvt.mbtiles "SELECT COUNT(*) FROM tiles") || (echo "FAIL: MLT and MVT tile counts differ" && exit 1)
|
||||
@echo "PASS: MLT tile count matches MVT"
|
||||
# Verify format metadata
|
||||
@test "$$(sqlite3 tests/mlt/points.mbtiles "SELECT value FROM metadata WHERE name='format'")" = "mlt" || (echo "FAIL: format metadata is not 'mlt'" && exit 1)
|
||||
@echo "PASS: MLT format metadata correct"
|
||||
# Verify tiles are gzip compressed
|
||||
@sqlite3 tests/mlt/points.mbtiles "SELECT hex(substr(tile_data, 1, 2)) FROM tiles LIMIT 1" | grep -q "1F8B" || (echo "FAIL: MLT tiles not gzip compressed" && exit 1)
|
||||
@echo "PASS: MLT tiles are gzip compressed"
|
||||
# Directory output with .mlt extension
|
||||
rm -rf tests/mlt/dir-out
|
||||
./tippecanoe -q --output-format=mlt -z2 -f -e tests/mlt/dir-out tests/mlt/points.geojson
|
||||
@test $$(find tests/mlt/dir-out -name '*.mlt' | wc -l) -gt 0 || (echo "FAIL: No .mlt files in directory output" && exit 1)
|
||||
@test $$(find tests/mlt/dir-out -name '*.pbf' | wc -l) -eq 0 || (echo "FAIL: .pbf files in MLT directory output" && exit 1)
|
||||
@echo "PASS: Directory output uses .mlt extension"
|
||||
# Pretessellate flag
|
||||
./tippecanoe -q --output-format=mlt --pretessellate -z5 -f -o tests/mlt/points-tess.mbtiles tests/mlt/points.geojson
|
||||
@test $$(sqlite3 tests/mlt/points-tess.mbtiles "SELECT COUNT(*) FROM tiles") -gt 0 || (echo "FAIL: No tiles with pretessellate" && exit 1)
|
||||
@echo "PASS: --pretessellate produces tiles"
|
||||
rm -f tests/mlt/points.mbtiles tests/mlt/points-mvt.mbtiles tests/mlt/points-tess.mbtiles
|
||||
rm -rf tests/mlt/dir-out
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ $ brew install tippecanoe
|
||||
On Ubuntu it will usually be easiest to build from the source repository:
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/felt/tippecanoe.git
|
||||
$ git clone --recurse-submodules https://github.com/felt/tippecanoe.git
|
||||
$ cd tippecanoe
|
||||
$ make -j
|
||||
$ make install
|
||||
|
||||
+1
-1
Submodule maplibre-tile-spec updated: d596473e28...ec6808dab4
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -29,7 +30,9 @@ static bool try_parse_json_object(const std::string &s, mlt::Encoder::StructValu
|
||||
json_object *key = obj->value.object.keys[i];
|
||||
json_object *val = obj->value.object.values[i];
|
||||
|
||||
if (key->type != JSON_STRING) continue;
|
||||
if (key->type != JSON_STRING) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string child_key = key->value.string.string;
|
||||
std::string child_val;
|
||||
@@ -211,7 +214,11 @@ static mlt::Encoder::Layer convert_layer(const mvt_layer &layer) {
|
||||
|
||||
for (const auto &feature : layer.features) {
|
||||
mlt::Encoder::Feature f;
|
||||
f.id = feature.id;
|
||||
if (feature.has_id) {
|
||||
f.id = feature.id;
|
||||
} else {
|
||||
f.id = std::nullopt;
|
||||
}
|
||||
f.geometry = convert_geometry(feature);
|
||||
|
||||
for (size_t t = 0; t + 1 < feature.tags.size(); t += 2) {
|
||||
@@ -245,7 +252,9 @@ std::string encode_as_mlt(const mvt_tile &tile, bool sort_features, bool pretess
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (any_has_id) break;
|
||||
if (any_has_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
config.includeIds = any_has_id;
|
||||
|
||||
|
||||
+1
-1
@@ -1636,7 +1636,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, true, 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, "pbf", 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