use output field param's value executing gdal_polygonize, change default output field name to DN (fix #5416)

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@132 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
This commit is contained in:
brushtyler 2012-04-19 19:39:12 +00:00
parent e9f069906d
commit 8b18892614

View File

@ -1,4 +1,4 @@
from PyQt4 import QtGui
from PyQt4 import QtGui, QtCore
from sextante.core.GeoAlgorithm import GeoAlgorithm
from sextante.parameters.ParameterRaster import ParameterRaster
import os
@ -21,7 +21,7 @@ class polygonize(GeoAlgorithm):
self.name = "polygonize"
self.group = "Conversion"
self.addParameter(ParameterRaster(polygonize.INPUT, "Input layer", False))
self.addParameter(ParameterString(polygonize.FIELD, "Output field name", "Value"))
self.addParameter(ParameterString(polygonize.FIELD, "Output field name", "DN"))
self.addOutput(OutputVector(polygonize.OUTPUT, "Output layer"))
def processAlgorithm(self, progress):
@ -32,7 +32,9 @@ class polygonize(GeoAlgorithm):
commands.append(self.getParameterValue(polygonize.INPUT))
commands.append('-f')
commands.append('"ESRI Shapefile"')
commands.append(self.getOutputValue(polygonize.OUTPUT))
output = self.getOutputValue(polygonize.OUTPUT)
commands.append(output)
commands.append(QtCore.QFileInfo(output).baseName())
commands.append(self.getParameterValue(polygonize.FIELD))
GdalUtils.runGdal(commands, progress)