filters.shell
The shell filter allows you to run shell operations in-line with PDAL pipeline tasks. This can be especially useful for follow-on items or orchestration of complex workflows.
Warning
To use filters.shell, you must set PDAL_ALLOW_SHELL=1
PDAL’s execution environment. Without the environment variable
set, every attempt at execution will result in the following
error:
PDAL_ALLOW_SHELL environment variable not set, shell access is not allowed
Example
GDAL processing operations applied to raster output from writers.gdal are a common task. Applying these within the PDAL execution environment can provide some convenience and allow downstream consumers to have deterministic completion status of the task. The following task writes multiple elevation models to disk and then uses the gdaladdo command to construct overview bands for the data using average interpolation.
{
"pipeline":[
"autzen.las",
{
"type":"writers.gdal",
"filename" : "output-1m.tif",
"resolution" : "1.0"
},
{
"type":"writers.gdal",
"filename" : "output-2m.tif",
"resolution" : "2.0"
},
{
"type":"writers.gdal",
"filename" : "output-5m.tif",
"resolution" : "5.0"
},
{
"type":"filters.shell",
"command" : "gdaladdo -r average output-1m.tif 2 4 8 16"
},
{
"type":"filters.shell",
"command" : "gdaladdo -r average output-2m.tif 2 4 8 16"
},
{
"type":"filters.shell",
"command" : "gdaladdo -r average output-5m.tif 2 4 8 16"
}
]
}
Options
- command
The shell command to run. It is run in relation to the current working directory of the pipeline executing it.
- where
An expression that limits points passed to a filter. Points that don’t pass the expression skip the stage but are available to subsequent stages in a pipeline. [Default: no filtering]
- where_merge
A strategy for merging points skipped by a ‘where’ option when running in standard mode. If
true
, the skipped points are added to the first point view returned by the skipped filter. Iffalse
, skipped points are placed in their own point view. Ifauto
, skipped points are merged into the returned point view provided that only one point view is returned and it has the same point count as it did when the filter was run. [Default:auto
]