Skip to content
Browse files
[sextante] minor changes in algorithms and some code cleaning
  • Loading branch information
volaya committed Feb 24, 2013
1 parent 2c00099 commit 7e1f58f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 24 deletions.
@@ -84,10 +84,6 @@ def exportRasterLayer(layer):
Currently, the output is restricted to geotiff, but not all other formats are exported.
Only those formats not supported by GDAL are exported, so it is assumed that the external
app uses GDAL to read the layer'''
exts = GdalUtils.getSupportedRasterExtensions()
for ext in exts:
if (unicode(layer.source()).endswith(ext)):
return unicode(layer.source())

#TODO:Do the conversion here
return unicode(layer.source())
@@ -36,7 +36,6 @@
from sextante.gui.SextantePostprocessing import SextantePostprocessing
from sextante.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor,\

from sextante.modeler.Providers import Providers
from sextante.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
from sextante.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
@@ -52,8 +51,6 @@
from sextante.taudem.TauDEMAlgorithmProvider import TauDEMAlgorithmProvider
from sextante.admintools.AdminToolsAlgorithmProvider import AdminToolsAlgorithmProvider

class Sextante:

iface = None
@@ -149,7 +146,6 @@ def loadFromProviders():

def updateProviders():

for provider in Sextante.providers:

@@ -345,7 +341,7 @@ def cancel():

##This methods are here to be used from the python console,
##These methods are here to be used from the python console,
##making it easy to use SEXTANTE from there

@@ -30,10 +30,10 @@
import os

from osgeo import gdal
gdalAvailable = True
from osgeo import gdal
gdalAvailable = True
gdalAvailable = False
gdalAvailable = False

class GdalUtils():

@@ -30,11 +30,11 @@
##dst_filename=output raster
##connectedness=selection 4;8
##threshold=number 2
from sextante.gdal.GdalUtils import GdalUtils

from osgeo import gdal, ogr

threshold = 2
options = []

@@ -61,10 +61,10 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(translate.OUTSIZE_PERC, "Output size is a percentage of input size", True))
self.addParameter(ParameterString(translate.NO_DATA, "Nodata value, leave as none to take the nodata value from input", "none"))
self.addParameter(ParameterSelection(translate.EXPAND, "Expand", ["none","gray","rgb","rgba"]))
self.addParameter(ParameterCrs(translate.SRS, "Override the projection for the output file", ""))
self.addParameter(ParameterCrs(translate.SRS, "Override the projection for the output file", None))
self.addParameter(ParameterExtent(translate.PROJWIN, "Subset based on georeferenced coordinates"))
self.addParameter(ParameterBoolean(translate.SDS, "Copy all subdatasets of this file to individual output files", False))
self.addParameter(ParameterString(translate.EXTRA, "Additional creation parameters"))
self.addParameter(ParameterString(translate.EXTRA, "Additional creation parameters", " "))
self.addOutput(OutputRaster(translate.OUTPUT, "Output layer"))

def processAlgorithm(self, progress):
@@ -75,8 +75,8 @@ def processAlgorithm(self, progress):
noData = str(self.getParameterValue(translate.NO_DATA))
expand = str(self.getParameterFromName(translate.EXPAND).options[self.getParameterValue(translate.EXPAND)])
projwin = str(self.getParameterValue(translate.PROJWIN))
srs = str(self.getParameterValue(translate.SRS))
sds = str(self.getParameterValue(translate.SDS))
srs = self.getParameterValue(translate.SRS)
sds = self.getParameterValue(translate.SDS)
extra = str(self.getParameterValue(translate.EXTRA))

commands = ["gdal_translate"]
@@ -92,9 +92,9 @@ def processAlgorithm(self, progress):
commands.append("-expand "+expand)
regionCoords = projwin.split(",")
commands.append("-projwin "+regionCoords[0]+" "+regionCoords[3]+" "+regionCoords[1]+" "+regionCoords[2])
if srs != "":
commands.append("-a_srs EPSG:"+srs)
if sds == "True":
if srs is not None:
commands.append("-a_srs "+str(srs))
if sds:
@@ -3,6 +3,7 @@ r.kappa - Calculate error matrix and kappa parameter for accuracy assessment of
Raster (r.*)
ParameterRaster|classification|Raster layer containing classification result|False
ParameterRaster|reference|Raster layer containing reference classes|False
ParameterString|title|Title for error matrix and kappa|ACCURACY ASSESSMENT
ParameterString|title|Title for error matrix and kappa|"ACCURACY ASSESSMENT"
ParameterBoolean|-h|No header in the report|False
ParameterBoolean|-w|Wide report (132 columns)|False
OutputFile|output|Output file containing error matrix and kappa
@@ -38,7 +38,7 @@ class VectorLayerBoundsAlgorithm(GeoAlgorithm):
def defineCharacteristics(self):
self.showInModeler = True
self.showInToolbox = False = "Raster layer bounds" = "Vector layer bounds" = "Modeler-only tools"
self.addParameter(ParameterVector(self.LAYER, "Layer"))
self.addOutput(OutputNumber(self.XMIN, "min X"))
@@ -1,5 +1,6 @@
##Layer = raster|R.raster
##[Example scripts]=group
##Layer = raster
##no_data_value = number 0
Layer <- raster(Layer, 1)

0 comments on commit 7e1f58f

Please sign in to comment.