Thanks Even.

>That could be an option. Another already existing one is to use 
>GDALAlgorithmGetUsageAsJSON() on the pipeline algorithm. You'll get the step 
>algorithms and their arguments under the "pipeline_algorithms" key. Please 
>file a ticket if you prefer the C API.

I'll work with the JSON string a bit first. Thanks for the hint.

>I suspect a mis-use of the API...

Sorry, I was writing to .gdalalg.json trying to replicate the example
at 
https://gdal.org/en/latest/programs/gdal_raster_pipeline.html#programs/gdal_raster_pipeline-2.
I was expecting it would write the file, and that in API use the
"output" dataset arg would also be opened on the GDALG, but that
probably doesn't make sense. It works fine when the final write step
is to .tif or .vrt. I should have explored that more first.

Chris

On Tue, Aug 19, 2025 at 2:34 AM Even Rouault <even.roua...@spatialys.com> wrote:
>
> Chris,
>
> I don't see a way in the C API to obtain the pipeline algorithm step
> registry or access the step algorithms to obtain their argument
> properties and values. Would GetStepAlg()  and related methods
> potentially be exposed in the C API at some point, along with a
> "GetStepRegistry"?
>
> That could be an option. Another already existing one is to use 
> GDALAlgorithmGetUsageAsJSON() on the pipeline algorithm. You'll get the step 
> algorithms and their arguments under the "pipeline_algorithms" key. Please 
> file a ticket if you prefer the C API.
>
> When run as described above, the main pipeline (actual) algorithm
> object has an output arg of type DATASET, but it is not explicitly set
> and has null value even though the file output is successfully
> generated. I assume the dataset object is available in the output arg
> of the "write" step algorithm, but I haven't followed that code
> closely enough to understand some details. If that is correct though,
> could the final output dataset be propagated up to the main pipeline
> algorithm "output" arg?
>
> I suspect a mis-use of the API, because that definitely works as shown by the 
> following Python snippet (which uses the C API)
>
> >>> from osgeo import gdal
> >>> alg = gdal.Run('raster pipeline', pipeline='read 
> >>> autotest/gcore/data/byte.tif ! write /vsimem/out.tif')
> >>> print(alg.Output().GetDescription())
> /vsimem/out.tif
>
> Maybe you run GDALAlgorithmFinalize() ? If so then the output dataset gets 
> closed and the output dataset arg is nullified.
>
> Even
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to