Reduce excessive progress logging during pmtiles conversion (#111)

* Don't log progress so often during pmtiles conversion

And turn off the `catch` tests, which have bit-rotted

* Fix accidental double-multiplication-by-100

* Reenable catch

* Update changelog
This commit is contained in:
Erica Fischer
2023-07-10 15:59:52 -07:00
committed by GitHub
parent c1051232ad
commit b5ec3c46f0
4 changed files with 14 additions and 2 deletions
+1
View File
@@ -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
+4
View File
@@ -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();
+5 -2
View File
@@ -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);
+4
View File
@@ -52,6 +52,10 @@ int minzoom = 0;
std::map<std::string, std::string> renames;
bool exclude_all = false;
bool progress_time() {
return false;
}
struct stats {
int minzoom;
int maxzoom;