Add an option to quiet the progress indicator but not warnings

This commit is contained in:
Eric Fischer
2017-11-16 17:08:59 -08:00
parent 4dec9b43ae
commit 76d86f7d45
8 changed files with 25 additions and 11 deletions
+4
View File
@@ -1,3 +1,7 @@
## 1.26.7
* Add an option to quiet the progress indicator but not warnings
## 1.26.6 ## 1.26.6
* Be more careful about checking for overflow when parsing numbers * Be more careful about checking for overflow when parsing numbers
+2 -1
View File
@@ -264,7 +264,8 @@ tippecanoe -z5 -o filtered.mbtiles -j '{ "ne_10m_admin_0_countries": [ "all", [
### Progress indicator ### Progress indicator
* `-q` or `--quiet`: Work quietly instead of reporting progress * `-q` or `--quiet`: Work quietly instead of reporting progress or warning messages
* `-Q` or `--no-progress-indicator`: Don't report progress, but still give warnings
* `-v` or `--version`: Report Tippecanoe's version number * `-v` or `--version`: Report Tippecanoe's version number
### Filters ### Filters
+11 -5
View File
@@ -63,6 +63,7 @@ static int full_detail = -1;
static int min_detail = 7; static int min_detail = 7;
int quiet = 0; int quiet = 0;
int quiet_progress = 0;
int geometry_scale = 0; int geometry_scale = 0;
double simplification = 1; double simplification = 1;
size_t max_tile_size = 500000; size_t max_tile_size = 500000;
@@ -274,7 +275,7 @@ static void merge(struct mergelist *merges, size_t nmerges, unsigned char *map,
// Count this as an 75%-accomplishment, since we already 25%-counted it // Count this as an 75%-accomplishment, since we already 25%-counted it
*progress += (ix.end - ix.start) * 3 / 4; *progress += (ix.end - ix.start) * 3 / 4;
if (!quiet && 100 * *progress / *progress_max != *progress_reported) { if (!quiet && !quiet_progress && 100 * *progress / *progress_max != *progress_reported) {
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max); fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
*progress_reported = 100 * *progress / *progress_max; *progress_reported = 100 * *progress / *progress_max;
} }
@@ -641,7 +642,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
// Count this as a 25%-accomplishment, since we will copy again // Count this as a 25%-accomplishment, since we will copy again
*progress += (ix.end - ix.start) / 4; *progress += (ix.end - ix.start) / 4;
if (!quiet && 100 * *progress / *progress_max != *progress_reported) { if (!quiet && !quiet_progress && 100 * *progress / *progress_max != *progress_reported) {
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max); fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
*progress_reported = 100 * *progress / *progress_max; *progress_reported = 100 * *progress / *progress_max;
} }
@@ -810,7 +811,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
// Count this as an 75%-accomplishment, since we already 25%-counted it // Count this as an 75%-accomplishment, since we already 25%-counted it
*progress += (ix.end - ix.start) * 3 / 4; *progress += (ix.end - ix.start) * 3 / 4;
if (!quiet && 100 * *progress / *progress_max != *progress_reported) { if (!quiet && !quiet_progress && 100 * *progress / *progress_max != *progress_reported) {
fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max); fprintf(stderr, "Reordering geometry: %lld%% \r", 100 * *progress / *progress_max);
*progress_reported = 100 * *progress / *progress_max; *progress_reported = 100 * *progress / *progress_max;
} }
@@ -1713,7 +1714,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
long long nprogress = 100 * ip / indices; long long nprogress = 100 * ip / indices;
if (nprogress != progress) { if (nprogress != progress) {
progress = nprogress; progress = nprogress;
if (!quiet) { if (!quiet && !quiet_progress) {
fprintf(stderr, "Maxzoom: %lld%% \r", progress); fprintf(stderr, "Maxzoom: %lld%% \r", progress);
} }
} }
@@ -1809,7 +1810,7 @@ int read_input(std::vector<source> &sources, char *fname, int maxzoom, int minzo
long long nprogress = 100 * ip / indices; long long nprogress = 100 * ip / indices;
if (nprogress != progress) { if (nprogress != progress) {
progress = nprogress; progress = nprogress;
if (!quiet) { if (!quiet && !quiet_progress) {
fprintf(stderr, "Base zoom/drop rate: %lld%% \r", progress); fprintf(stderr, "Base zoom/drop rate: %lld%% \r", progress);
} }
} }
@@ -2256,6 +2257,7 @@ int main(int argc, char **argv) {
{"Progress indicator", 0, 0, 0}, {"Progress indicator", 0, 0, 0},
{"quiet", no_argument, 0, 'q'}, {"quiet", no_argument, 0, 'q'},
{"no-progress-indicator", no_argument, 0, 'Q'},
{"version", no_argument, 0, 'v'}, {"version", no_argument, 0, 'v'},
{"", 0, 0, 0}, {"", 0, 0, 0},
@@ -2479,6 +2481,10 @@ int main(int argc, char **argv) {
quiet = 1; quiet = 1;
break; break;
case 'Q':
quiet_progress = 1;
break;
case 'p': { case 'p': {
char *cp; char *cp;
for (cp = optarg; *cp != '\0'; cp++) { for (cp = optarg; *cp != '\0'; cp++) {
+1
View File
@@ -16,6 +16,7 @@ void checkdisk(struct reader *r, int nreader);
extern int geometry_scale; extern int geometry_scale;
extern int quiet; extern int quiet;
extern int quiet_progress;
extern size_t CPUS; extern size_t CPUS;
extern size_t TEMP_FILES; extern size_t TEMP_FILES;
+3 -1
View File
@@ -321,7 +321,9 @@ If you don't specify, it will use \fB\fC/tmp\fR\&.
.SS Progress indicator .SS Progress indicator
.RS .RS
.IP \(bu 2 .IP \(bu 2
\fB\fC\-q\fR or \fB\fC\-\-quiet\fR: Work quietly instead of reporting progress \fB\fC\-q\fR or \fB\fC\-\-quiet\fR: Work quietly instead of reporting progress or warning messages
.IP \(bu 2
\fB\fC\-Q\fR or \fB\fC\-\-no\-progress\-indicator\fR: Don't report progress, but still give warnings
.IP \(bu 2 .IP \(bu 2
\fB\fC\-v\fR or \fB\fC\-\-version\fR: Report Tippecanoe's version number \fB\fC\-v\fR or \fB\fC\-\-version\fR: Report Tippecanoe's version number
.RE .RE
+1 -1
View File
@@ -629,7 +629,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
if (*(sst->progress_seq) % 10000 == 0) { if (*(sst->progress_seq) % 10000 == 0) {
checkdisk(sst->readers, CPUS); checkdisk(sst->readers, CPUS);
if (!quiet) { if (!quiet && !quiet_progress) {
fprintf(stderr, "Read %.2f million features\r", *sst->progress_seq / 1000000.0); fprintf(stderr, "Read %.2f million features\r", *sst->progress_seq / 1000000.0);
} }
} }
+2 -2
View File
@@ -1261,7 +1261,7 @@ serial_feature next_feature(FILE *geoms, long long *geompos_in, char *metabase,
double progress = floor(((((*geompos_in + *along - alongminus) / (double) todo) + (pass - (2 - passes))) / passes + z) / (maxzoom + 1) * 1000) / 10; double progress = floor(((((*geompos_in + *along - alongminus) / (double) todo) + (pass - (2 - passes))) / passes + z) / (maxzoom + 1) * 1000) / 10;
if (progress >= *oprogress + 0.1) { if (progress >= *oprogress + 0.1) {
if (!quiet) { if (!quiet && !quiet_progress) {
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty); fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
} }
*oprogress = progress; *oprogress = progress;
@@ -1901,7 +1901,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
double progress = floor(((((*geompos_in + *along - alongminus) / (double) todo) + (pass - (2 - passes))) / passes + z) / (maxzoom + 1) * 1000) / 10; double progress = floor(((((*geompos_in + *along - alongminus) / (double) todo) + (pass - (2 - passes))) / passes + z) / (maxzoom + 1) * 1000) / 10;
if (progress >= oprogress + 0.1) { if (progress >= oprogress + 0.1) {
if (!quiet) { if (!quiet && !quiet_progress) {
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty); fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
} }
oprogress = progress; oprogress = progress;
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP #ifndef VERSION_HPP
#define VERSION_HPP #define VERSION_HPP
#define VERSION "tippecanoe v1.26.6\n" #define VERSION "tippecanoe v1.26.7\n"
#endif #endif