2323# This will get replaced with a git SHA1 when you do a git archive
2424__revision__ = '$Format:%H$'
2525
26+ import os
27+
2628from PyQt4 import QtGui
29+
2730from sextante .core .GeoAlgorithm import GeoAlgorithm
28- from sextante .outputs .OutputRaster import OutputRaster
29- import os
30- from sextante .gdal .GdalUtils import GdalUtils
3131from sextante .core .SextanteUtils import SextanteUtils
32+
33+ from sextante .outputs .OutputRaster import OutputRaster
3234from sextante .parameters .ParameterBoolean import ParameterBoolean
3335from sextante .parameters .ParameterMultipleInput import ParameterMultipleInput
3436
37+ from sextante .gdal .GdalUtils import GdalUtils
38+
3539class merge (GeoAlgorithm ):
3640
3741 INPUT = "INPUT"
@@ -52,20 +56,22 @@ def defineCharacteristics(self):
5256 self .addOutput (OutputRaster (merge .OUTPUT , "Output layer" ))
5357
5458 def processAlgorithm (self , progress ):
55- if SextanteUtils .isWindows ():
56- commands = ["cmd.exe" , "/C " , "gdal_merge.bat" ]
57- else :
58- commands = ["gdal_merge.py" ]
59+ arguments = []
5960 if self .getParameterValue (merge .SEPARATE ):
60- commands .append ("-separate" )
61+ arguments .append ("-separate" )
6162 if self .getParameterValue (merge .PCT ):
62- commands .append ("-pct" )
63- commands .append ("-o" )
63+ arguments .append ("-pct" )
64+ arguments .append ("-o" )
6465 out = self .getOutputValue (merge .OUTPUT )
65- commands .append (out )
66- commands .append ("-of" )
67- commands .append (GdalUtils .getFormatShortNameFromFilename (out ))
68- commands .append (self .getParameterValue (merge .INPUT ).replace (";" , " " ))
66+ arguments .append (out )
67+ arguments .append ("-of" )
68+ arguments .append (GdalUtils .getFormatShortNameFromFilename (out ))
69+ arguments .append (self .getParameterValue (merge .INPUT ).replace (";" , " " ))
6970
71+ commands = []
72+ if SextanteUtils .isWindows ():
73+ commands = ["cmd.exe" , "/C " , "gdal_merge.bat" , GdalUtils .escapeAndJoin (arguments )]
74+ else :
75+ commands = ["gdal_merge.py" , GdalUtils .escapeAndJoin (arguments )]
7076
7177 GdalUtils .runGdal (commands , progress )
0 commit comments