Skip to content

Commit

Permalink
Add optional --quiet flag to tilemaker (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
oobayly authored Oct 13, 2024
1 parent a968184 commit 6ecacf4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/RUNNING.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ Don't forget to add `--store /path/to/your/ssd` if you don't have lots of RAM.
Running tilemaker with the `--verbose` argument will output any issues encountered during tile
creation.

Running tilemaker with the `--quiet` argument will suppress anything written to stdout during
tile creation. stderr is unaffected.

You may see geometry errors reported by Boost::Geometry. This typically reflects an error
in the OSM source data (for example, a multipolygon with several inner rings but no outer ring).
Often, if the geometry could not be written to the layer, the error will subsequently show in
Expand Down
1 change: 1 addition & 0 deletions include/options_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace OptionsParser {

OsmOptions osm;
bool showHelp = false;
bool quiet = false;
bool verbose = false;
bool mergeSqlite = false;
OutputMode outputMode = OutputMode::File;
Expand Down
1 change: 1 addition & 0 deletions src/options_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ po::options_description getParser(OptionsParser::Options& options) {
("merge" ,po::bool_switch(&options.mergeSqlite), "merge with existing .mbtiles (overwrites otherwise)")
("config", po::value< string >(&options.jsonFile)->default_value("config.json"), "config JSON file")
("process",po::value< string >(&options.luaFile)->default_value("process.lua"), "tag-processing Lua file")
("quiet", po::bool_switch(&options.quiet), "quiet, suppress standard output")
("verbose",po::bool_switch(&options.verbose), "verbose error output")
("skip-integrity",po::bool_switch(&options.osm.skipIntegrity), "don't enforce way/node integrity")
("log-tile-timings", po::bool_switch(&options.logTileTimings), "log how long each tile takes");
Expand Down
5 changes: 5 additions & 0 deletions src/tilemaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ int main(const int argc, const char* argv[]) {

if (options.showHelp) { OptionsParser::showHelp(); return 0; }

if (options.quiet) {
// Suppress anything written to std out
std::cout.setstate(std::ios_base::failbit);
}

verbose = options.verbose;

vector<string> bboxElements = parseBox(options.bbox);
Expand Down

0 comments on commit 6ecacf4

Please sign in to comment.