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 13e287c commit e8bdcd4
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 @@ -207,6 +207,8 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

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

if self.parameterAsBoolean(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 @@ -591,7 +591,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 @@ -601,7 +601,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 @@ -611,7 +611,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 @@ -622,7 +622,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 e8bdcd4

Please sign in to comment.