mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-06 00:03:16 -05:00
[processing] pass layer name to the gdalwarp to avoid issues with
multi-layer datasources (fix #30292)
This commit is contained in:
parent
5f0447b397
commit
109d1fb7a8
@ -217,6 +217,8 @@ class ClipRasterByMask(GdalAlgorithm):
|
|||||||
|
|
||||||
arguments.append('-cutline')
|
arguments.append('-cutline')
|
||||||
arguments.append(maskLayer)
|
arguments.append(maskLayer)
|
||||||
|
arguments.append('-cl')
|
||||||
|
arguments.append(maskLayerName)
|
||||||
|
|
||||||
if self.parameterAsBoolean(parameters, self.CROP_TO_CUTLINE, context):
|
if self.parameterAsBoolean(parameters, self.CROP_TO_CUTLINE, context):
|
||||||
arguments.append('-crop_to_cutline')
|
arguments.append('-crop_to_cutline')
|
||||||
|
|||||||
@ -343,7 +343,7 @@ class TestGdalRasterAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsT
|
|||||||
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
||||||
['gdalwarp',
|
['gdalwarp',
|
||||||
'-of JPEG -cutline ' +
|
'-of JPEG -cutline ' +
|
||||||
mask + ' -crop_to_cutline ' + source + ' ' +
|
mask + ' -cl polys2 -crop_to_cutline ' + source + ' ' +
|
||||||
outdir + '/check.jpg'])
|
outdir + '/check.jpg'])
|
||||||
# with NODATA value
|
# with NODATA value
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -353,7 +353,7 @@ class TestGdalRasterAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsT
|
|||||||
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
||||||
['gdalwarp',
|
['gdalwarp',
|
||||||
'-of JPEG -cutline ' +
|
'-of JPEG -cutline ' +
|
||||||
mask + ' -crop_to_cutline -dstnodata 9999.0 ' + source + ' ' +
|
mask + ' -cl polys2 -crop_to_cutline -dstnodata 9999.0 ' + source + ' ' +
|
||||||
outdir + '/check.jpg'])
|
outdir + '/check.jpg'])
|
||||||
# with "0" NODATA value
|
# with "0" NODATA value
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -363,7 +363,7 @@ class TestGdalRasterAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsT
|
|||||||
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
||||||
['gdalwarp',
|
['gdalwarp',
|
||||||
'-of JPEG -cutline ' +
|
'-of JPEG -cutline ' +
|
||||||
mask + ' -crop_to_cutline -dstnodata 0.0 ' + source + ' ' +
|
mask + ' -cl polys2 -crop_to_cutline -dstnodata 0.0 ' + source + ' ' +
|
||||||
outdir + '/check.jpg'])
|
outdir + '/check.jpg'])
|
||||||
# with "0" NODATA value and custom data type
|
# with "0" NODATA value and custom data type
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -374,7 +374,7 @@ class TestGdalRasterAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsT
|
|||||||
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
||||||
['gdalwarp',
|
['gdalwarp',
|
||||||
'-ot Float32 -of JPEG -cutline ' +
|
'-ot Float32 -of JPEG -cutline ' +
|
||||||
mask + ' -crop_to_cutline -dstnodata 0.0 ' + source + ' ' +
|
mask + ' -cl polys2 -crop_to_cutline -dstnodata 0.0 ' + source + ' ' +
|
||||||
outdir + '/check.jpg'])
|
outdir + '/check.jpg'])
|
||||||
# with creation options
|
# with creation options
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -384,7 +384,7 @@ class TestGdalRasterAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsT
|
|||||||
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
||||||
['gdalwarp',
|
['gdalwarp',
|
||||||
'-of JPEG -cutline ' +
|
'-of JPEG -cutline ' +
|
||||||
mask + ' -crop_to_cutline -co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9 ' +
|
mask + ' -cl polys2 -crop_to_cutline -co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9 ' +
|
||||||
source + ' ' +
|
source + ' ' +
|
||||||
outdir + '/check.jpg'])
|
outdir + '/check.jpg'])
|
||||||
# with multothreading and additional parameters
|
# with multothreading and additional parameters
|
||||||
@ -396,7 +396,7 @@ class TestGdalRasterAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsT
|
|||||||
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
|
||||||
['gdalwarp',
|
['gdalwarp',
|
||||||
'-of JPEG -cutline ' +
|
'-of JPEG -cutline ' +
|
||||||
mask + ' -crop_to_cutline -multi -nosrcalpha -wm 2048 -nomd ' +
|
mask + ' -cl polys2 -crop_to_cutline -multi -nosrcalpha -wm 2048 -nomd ' +
|
||||||
source + ' ' +
|
source + ' ' +
|
||||||
outdir + '/check.jpg'])
|
outdir + '/check.jpg'])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user