Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@69 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
- Loading branch information
volayaf
committed
Apr 11, 2012
1 parent
69bc4a0
commit b86bbe5
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from PyQt4 import QtGui | ||
from sextante.core.GeoAlgorithm import GeoAlgorithm | ||
from sextante.parameters.ParameterRaster import ParameterRaster | ||
import os | ||
from sextante.gdal.GdalUtils import GdalUtils | ||
from sextante.parameters.ParameterString import ParameterString | ||
from sextante.outputs.OutputVector import OutputVector | ||
|
||
class polygonize(GeoAlgorithm): | ||
|
||
INPUT = "INPUT" | ||
OUTPUT = "OUTPUT" | ||
FIELD = "FIELD" | ||
|
||
def getIcon(self): | ||
filepath = os.path.dirname(__file__) + "/icons/polygonize.png" | ||
return QtGui.QIcon(filepath) | ||
|
||
def defineCharacteristics(self): | ||
self.name = "polygonize" | ||
self.group = "Conversion" | ||
self.addParameter(ParameterRaster(polygonize.INPUT, "Input layer", False)) | ||
self.addParameter(ParameterString(polygonize.FIELD, "Output field name", "Value")) | ||
self.addOutput(OutputVector(polygonize.OUTPUT, "Output layer")) | ||
|
||
def processAlgorithm(self, progress): | ||
commands = ["polygonize"] | ||
commands.append(self.getParameterValue(polygonize.INPUT)) | ||
commands.append("-f") | ||
commands.append("ESRI Shapefile") | ||
commands.append(self.getOutputValue(polygonize.OUTPUT)) | ||
commands.append(self.getParameterValue(polygonize.FIELD)) | ||
|
||
GdalUtils.runGdal(commands, progress) |