Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
OTB extents. Test implementation.
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@254 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com committed Jun 19, 2012
1 parent 4899de0 commit b53e211
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/sextante/otb/OTBAlgorithm.py
Expand Up @@ -12,7 +12,7 @@
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.core.SextanteLog import SextanteLog
#~ from sextante.core.Sextante import Sextante
from sextante.core.SextanteUtils import SextanteUtils
from sextante.parameters.ParameterFactory import ParameterFactory
from sextante.outputs.OutputFactory import OutputFactory
from sextante.otb.OTBUtils import OTBUtils
Expand Down Expand Up @@ -69,7 +69,7 @@ def defineCharacteristicsFromFile(self):
elif line.startswith("Extent"):
self.extentParamNames = line[6:].strip().split(" ")
self.addParameter(ParameterExtent(self.REGION_OF_INTEREST, "Region of interest", "0,1,0,1"))
self.roiFile = SextanteUtils.getTempFilename()
self.roiFile = SextanteUtils.getTempFilename('tif')
else:
self.addOutput(OutputFactory.getFromString(line))
line = lines.readline().strip("\n").strip()
Expand Down Expand Up @@ -98,7 +98,7 @@ def processAlgorithm(self, progress):
commands.append(param.name)
if self.roiFile:
commands.append(self.roiFile)
self.roiInput = param.name
self.roiInput = param.value
else:
commands.append(param.value)
elif isinstance(param, ParameterMultipleInput):
Expand All @@ -121,15 +121,20 @@ def processAlgorithm(self, progress):
for out in self.outputs:
commands.append(out.name)
commands.append(out.value)

if self.roiFile:
args = {"in": self.roiInput,
"out": self.roiFile,
"startx": self.roiValues[0],
"starty": self.roiValues[1],
"sizex": self.roiValues[2],
"sizey": self.roiValues[3]}
Sextante.runalg("ExtractROI", *args)
startX, startY = float(self.roiValues[0]), float(self.roiValues[0])
sizeX = float(self.roiValues[2]) - startX
sizeY = float(self.roiValues[3]) - startY
helperCommands = [
path + os.sep + "otbcli_ExtractROI",
"-in", self.roiInput,
"-out", self.roiFile,
"-startx", startX,
"-starty", startY,
"-sizex", sizeX,
"-sizey", sizeY]
OTBUtils.executeOtb(helperCommands, progress)

loglines = []
loglines.append("OTB execution command")
Expand Down
1 change: 1 addition & 0 deletions src/sextante/otb/description/Smoothing.txt
Expand Up @@ -10,3 +10,4 @@ ParameterNumber|-type.mean.radius|Radius|None|None|2
ParameterNumber|-type.gaussian.radius|Radius|None|None|2
ParameterNumber|-type.anidif.timestep|Time Step|None|None|0.125
ParameterNumber|-type.anidif.nbiter|Nb Iterations|None|None|10
Extent

0 comments on commit b53e211

Please sign in to comment.