2012-10-05 23:28:47 +02:00
# -*- coding: utf-8 -*-
"""
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SagaAlgorithm . py
- - - - - - - - - - - - - - - - - - - - -
Date : August 2012
Copyright : ( C ) 2012 by Victor Olaya
Email : volayaf at gmail dot com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* This program is free software ; you can redistribute it and / or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation ; either version 2 of the License , or *
* ( at your option ) any later version . *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
"""
2013-08-26 00:30:43 +02:00
from processing . parameters . ParameterTableField import ParameterTableField
2012-10-05 23:28:47 +02:00
__author__ = ' Victor Olaya '
__date__ = ' August 2012 '
__copyright__ = ' (C) 2012, Victor Olaya '
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = ' $Format: % H$ '
2012-09-15 18:25:25 +03:00
import os
2013-07-23 14:28:24 +02:00
import importlib
2012-09-15 18:25:25 +03:00
from qgis . core import *
from PyQt4 . QtCore import *
from PyQt4 . QtGui import *
2013-08-12 20:44:27 +02:00
from processing . core . GeoAlgorithm import GeoAlgorithm
from processing . parameters . ParameterTable import ParameterTable
from processing . outputs . OutputTable import OutputTable
from processing . parameters . ParameterMultipleInput import ParameterMultipleInput
from processing . parameters . ParameterRaster import ParameterRaster
from processing . outputs . OutputRaster import OutputRaster
from processing . parameters . ParameterVector import ParameterVector
from processing . parameters . ParameterBoolean import ParameterBoolean
from processing . core . ProcessingUtils import ProcessingUtils
from processing . outputs . OutputVector import OutputVector
from processing . saga . SagaUtils import SagaUtils
from processing . saga . SagaGroupNameDecorator import SagaGroupNameDecorator
from processing . core . GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing . parameters . ParameterFactory import ParameterFactory
from processing . outputs . OutputFactory import OutputFactory
from processing . core . ProcessingConfig import ProcessingConfig
from processing . core . QGisLayers import QGisLayers
from processing . parameters . ParameterNumber import ParameterNumber
from processing . parameters . ParameterSelection import ParameterSelection
from processing . core . LayerExporter import LayerExporter
from processing . parameters . ParameterExtent import ParameterExtent
from processing . parameters . ParameterFixedTable import ParameterFixedTable
from processing . core . ProcessingLog import ProcessingLog
2012-09-15 18:25:25 +03:00
class SagaAlgorithm ( GeoAlgorithm ) :
OUTPUT_EXTENT = " OUTPUT_EXTENT "
def __init__ ( self , descriptionfile ) :
self . resample = True #True if it should resample
#in case several non-matching raster layers are used as input
GeoAlgorithm . __init__ ( self )
self . descriptionFile = descriptionfile
self . defineCharacteristicsFromFile ( )
if self . resample :
#reconsider resampling policy now that we know the input parameters
self . resample = self . setResamplingPolicy ( )
def getCopy ( self ) :
newone = SagaAlgorithm ( self . descriptionFile )
newone . provider = self . provider
return newone
def setResamplingPolicy ( self ) :
count = 0
for param in self . parameters :
if isinstance ( param , ParameterRaster ) :
count + = 1
if isinstance ( param , ParameterMultipleInput ) :
if param . datatype == ParameterMultipleInput . TYPE_RASTER :
return True
return count > 1
def getIcon ( self ) :
return QIcon ( os . path . dirname ( __file__ ) + " /../images/saga.png " )
def defineCharacteristicsFromFile ( self ) :
2013-03-28 21:24:35 +01:00
self . hardcodedStrings = [ ]
2012-09-15 18:25:25 +03:00
lines = open ( self . descriptionFile )
line = lines . readline ( ) . strip ( " \n " ) . strip ( )
self . name = line
2012-10-12 19:14:39 +02:00
if " | " in self . name :
tokens = self . name . split ( " | " )
self . name = tokens [ 0 ]
self . cmdname = tokens [ 1 ]
else :
self . cmdname = self . name
2013-04-12 17:18:51 +02:00
self . name = self . name [ 0 ] . upper ( ) + self . name [ 1 : ] . lower ( )
2012-09-15 18:25:25 +03:00
line = lines . readline ( ) . strip ( " \n " ) . strip ( )
self . undecoratedGroup = line
self . group = SagaGroupNameDecorator . getDecoratedName ( self . undecoratedGroup )
while line != " " :
line = line . strip ( " \n " ) . strip ( )
2013-03-31 21:18:27 +02:00
if line . startswith ( " Hardcoded " ) :
2013-03-28 21:24:35 +01:00
self . hardcodedStrings . append ( line [ len ( " Harcoded| " ) + 1 : ] )
elif line . startswith ( " Parameter " ) :
2012-09-15 18:25:25 +03:00
self . addParameter ( ParameterFactory . getFromString ( line ) )
elif line . startswith ( " DontResample " ) :
self . resample = False
elif line . startswith ( " Extent " ) : #An extent parameter that wraps 4 SAGA numerical parameters
self . extentParamNames = line [ 6 : ] . strip ( ) . split ( " " )
self . addParameter ( ParameterExtent ( self . OUTPUT_EXTENT , " Output extent " , " 0,1,0,1 " ) )
else :
self . addOutput ( OutputFactory . getFromString ( line ) )
line = lines . readline ( ) . strip ( " \n " ) . strip ( )
lines . close ( )
def calculateResamplingExtent ( self ) :
''' this method calculates the resampling extent, but it might set self.resample
to false if , with the current layers , there is no need to resample '''
2013-08-12 20:44:27 +02:00
auto = ProcessingConfig . getSetting ( SagaUtils . SAGA_AUTO_RESAMPLING )
2012-09-15 18:25:25 +03:00
if auto :
first = True ;
self . inputExtentsCount = 0
for param in self . parameters :
if param . value :
if isinstance ( param , ParameterRaster ) :
if isinstance ( param . value , QgsRasterLayer ) :
layer = param . value
else :
layer = QGisLayers . getObjectFromUri ( param . value )
self . addToResamplingExtent ( layer , first )
first = False
if isinstance ( param , ParameterMultipleInput ) :
if param . datatype == ParameterMultipleInput . TYPE_RASTER :
layers = param . value . split ( " ; " )
for layername in layers :
layer = QGisLayers . getObjectFromUri ( layername )
self . addToResamplingExtent ( layer , first )
first = False
if self . inputExtentsCount < 2 :
self . resample = False
else :
2013-08-12 20:44:27 +02:00
self . xmin = ProcessingConfig . getSetting ( SagaUtils . SAGA_RESAMPLING_REGION_XMIN )
self . xmax = ProcessingConfig . getSetting ( SagaUtils . SAGA_RESAMPLING_REGION_XMAX )
self . ymin = ProcessingConfig . getSetting ( SagaUtils . SAGA_RESAMPLING_REGION_YMIN )
self . ymax = ProcessingConfig . getSetting ( SagaUtils . SAGA_RESAMPLING_REGION_YMAX )
self . cellsize = ProcessingConfig . getSetting ( SagaUtils . SAGA_RESAMPLING_REGION_CELLSIZE )
2012-09-15 18:25:25 +03:00
def addToResamplingExtent ( self , layer , first ) :
if first :
self . inputExtentsCount = 1
self . xmin = layer . extent ( ) . xMinimum ( )
self . xmax = layer . extent ( ) . xMaximum ( )
self . ymin = layer . extent ( ) . yMinimum ( )
self . ymax = layer . extent ( ) . yMaximum ( )
self . cellsize = ( layer . extent ( ) . xMaximum ( ) - layer . extent ( ) . xMinimum ( ) ) / layer . width ( )
else :
cellsize = ( layer . extent ( ) . xMaximum ( ) - layer . extent ( ) . xMinimum ( ) ) / layer . width ( )
if self . xmin != layer . extent ( ) . xMinimum ( ) \
or self . xmax != layer . extent ( ) . xMaximum ( ) \
or self . ymin != layer . extent ( ) . yMinimum ( ) \
or self . ymax != layer . extent ( ) . yMaximum ( ) \
or self . cellsize != cellsize :
self . xmin = min ( self . xmin , layer . extent ( ) . xMinimum ( ) )
self . xmax = max ( self . xmax , layer . extent ( ) . xMaximum ( ) )
self . ymin = min ( self . ymin , layer . extent ( ) . yMinimum ( ) )
self . ymax = max ( self . ymax , layer . extent ( ) . yMaximum ( ) )
self . cellsize = max ( self . cellsize , cellsize )
self . inputExtentsCount + = 1
def processAlgorithm ( self , progress ) :
2013-08-12 20:44:27 +02:00
if ProcessingUtils . isWindows ( ) :
2012-09-15 18:25:25 +03:00
path = SagaUtils . sagaPath ( )
if path == " " :
2013-01-12 23:36:00 +01:00
raise GeoAlgorithmExecutionException ( " SAGA folder is not configured. \n Please configure it before running SAGA algorithms. " )
2012-09-15 18:25:25 +03:00
commands = list ( )
self . exportedLayers = { }
2013-08-25 10:45:52 +02:00
2013-07-23 13:05:24 +02:00
self . preProcessInputs ( )
2012-09-15 18:25:25 +03:00
#1: Export rasters to sgrd and vectors to shp
# Tables must be in dbf format. We check that.
if self . resample :
self . calculateResamplingExtent ( )
for param in self . parameters :
if isinstance ( param , ParameterRaster ) :
if param . value == None :
continue
value = param . value
if not value . endswith ( " sgrd " ) :
commands . append ( self . exportRasterLayer ( value ) )
if self . resample :
commands . append ( self . resampleRasterLayer ( value ) ) ;
if isinstance ( param , ParameterVector ) :
if param . value == None :
continue
layer = QGisLayers . getObjectFromUri ( param . value , False )
if layer :
filename = LayerExporter . exportVectorLayer ( layer )
self . exportedLayers [ param . value ] = filename
elif not param . value . endswith ( " shp " ) :
2013-09-02 00:54:25 +02:00
raise GeoAlgorithmExecutionException ( " Unsupported file format " )
2012-09-15 18:25:25 +03:00
if isinstance ( param , ParameterTable ) :
if param . value == None :
continue
2013-02-16 00:20:38 +01:00
table = QGisLayers . getObjectFromUri ( param . value , False )
if table :
filename = LayerExporter . exportTable ( table )
self . exportedLayers [ param . value ] = filename
elif not param . value . endswith ( " shp " ) :
raise GeoAlgorithmExecutionException ( " Unsupported file format " )
2012-09-15 18:25:25 +03:00
if isinstance ( param , ParameterMultipleInput ) :
if param . value == None :
continue
layers = param . value . split ( " ; " )
if layers == None or len ( layers ) == 0 :
continue
if param . datatype == ParameterMultipleInput . TYPE_RASTER :
for layerfile in layers :
if not layerfile . endswith ( " sgrd " ) :
commands . append ( self . exportRasterLayer ( layerfile ) )
if self . resample :
commands . append ( self . resampleRasterLayer ( layerfile ) ) ;
elif param . datatype == ParameterMultipleInput . TYPE_VECTOR_ANY :
for layerfile in layers :
layer = QGisLayers . getObjectFromUri ( layerfile , False )
if layer :
filename = LayerExporter . exportVectorLayer ( layer )
self . exportedLayers [ layerfile ] = filename
2012-10-02 09:14:23 +02:00
elif ( not layerfile . endswith ( " shp " ) ) :
2012-09-15 18:25:25 +03:00
raise GeoAlgorithmExecutionException ( " Unsupported file format " )
#2: set parameters and outputs
2013-08-26 00:30:43 +02:00
saga208 = ProcessingConfig . getSetting ( SagaUtils . SAGA_208 )
if ProcessingUtils . isWindows ( ) or ProcessingUtils . isMac ( ) or not saga208 :
2013-07-15 22:16:43 +02:00
command = self . undecoratedGroup + " \" " + self . cmdname + " \" "
else :
command = " lib " + self . undecoratedGroup + " \" " + self . cmdname + " \" "
2013-07-12 16:27:06 +02:00
2013-03-28 21:24:35 +01:00
if self . hardcodedStrings :
for s in self . hardcodedStrings :
command + = " " + s
2013-03-31 21:18:27 +02:00
2012-09-15 18:25:25 +03:00
for param in self . parameters :
if param . value is None :
continue
2013-02-16 00:20:38 +01:00
if isinstance ( param , ( ParameterRaster , ParameterVector , ParameterTable ) ) :
2012-09-15 18:25:25 +03:00
value = param . value
if value in self . exportedLayers . keys ( ) :
2013-03-28 21:24:35 +01:00
command + = ( " - " + param . name + " \" " + self . exportedLayers [ value ] + " \" " )
2012-09-15 18:25:25 +03:00
else :
2013-03-28 21:24:35 +01:00
command + = ( " - " + param . name + " \" " + value + " \" " )
2012-09-15 18:25:25 +03:00
elif isinstance ( param , ParameterMultipleInput ) :
s = param . value
for layer in self . exportedLayers . keys ( ) :
s = s . replace ( layer , self . exportedLayers [ layer ] )
2013-03-28 21:24:35 +01:00
command + = ( " - " + param . name + " \" " + s + " \" " ) ;
2012-09-15 18:25:25 +03:00
elif isinstance ( param , ParameterBoolean ) :
if param . value :
command + = ( " - " + param . name ) ;
elif isinstance ( param , ParameterFixedTable ) :
2013-08-12 20:44:27 +02:00
tempTableFile = ProcessingUtils . getTempFilename ( " txt " )
2012-09-15 18:25:25 +03:00
f = open ( tempTableFile , " w " )
f . write ( ' \t ' . join ( [ col for col in param . cols ] ) + " \n " )
2012-12-10 00:12:07 +01:00
values = param . value . split ( " , " )
2012-09-15 18:25:25 +03:00
for i in range ( 0 , len ( values ) , 3 ) :
s = values [ i ] + " \t " + values [ i + 1 ] + " \t " + values [ i + 2 ] + " \n "
f . write ( s )
f . close ( )
2012-11-20 21:33:03 +01:00
command + = ( " - " + param . name + " \" " + tempTableFile + " \" " )
2012-09-15 18:25:25 +03:00
elif isinstance ( param , ParameterExtent ) :
2012-10-27 10:59:23 +02:00
#'we have to substract/add half cell size, since saga is center based, not corner based
2012-10-20 21:38:46 +02:00
halfcell = self . getOutputCellsize ( ) / 2
2012-10-27 10:59:23 +02:00
offset = [ halfcell , - halfcell , halfcell , - halfcell ]
2012-09-15 18:25:25 +03:00
values = param . value . split ( " , " )
for i in range ( 4 ) :
2012-10-20 21:38:46 +02:00
command + = ( " - " + self . extentParamNames [ i ] + " " + str ( float ( values [ i ] ) + offset [ i ] ) ) ;
2012-09-15 18:25:25 +03:00
elif isinstance ( param , ( ParameterNumber , ParameterSelection ) ) :
command + = ( " - " + param . name + " " + str ( param . value ) ) ;
else :
command + = ( " - " + param . name + " \" " + str ( param . value ) + " \" " ) ;
for out in self . outputs :
if isinstance ( out , OutputRaster ) :
2013-03-23 21:44:20 +01:00
filename = out . getCompatibleFileName ( self )
2013-08-12 20:44:27 +02:00
filename = ProcessingUtils . tempFolder ( ) + os . sep + os . path . basename ( filename ) + " .sgrd "
2012-09-15 18:25:25 +03:00
command + = ( " - " + out . name + " \" " + filename + " \" " ) ;
if isinstance ( out , OutputVector ) :
2013-03-23 21:44:20 +01:00
filename = out . getCompatibleFileName ( self )
2012-09-15 18:25:25 +03:00
command + = ( " - " + out . name + " \" " + filename + " \" " ) ;
if isinstance ( out , OutputTable ) :
2013-03-23 21:44:20 +01:00
filename = out . getCompatibleFileName ( self )
2012-09-15 18:25:25 +03:00
command + = ( " - " + out . name + " \" " + filename + " \" " ) ;
commands . append ( command )
#3:Export resulting raster layers
for out in self . outputs :
if isinstance ( out , OutputRaster ) :
2013-01-21 23:05:17 +01:00
filename = out . getCompatibleFileName ( self )
2013-08-12 20:44:27 +02:00
filename2 = ProcessingUtils . tempFolder ( ) + os . sep + os . path . basename ( filename ) + " .sgrd "
2013-09-03 21:59:14 +02:00
formatIndex = 1 if saga208 else 4
if ProcessingUtils . isWindows ( ) or ProcessingUtils . isMac ( ) or not saga208 :
2013-08-26 00:30:43 +02:00
commands . append ( " io_gdal 1 -GRIDS \" " + filename2 + " \" -FORMAT " + str ( formatIndex ) + " -TYPE 0 -FILE \" " + filename + " \" " ) ;
2013-07-15 22:16:43 +02:00
else :
2013-07-17 21:40:20 +02:00
commands . append ( " libio_gdal 1 -GRIDS \" " + filename2 + " \" -FORMAT 1 -TYPE 0 -FILE \" " + filename + " \" " ) ;
2013-07-12 16:27:06 +02:00
2013-08-25 10:45:52 +02:00
2012-09-15 18:25:25 +03:00
#4 Run SAGA
2013-07-23 13:05:24 +02:00
commands = self . editCommands ( commands )
2012-09-15 18:25:25 +03:00
SagaUtils . createSagaBatchJobFileFromSagaCommands ( commands )
loglines = [ ]
loglines . append ( " SAGA execution commands " )
for line in commands :
progress . setCommand ( line )
loglines . append ( line )
2013-08-12 20:44:27 +02:00
if ProcessingConfig . getSetting ( SagaUtils . SAGA_LOG_COMMANDS ) :
ProcessingLog . addToLog ( ProcessingLog . LOG_INFO , loglines )
2012-09-15 18:25:25 +03:00
SagaUtils . executeSaga ( progress ) ;
2012-12-10 00:12:07 +01:00
2013-07-23 13:05:24 +02:00
def preProcessInputs ( self ) :
name = self . commandLineName ( ) . replace ( ' . ' , ' _ ' ) [ len ( ' saga: ' ) : ]
try :
2013-08-12 20:44:27 +02:00
module = importlib . import_module ( ' processing.grass.ext. ' + name )
2013-07-23 13:05:24 +02:00
except ImportError :
return
if hasattr ( module , ' preProcessInputs ' ) :
func = getattr ( module , ' preProcessInputs ' )
func ( self )
2013-08-25 10:45:52 +02:00
2013-07-23 13:05:24 +02:00
def editCommands ( self , commands ) :
name = self . commandLineName ( ) [ len ( ' saga: ' ) : ]
try :
2013-08-12 20:44:27 +02:00
module = importlib . import_module ( ' processing.saga.ext. ' + name )
2013-07-23 13:05:24 +02:00
except ImportError :
return commands
if hasattr ( module , ' editCommands ' ) :
func = getattr ( module , ' editCommands ' )
return func ( commands )
else :
return commands
2012-10-20 21:38:46 +02:00
def getOutputCellsize ( self ) :
2012-10-27 23:06:38 +02:00
''' tries to guess the cellsize of the output, searching for a parameter with an appropriate name for it '''
2012-10-20 21:38:46 +02:00
cellsize = 0 ;
for param in self . parameters :
if param . value is not None and param . name == " USER_SIZE " :
cellsize = float ( param . value )
break ;
return cellsize
2012-12-10 00:12:07 +01:00
2012-09-15 18:25:25 +03:00
def resampleRasterLayer ( self , layer ) :
''' this is supposed to be run after having exported all raster layers '''
if layer in self . exportedLayers . keys ( ) :
inputFilename = self . exportedLayers [ layer ]
else :
inputFilename = layer
2013-08-12 20:44:27 +02:00
destFilename = ProcessingUtils . getTempFilename ( " sgrd " )
2012-09-15 18:25:25 +03:00
self . exportedLayers [ layer ] = destFilename
2013-08-26 00:30:43 +02:00
saga208 = ProcessingConfig . getSetting ( SagaUtils . SAGA_208 )
if ProcessingUtils . isWindows ( ) or ProcessingUtils . isMac ( ) or not saga208 :
2013-07-15 22:16:43 +02:00
s = " grid_tools \" Resampling \" -INPUT \" " + inputFilename + " \" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " + \
str ( self . xmin ) + " -USER_XMAX " + str ( self . xmax ) + " -USER_YMIN " + str ( self . ymin ) + " -USER_YMAX " + str ( self . ymax ) + \
" -USER_SIZE " + str ( self . cellsize ) + " -USER_GRID \" " + destFilename + " \" "
else :
s = " libgrid_tools \" Resampling \" -INPUT \" " + inputFilename + " \" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " + \
str ( self . xmin ) + " -USER_XMAX " + str ( self . xmax ) + " -USER_YMIN " + str ( self . ymin ) + " -USER_YMAX " + str ( self . ymax ) + \
" -USER_SIZE " + str ( self . cellsize ) + " -USER_GRID \" " + destFilename + " \" "
2012-09-15 18:25:25 +03:00
return s
2013-09-03 21:59:14 +02:00
def exportRasterLayer ( self , source ) :
2013-09-02 00:54:25 +02:00
layer = QGisLayers . getObjectFromUri ( source , False )
if layer :
filename = str ( layer . name ( ) )
else :
2013-09-03 21:59:14 +02:00
filename = source . rstrip ( " .sgrd " )
2013-09-02 00:54:25 +02:00
validChars = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789: "
filename = ' ' . join ( c for c in filename if c in validChars )
if len ( filename ) == 0 :
filename = " layer "
destFilename = ProcessingUtils . getTempFilenameInTempFolder ( filename + " .sgrd " )
self . exportedLayers [ source ] = destFilename
2013-08-26 00:30:43 +02:00
saga208 = ProcessingConfig . getSetting ( SagaUtils . SAGA_208 )
if ProcessingUtils . isWindows ( ) or ProcessingUtils . isMac ( ) or not saga208 :
2013-09-02 00:54:25 +02:00
return " io_gdal 0 -GRIDS \" " + destFilename + " \" -FILES \" " + source + " \" "
2012-09-15 18:25:25 +03:00
else :
2013-09-02 00:54:25 +02:00
return " libio_gdal 0 -GRIDS \" " + destFilename + " \" -FILES \" " + source + " \" "
2013-09-03 21:59:14 +02:00
2012-09-15 18:25:25 +03:00
2013-03-31 21:18:27 +02:00
def checkBeforeOpeningParametersDialog ( self ) :
2013-04-12 17:18:51 +02:00
msg = SagaUtils . checkSagaIsInstalled ( )
2013-04-15 07:16:20 +02:00
if msg is not None :
html = ( " <p>This algorithm requires SAGA to be run. "
" Unfortunately, it seems that SAGA is not installed in your system, or it is not correctly configured to be used from QGIS</p> " )
2013-08-12 20:44:27 +02:00
html + = ' <p><a href= " http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html " >Click here</a> to know more about how to install and configure SAGA to be used with QGIS</p> '
2013-04-12 17:18:51 +02:00
return html
2013-03-26 14:15:12 +01:00
2013-03-12 00:00:36 +01:00
def checkParameterValuesBeforeExecuting ( self ) :
''' We check that there are no multiband layers, which are not supported by SAGA '''
for param in self . parameters :
2013-03-26 14:15:12 +01:00
if isinstance ( param , ParameterRaster ) :
2013-03-12 00:00:36 +01:00
value = param . value
layer = QGisLayers . getObjectFromUri ( value )
if layer is not None and layer . bandCount ( ) > 1 :
return ( " Input layer " + str ( layer . name ( ) ) + " has more than one band. \n "
2013-07-21 21:53:27 +02:00
+ " Multiband layers are not supported by SAGA " )
2012-09-15 18:25:25 +03:00
def helpFile ( self ) :
2013-02-28 22:08:32 +01:00
return os . path . join ( os . path . dirname ( __file__ ) , " help " , self . name . replace ( " " , " " ) + " .html " )
2013-07-18 17:16:16 +02:00
def getPostProcessingErrorMessage ( self , wrongLayers ) :
html = GeoAlgorithm . getPostProcessingErrorMessage ( self , wrongLayers )
msg = SagaUtils . checkSagaIsInstalled ( True )
html + = ( " <p>This algorithm requires SAGA to be run. A test to check if SAGA is correctly installed "
" and configured in your system has been performed, with the following result:</p><ul><i> " )
if msg is None :
html + = " SAGA seems to be correctly installed and configured</li></ul> "
else :
html + = msg + " </i></li></ul> "
2013-08-12 20:44:27 +02:00
html + = ' <p><a href= " http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html " >Click here</a> to know more about how to install and configure SAGA to be used with QGIS</p> '
2013-02-28 22:08:32 +01:00
2013-07-18 17:16:16 +02:00
return html