Skip to content

Commit

Permalink
[processing] pass layer name to the gdalwarp to avoid issues with
Browse files Browse the repository at this point in the history
multi-layer datasources (fix #30292)

(cherry picked from commit 109d1fb)
  • Loading branch information
alexbruy authored and nyalldawson committed Jul 18, 2019
1 parent 56024ba commit 8abac8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions python/plugins/processing/algs/gdal/ClipRasterByMask.py
Expand Up @@ -156,6 +156,8 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

arguments.append('-cutline')
arguments.append(maskLayer)
arguments.append('-cl')
arguments.append(maskLayerName)

if self.parameterAsBool(parameters, self.CROP_TO_CUTLINE, context):
arguments.append('-crop_to_cutline')
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/tests/GdalAlgorithmsTest.py
Expand Up @@ -594,7 +594,7 @@ def testClipRasterByMask(self):
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-of JPEG -cutline ' +
mask + ' -crop_to_cutline ' + source + ' ' +
mask + ' -cl polys2 -crop_to_cutline ' + source + ' ' +
outdir + '/check.jpg'])
# with NODATA value
self.assertEqual(
Expand All @@ -604,7 +604,7 @@ def testClipRasterByMask(self):
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-of JPEG -cutline ' +
mask + ' -crop_to_cutline -dstnodata 9999.0 ' + source + ' ' +
mask + ' -cl polys2 -crop_to_cutline -dstnodata 9999.0 ' + source + ' ' +
outdir + '/check.jpg'])
# with "0" NODATA value
self.assertEqual(
Expand All @@ -614,7 +614,7 @@ def testClipRasterByMask(self):
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-of JPEG -cutline ' +
mask + ' -crop_to_cutline -dstnodata 0.0 ' + source + ' ' +
mask + ' -cl polys2 -crop_to_cutline -dstnodata 0.0 ' + source + ' ' +
outdir + '/check.jpg'])
# with "0" NODATA value and custom data type
self.assertEqual(
Expand All @@ -625,7 +625,7 @@ def testClipRasterByMask(self):
'OUTPUT': outdir + '/check.jpg'}, context, feedback),
['gdalwarp',
'-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'])

def testContour(self):
Expand Down

0 comments on commit 8abac8e

Please sign in to comment.