Skip to content

Commit 807855d

Browse files
committed
gdal raster hillshade: add error message for unknown ouput format
1 parent 926d626 commit 807855d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

apps/gdaldem_lib.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3739,6 +3739,8 @@ GDALDatasetH GDALDEMProcessing(const char *pszDest, GDALDatasetH hSrcDataset,
37393739
osFormat = GetOutputDriverForRaster(pszDest);
37403740
if (osFormat.empty())
37413741
{
3742+
CPLError(CE_Failure, CPLE_AppDefined,
3743+
"Could not identify driver for output %s", pszDest);
37423744
return nullptr;
37433745
}
37443746
}

autotest/utilities/test_gdalalg_raster_hillshade.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ def test_gdalalg_raster_hillshade_vrt_output_pipeline_from_filename():
156156
alg.Run()
157157

158158

159+
def test_gdalalg_raster_hillshade_unknown_format(tmp_vsimem):
160+
161+
alg = get_alg()
162+
alg["input"] = os.path.join(os.getcwd(), "../gdrivers/data/n43.tif")
163+
alg["output"] = tmp_vsimem / "out.shp"
164+
165+
with pytest.raises(RuntimeError, match="Could not identify driver"):
166+
alg.Run()
167+
168+
159169
def test_gdalalg_raster_hillshade_overview():
160170

161171
src_ds = gdal.Translate(

0 commit comments

Comments
 (0)