@@ -206,7 +206,10 @@ def test_pmtiles_convert_from_pmtiles(tmp_path, tile_format):
206206
207207@pytest .mark .require_driver ("MBTILES" )
208208@pytest .mark .parametrize ("tile_format" , ["PNG" , "JPEG" , "WEBP" ])
209- def test_pmtiles_convert_from_non_pmtiles (tmp_vsimem , tile_format ):
209+ @pytest .mark .parametrize ("use_gdal_raster_tile" , [True , False ])
210+ def test_pmtiles_convert_from_non_pmtiles (
211+ tmp_vsimem , tile_format , use_gdal_raster_tile
212+ ):
210213
211214 if gdal .GetDriverByName (tile_format ) is None :
212215 pytest .skip (f"Driver { tile_format } is not available" )
@@ -228,10 +231,13 @@ def test_pmtiles_convert_from_non_pmtiles(tmp_vsimem, tile_format):
228231 src_ds .GetRasterBand (1 ).Fill (255 )
229232 src_ds .GetRasterBand (2 ).Fill (255 )
230233 src_ds .GetRasterBand (3 ).Fill (255 )
234+ options = {"TILE_FORMAT" : tile_format }
235+ if not use_gdal_raster_tile :
236+ options ["ZOOM_LEVEL_STRATEGY" ] = "LOWER"
231237 gdal .alg .raster .convert (
232238 input = src_ds ,
233239 output = tmp_vsimem / "out.pmtiles" ,
234- creation_option = { "TILE_FORMAT" : tile_format } ,
240+ creation_option = options ,
235241 )
236242
237243 ds = gdal .Open (tmp_vsimem / "out.pmtiles" )
@@ -253,11 +259,12 @@ def test_pmtiles_convert_from_non_pmtiles(tmp_vsimem, tile_format):
253259
254260@pytest .mark .require_driver ("MBTILES" )
255261@pytest .mark .require_driver ("PNG" )
262+ @pytest .mark .parametrize ("format" , ["PNG" , "PNG8" ])
256263@pytest .mark .parametrize (
257264 "size,expected_ovr_count" , [(256 , 0 ), (257 , 1 ), (512 , 1 ), (513 , 2 )]
258265)
259266def test_pmtiles_convert_from_non_pmtiles_auto_add_overviews (
260- tmp_vsimem , size , expected_ovr_count
267+ tmp_path , format , size , expected_ovr_count
261268):
262269
263270 src_ds = gdal .GetDriverByName ("MEM" ).Create ("" , size , size , 3 )
@@ -279,9 +286,9 @@ def test_pmtiles_convert_from_non_pmtiles_auto_add_overviews(
279286 src_ds .GetRasterBand (3 ).Fill (255 )
280287 gdal .alg .raster .convert (
281288 input = src_ds ,
282- output = tmp_vsimem / "out.pmtiles" ,
283- creation_option = {"TILE_FORMAT" : "PNG" },
289+ output = tmp_path / "out.pmtiles" ,
290+ creation_option = {"TILE_FORMAT" : format },
284291 )
285292
286- ds = gdal .Open (tmp_vsimem / "out.pmtiles" )
293+ ds = gdal .Open (tmp_path / "out.pmtiles" )
287294 assert ds .GetRasterBand (1 ).GetOverviewCount () == expected_ovr_count
0 commit comments