From 8535f4905122cf54d95011f574caab7b448a034b Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Wed, 16 May 2018 12:46:21 -0400 Subject: [PATCH] Handle repeated options. Close #1941 --- doc/apps/pipeline.rst | 32 +++++++++- doc/pipeline.rst | 56 ++++++++++++++--- pdal/PipelineReaderJSON.cpp | 62 +++++++++++++------ test/data/pipeline/range_bad_limits.json.in | 18 ++++++ test/data/pipeline/range_multi_limits.json.in | 20 ++++++ test/unit/apps/pcpipelineTestJSON.cpp | 25 ++++++++ 6 files changed, 181 insertions(+), 32 deletions(-) create mode 100644 test/data/pipeline/range_bad_limits.json.in create mode 100644 test/data/pipeline/range_multi_limits.json.in diff --git a/doc/apps/pipeline.rst b/doc/apps/pipeline.rst index 9ec56ed415..f251595fd2 100644 --- a/doc/apps/pipeline.rst +++ b/doc/apps/pipeline.rst @@ -31,9 +31,8 @@ Substitutions The ``pipeline`` command can accept command-line option substitutions and they replace -existing options that are specified in the input JSON pipeline. If -multiple stages of the same name exist in the pipeline, `all` stages would -be overridden. For example, to set the output and input LAS files for a +existing options that are specified in the input JSON pipeline. +For example, to set the output and input LAS files for a pipeline that does a translation, the ``filename`` for the reader and the writer can be overridden: @@ -42,6 +41,33 @@ writer can be overridden: $ pdal pipeline translate.json --writers.las.filename=output.laz \ --readers.las.filename=input.las +If multiple stages of the same name exist in the pipeline, `all` stages would +be overridden. In the following example, both colorization filters would +have their `dimensions` option overridden to the value +"Red:1:1.0, Blue, Green::256.0" by the command shown below: + +:: + + { + "pipeline" : [ + "input.las", + { + "type" : "filters.colorization", + "raster" : "raster1.tiff" + "dimensions": "Red" + }, + { + "type" : "filters.colorization", + "raster" : "raster2.tiff" + "dimensions": "Blue" + }, + "placeholder.laz" + ] + } + + $ pdal pipeline colorize.json --filters.colorization.dimensions= \ + "Red:1:1.0, Blue, Green::256.0" + Option substitution can also refer to the tag of an individual stage. This can be done by using the syntax --stage..