Skip to content
Permalink
Browse files
[processing] add multithreading option to warp (fix #15340)
  • Loading branch information
alexbruy committed Apr 29, 2017
1 parent 4377f20 commit 3450a9ff8910fa21d8734b09c3b23c43c759792f
Showing with 11 additions and 1 deletion.
  1. +11 −1 python/plugins/processing/algs/gdal/warp.py
@@ -36,7 +36,8 @@
ParameterSelection,
ParameterCrs,
ParameterNumber,
ParameterString)
ParameterString,
ParameterBoolean)
from processing.core.outputs import OutputRaster
from processing.algs.gdal.GdalUtils import GdalUtils

@@ -56,6 +57,7 @@ class warp(GdalAlgorithm):
EXT_CRS = 'EXT_CRS'
RTYPE = 'RTYPE'
OPTIONS = 'OPTIONS'
MULTITHREADING = 'MULTITHREADING'

METHOD_OPTIONS = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos']
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
@@ -105,6 +107,10 @@ def defineCharacteristics(self):
self.tr('Additional creation options'),
optional=True,
metadata={'widget_wrapper': 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'}))
self.addParameter(ParameterBoolean(self.MULTITHREADING,
self.tr('Use multithreaded warping implementation'),
False
))
self.addParameter(ParameterSelection(self.RTYPE,
self.tr('Output raster type'),
self.TYPE, 5))
@@ -118,6 +124,7 @@ def getConsoleCommands(self):
rastext_crs = self.getParameterValue(self.EXT_CRS)
opts = self.getParameterValue(self.OPTIONS)
noData = self.getParameterValue(self.NO_DATA)
multithreading = self.getParameterValue(self.MULTITHREADING)

if noData is not None:
noData = str(noData)
@@ -165,6 +172,9 @@ def getConsoleCommands(self):
arguments.append('-co')
arguments.append(opts)

if multithreading:
arguments.append('-multi')

if GdalUtils.version() in [2010000, 2010100]:
arguments.append("--config GDALWARP_IGNORE_BAD_CUTLINE YES")

0 comments on commit 3450a9f

Please sign in to comment.