Add an option to quiet the progress indicator but not warnings

This commit is contained in:
Eric Fischer 2017-11-16 17:08:03 -08:00
parent 4dec9b43ae
commit 76d86f7d45
8 changed files with 25 additions and 11 deletions

View File

@ -1,3 +1,7 @@
## 1.26.7
* Add an option to quiet the progress indicator but not warnings
## 1.26.6
* Be more careful about checking for overflow when parsing numbers

View File

@ -264,7 +264,8 @@ tippecanoe -z5 -o filtered.mbtiles -j '{ "ne_10m_admin_0_countries": [ "all", [
### 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
### Filters

View File

@ -63,6 +63,7 @@ static int full_detail = -1;
static int min_detail = 7;
int quiet = 0;
int quiet_progress = 0;
int geometry_scale = 0;
double simplification = 1;
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
*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);
*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
*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);
*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
*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);
*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;
if (nprogress != progress) {
progress = nprogress;
if (!quiet) {
if (!quiet && !quiet_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;
if (nprogress != progress) {
progress = nprogress;
if (!quiet) {
if (!quiet && !quiet_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},
{"quiet", no_argument, 0, 'q'},
{"no-progress-indicator", no_argument, 0, 'Q'},
{"version", no_argument, 0, 'v'},
{"", 0, 0, 0},
@ -2479,6 +2481,10 @@ int main(int argc, char **argv) {
quiet = 1;
break;
case 'Q':
quiet_progress = 1;
break;
case 'p': {
char *cp;
for (cp = optarg; *cp != '\0'; cp++) {

View File

@ -16,6 +16,7 @@ void checkdisk(struct reader *r, int nreader);
extern int geometry_scale;
extern int quiet;
extern int quiet_progress;
extern size_t CPUS;
extern size_t TEMP_FILES;

View File

@ -321,7 +321,9 @@ If you don't specify, it will use \fB\fC/tmp\fR\&.
.SS Progress indicator
.RS
.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
\fB\fC\-v\fR or \fB\fC\-\-version\fR: Report Tippecanoe's version number
.RE

View File

@ -629,7 +629,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
if (*(sst->progress_seq) % 10000 == 0) {
checkdisk(sst->readers, CPUS);
if (!quiet) {
if (!quiet && !quiet_progress) {
fprintf(stderr, "Read %.2f million features\r", *sst->progress_seq / 1000000.0);
}
}

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;
if (progress >= *oprogress + 0.1) {
if (!quiet) {
if (!quiet && !quiet_progress) {
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
}
*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;
if (progress >= oprogress + 0.1) {
if (!quiet) {
if (!quiet && !quiet_progress) {
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
}
oprogress = progress;

View File

@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "tippecanoe v1.26.6\n"
#define VERSION "tippecanoe v1.26.7\n"
#endif