diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d0fa450..d03e1cce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ * Do more of line simplification in integer coordinates, to make behavior consistent across platforms +* Reduce excessive logging during pmtiles conversion # 2.26.1 diff --git a/decode.cpp b/decode.cpp index b78ce6e5..4bd64849 100644 --- a/decode.cpp +++ b/decode.cpp @@ -29,6 +29,10 @@ int minzoom = 0; int maxzoom = 32; bool force = false; +bool progress_time() { + return false; +} + void do_stats(mvt_tile &tile, size_t size, bool compressed, int z, unsigned x, unsigned y, json_writer &state) { state.json_write_hash(); diff --git a/pmtiles_file.cpp b/pmtiles_file.cpp index 91673214..c1226d07 100644 --- a/pmtiles_file.cpp +++ b/pmtiles_file.cpp @@ -10,6 +10,7 @@ #include "pmtiles_file.hpp" #include "mvt.hpp" #include "write_json.hpp" +#include "main.hpp" bool pmtiles_has_suffix(const char *filename) { if (filename == nullptr) { @@ -128,7 +129,7 @@ std::string metadata_to_pmtiles_json(metadata m) { return compressed; } -void mbtiles_map_image_to_pmtiles(char *fname, metadata m, bool tile_compression, bool quiet, bool quiet_progress) { +void mbtiles_map_image_to_pmtiles(char *fname, metadata m, bool tile_compression, bool fquiet, bool fquiet_progress) { sqlite3 *db; if (sqlite3_open(fname, &db) != SQLITE_OK) { @@ -197,12 +198,14 @@ void mbtiles_map_image_to_pmtiles(char *fname, metadata m, bool tile_compression tmp_ostream.open(tmpname.c_str(), std::ios::out | std::ios::binary); int idx = 0; + int progress_reported = -1; for (auto const &tile_id : tile_ids) { idx = idx + 1; double progress = ((double) idx / tile_ids.size()) * 100; pmtiles::zxy zxy = pmtiles::tileid_to_zxy(tile_id); - if (!quiet && !quiet_progress) { + if (!fquiet && !fquiet_progress && progress_time() && (int) progress != progress_reported) { fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, zxy.z, zxy.x, zxy.y); + progress_reported = (int) progress; fflush(stderr); } sqlite3_bind_int(map_stmt, 1, zxy.z); diff --git a/tile-join.cpp b/tile-join.cpp index d65b1f1b..661a1bb8 100644 --- a/tile-join.cpp +++ b/tile-join.cpp @@ -52,6 +52,10 @@ int minzoom = 0; std::map renames; bool exclude_all = false; +bool progress_time() { + return false; +} + struct stats { int minzoom; int maxzoom;