@@ -154,3 +154,40 @@ def test_gdalalg_raster_hillshade_vrt_output_pipeline_from_filename():
154154 match = r"hillshade: VRT output is not supported. Consider using the GDALG driver instead \(files with \.gdalg\.json extension\)" ,
155155 ):
156156 alg .Run ()
157+
158+
159+ def test_gdalalg_raster_hillshade_overview ():
160+
161+ src_ds = gdal .Translate (
162+ "" ,
163+ "../gdrivers/data/n43.tif" ,
164+ format = "MEM" ,
165+ width = 61 ,
166+ resampleAlg = gdal .GRIORA_Bilinear ,
167+ )
168+
169+ with gdal .Run (
170+ "raster" , "hillshade" , input = src_ds , output = "" , output_format = "stream" , z = 30
171+ ) as alg :
172+ out_ds = alg .Output ()
173+ cs = out_ds .GetRasterBand (1 ).Checksum ()
174+ stats = out_ds .GetRasterBand (1 ).ComputeStatistics (False )
175+
176+ src_ds = gdal .Translate ("" , "../gdrivers/data/n43.tif" , format = "MEM" )
177+ src_ds .BuildOverviews ("BILINEAR" , [2 , 4 ])
178+
179+ with gdal .Run (
180+ "raster" , "hillshade" , input = src_ds , output = "" , output_format = "stream" , z = 30
181+ ) as alg :
182+ out_ds = alg .Output ()
183+ del src_ds
184+
185+ assert out_ds .GetRasterBand (1 ).GetOverviewCount () == 2
186+ assert out_ds .GetRasterBand (1 ).GetOverview (- 1 ) is None
187+ assert out_ds .GetRasterBand (1 ).GetOverview (2 ) is None
188+ assert out_ds .GetRasterBand (1 ).GetOverview (0 ).XSize == 61
189+ assert out_ds .GetRasterBand (1 ).GetOverview (0 ).YSize == 61
190+ assert out_ds .GetRasterBand (1 ).GetOverview (1 ).XSize == 31
191+ assert out_ds .GetRasterBand (1 ).GetOverview (1 ).YSize == 31
192+ assert out_ds .GetRasterBand (1 ).GetOverview (0 ).Checksum () == cs
193+ assert out_ds .GetRasterBand (1 ).GetOverview (0 ).ComputeStatistics (False ) == stats
0 commit comments