Skip to content

Composite/nested pipelines #12874

@rouault

Description

@rouault

Feature description

It may be desirable to have a single pipeline producing several temporary outputs and combining them in a final sub-pipeline. A typical example would be to produce a shaded colored map from a DEM:

  1. compute the grayscale hillshade,
  2. compute the hypsometric/colored map
  3. combine both using the color-merge operation. (actually 2 and 3 can be a single sub-pipeline)

Potential syntax:

gdal raster pipeline read dem.tif ! \
                     hillshade ! \
                     write /vsipipe/hillshade ! \
                     read dem.tif ! \
                     color-map color-table.txt ! \
                     color-merge --grayscale /vsipipe/hillshade ! \
                     write colored-hillshade.tif

The sub-pipelines are implicitly defined by a write step which is not a final one, followed by a read step.

A non-final write step must compuslory write into a pseudo VSI file starting with /vsipipe/ . The implementation might decide that it is a /vsimem/ file or a temporary file on the file system, but the user shouldn't be able to write in an arbitrary location, at least in a .gdalg.json context as it could be a security issue.

One could also accept (require?) explicit markers of sub-pipelines using square brackets (rounded brackets need to be escaped in Bash):

gdal raster pipeline [ read dem.tif ! \
                       hillshade ! \
                       write /vsipipe/hillshade ] ! \
                     [ read dem.tif ! \
                       color-map color-table.txt ! \
                       color-merge --grayscale /vsipipe/hillshade ! \
                       write colored-hillshade.tif ]

Thoughts @hobu @dbaston @elpaso @jcphill @jratike80 ?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgdal_cliAnything related to the new 3.11 "gdal" CLI frontend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions