@@ -68,11 +68,10 @@ def defineCharacteristics(self):
6868 self .addParameter (ParameterCrs (translate .SRS , "Override the projection for the output file" , None ))
6969 self .addParameter (ParameterExtent (translate .PROJWIN , "Subset based on georeferenced coordinates" ))
7070 self .addParameter (ParameterBoolean (translate .SDS , "Copy all subdatasets of this file to individual output files" , False ))
71- self .addParameter (ParameterString (translate .EXTRA , "Additional creation parameters" , " " ))
71+ self .addParameter (ParameterString (translate .EXTRA , "Additional creation parameters" , "" ))
7272 self .addOutput (OutputRaster (translate .OUTPUT , "Output layer" ))
7373
7474 def processAlgorithm (self , progress ):
75-
7675 out = self .getOutputValue (translate .OUTPUT )
7776 outsize = str (self .getParameterValue (translate .OUTSIZE ))
7877 outsizePerc = str (self .getParameterValue (translate .OUTSIZE_PERC ))
@@ -87,20 +86,31 @@ def processAlgorithm(self, progress):
8786 arguments .append ("-of" )
8887 arguments .append (GdalUtils .getFormatShortNameFromFilename (out ))
8988 if outsizePerc == "True" :
90- outsizeStr = "-outsize " + outsize + "% " + outsize + "%"
89+ arguments .append ("-outsize" )
90+ arguments .append (outsize + "%" )
91+ arguments .append (outsize + "%" )
9192 else :
92- outsizeStr = "-outsize " + outsize + " " + outsize
93- arguments .append (outsizeStr )
94- arguments .append ("-a_nodata " + noData )
93+ arguments .append ("-outsize" )
94+ arguments .append (outsize )
95+ arguments .append (outsize )
96+ arguments .append ("-a_nodata" )
97+ arguments .append (noData )
9598 if expand != "none" :
96- arguments .append ("-expand " + expand )
99+ arguments .append ("-expand" )
100+ arguments .append (expand )
97101 regionCoords = projwin .split ("," )
98- arguments .append ("-projwin " + regionCoords [0 ] + " " + regionCoords [3 ] + " " + regionCoords [1 ] + " " + regionCoords [2 ])
102+ arguments .append ("-projwin" )
103+ arguments .append (regionCoords [0 ])
104+ arguments .append (regionCoords [3 ])
105+ arguments .append (regionCoords [1 ])
106+ arguments .append (regionCoords [2 ])
99107 if srs is not None :
100- arguments .append ("-a_srs " + str (srs ))
108+ arguments .append ("-a_srs" )
109+ arguments .append (str (srs ))
101110 if sds :
102111 arguments .append ("-sds" )
103- arguments .append (extra )
112+ if len (extra ) > 0 :
113+ arguments .append (extra )
104114 arguments .append (self .getParameterValue (translate .INPUT ))
105115 arguments .append (out )
106116
0 commit comments