3636 ParameterSelection ,
3737 ParameterCrs ,
3838 ParameterNumber ,
39- ParameterString )
39+ ParameterString ,
40+ ParameterBoolean )
4041from processing .core .outputs import OutputRaster
4142from processing .algs .gdal .GdalUtils import GdalUtils
4243
@@ -56,6 +57,7 @@ class warp(GdalAlgorithm):
5657 EXT_CRS = 'EXT_CRS'
5758 RTYPE = 'RTYPE'
5859 OPTIONS = 'OPTIONS'
60+ MULTITHREADING = 'MULTITHREADING'
5961
6062 METHOD_OPTIONS = ['near' , 'bilinear' , 'cubic' , 'cubicspline' , 'lanczos' ]
6163 TYPE = ['Byte' , 'Int16' , 'UInt16' , 'UInt32' , 'Int32' , 'Float32' , 'Float64' ]
@@ -105,6 +107,10 @@ def defineCharacteristics(self):
105107 self .tr ('Additional creation options' ),
106108 optional = True ,
107109 metadata = {'widget_wrapper' : 'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper' }))
110+ self .addParameter (ParameterBoolean (self .MULTITHREADING ,
111+ self .tr ('Use multithreaded warping implementation' ),
112+ False
113+ ))
108114 self .addParameter (ParameterSelection (self .RTYPE ,
109115 self .tr ('Output raster type' ),
110116 self .TYPE , 5 ))
@@ -118,6 +124,7 @@ def getConsoleCommands(self):
118124 rastext_crs = self .getParameterValue (self .EXT_CRS )
119125 opts = self .getParameterValue (self .OPTIONS )
120126 noData = self .getParameterValue (self .NO_DATA )
127+ multithreading = self .getParameterValue (self .MULTITHREADING )
121128
122129 if noData is not None :
123130 noData = str (noData )
@@ -165,6 +172,9 @@ def getConsoleCommands(self):
165172 arguments .append ('-co' )
166173 arguments .append (opts )
167174
175+ if multithreading :
176+ arguments .append ('-multi' )
177+
168178 if GdalUtils .version () in [2010000 , 2010100 ]:
169179 arguments .append ("--config GDALWARP_IGNORE_BAD_CUTLINE YES" )
170180
0 commit comments