Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/gdalalg_abstract_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "gdalalg_vector_read.h"
#include "gdalalg_tee.h"

#include "vrtdataset.h"

#include <algorithm>
#include <cassert>

Expand Down Expand Up @@ -1567,6 +1569,9 @@ std::string GDALAbstractPipelineAlgorithm::BuildNestedPipeline(
curAlg->m_oMapDatasetNameToDataset[datasetNameOut] = poDS;

poDS->SetDescription(argsStr.c_str());
auto poVRTDataset = dynamic_cast<VRTDataset *>(poDS);
if (poVRTDataset)
poVRTDataset->SetWritable(false);
}

m_apoNestedPipelines.emplace_back(std::move(nestedPipeline));
Expand Down
12 changes: 12 additions & 0 deletions autotest/utilities/test_gdalalg_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,18 @@ def test_gdalalg_pipeline_nested_nominal():
]


def test_gdalalg_pipeline_inner_pipeline_vrt(tmp_path):
"""Test bugfix for https://github.com/OSGeo/gdal/issues/14732"""

shutil.copy("data/color_file.txt", tmp_path)

with gdal.alg.pipeline(
pipeline=f"read ../gcore/data/byte.tif ! blend --overlay [ read ../gcore/data/byte.tif ! color-map --color-map {tmp_path}/color_file.txt ]"
) as alg:
ds = alg.Output()
assert ds.GetRasterBand(1).Checksum() == 4475


def test_gdalalg_pipeline_nested_serialize_to_gdalg(tmp_vsimem):

out_filename = tmp_vsimem / "out.gdalg.json"
Expand Down
Loading