| pktools 2.6.7 Processing Kernel for geospatial data

Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qgis.pkreclass.pkreclass Class Reference
Inheritance diagram for qgis.pkreclass.pkreclass:
[legend]
Collaboration diagram for qgis.pkreclass.pkreclass:
[legend]

## Public Member Functions
def | cliName (self)
def | defineCharacteristics (self)
def | processAlgorithm (self, progress)
Public Member Functions inherited from qgis.pktoolsAlgorithm.pktoolsAlgorithm
def | getIcon (self)
def | checkBeforeOpeningParametersDialog (self)
def | help (self)

## Public Attributes
| name
| group

## Static Public Attributes
string | INPUT = "INPUT"
string | OUTPUT = "OUTPUT"
string | CLASS = "CLASS"
string | BAND = "BAND"
string | RECLASS = "RECLASS"
string | MASK = "MASK"
string | MSKNODATA = "MSKNODATA"
string | NODATA = "NODATA"
string | RTYPE = 'RTYPE'
list | TYPE = ['none', 'Byte','Int16','UInt16','UInt32','Int32','Float32','Float64','CInt16','CInt32','CFloat32','CFloat64']
string | EXTRA = 'EXTRA'

## Detailed Description

Definition at line 38 of file pkreclass.py.

## Member Function Documentation

## ◆ cliName()

def qgis.pkreclass.pkreclass.cliName | ( |  | self | ) |

Definition at line 52 of file pkreclass.py.

52 def cliName(self):
53 return "pkreclass"
54

## ◆ defineCharacteristics()

def qgis.pkreclass.pkreclass.defineCharacteristics | ( |  | self | ) |

Definition at line 55 of file pkreclass.py.

55 def defineCharacteristics(self):
56 self.name = "reclass raster datasets"
57 self.group = "[pktools] raster"
58 self.addParameter(ParameterMultipleInput(self.INPUT, 'Input layer raster data set',ParameterMultipleInput.TYPE_RASTER))
59 self.addOutput(OutputRaster(self.OUTPUT, "Output raster data set"))
60 self.addParameter(ParameterString(self.BAND, "Band index(es) to replace, e.g., 0;1;2 (other bands are copied to output)", '0'))
61 self.addParameter(ParameterRaster(self.MASK, "Mask raster dataset",optional=True))
62 self.addParameter(ParameterString(self.MSKNODATA, "Mask value(s) not to consider for classification (e.g., 0;255)","0"))
63 self.addParameter(ParameterString(self.CLASS, "list of classes to reclass, in combination with reclass option, e.g., 0;1;2;3",""))
64 self.addParameter(ParameterString(self.RECLASS, "list of recoded classes, in combination with class option e.g., 10;11;12;13",""))
65 self.addParameter(ParameterNumber(self.NODATA, "nodata value to put in image if not valid",0,None,0))
66
67 self.addParameter(ParameterSelection(self.RTYPE, 'Output raster type (leave as none to keep original type)', self.TYPE, 0))
68 self.addParameter(ParameterString(self.EXTRA,
69 'Additional parameters', '-of GTiff', optional=True))
70

## ◆ processAlgorithm()

def qgis.pkreclass.pkreclass.processAlgorithm | ( |  | self,
|  |  | progress
| ) |  |

Definition at line 71 of file pkreclass.py.

71 def processAlgorithm(self, progress):
72 cliPath = '"' + os.path.join(pktoolsUtils.pktoolsPath(), self.cliName()) + '"'
73 commands = [cliPath]
74
75 input=self.getParameterValue(self.INPUT)
76 commands.append('-i')
77 commands.append('"' + input + '"')
78
79 if self.TYPE[self.getParameterValue(self.RTYPE)] != "none":
80 commands.append('-ot')
81 commands.append(self.TYPE[self.getParameterValue(self.RTYPE)])
82
83 output=self.getOutputValue(self.OUTPUT)
84 commands.append("-o")
85 commands.append('"' + output + '"')
86
87 commands.append('-nodata')
88 commands.append(str(self.getParameterValue(self.NODATA)))
89
90 band=str(self.getParameterValue(self.BAND))
91 if band != '':
92 bandValues = band.split(';')
93 for bandValue in bandValues:
94 commands.append('-b')
95 commands.append(bandValue)
96
97 theclass=str(self.getParameterValue(self.CLASS))
98 if theclass != '':
99 classValues = theclass.split(';')
100 for classValue in classValues:
101 commands.append('-c')
102 commands.append(classValue)
103 reclass=str(self.getParameterValue(self.RECLASS))
104 if reclass != '':
105 reclassValues = reclass.split(';')
106 for reclassValue in reclassValues:
107 commands.append('-r')
108 commands.append(reclassValue)
109
110 mask = str(self.getParameterValue(self.MASK))
111 if mask != "None":
112 commands.append('-m')
113 commands.append(mask)
114 msknodata=str(self.getParameterValue(self.MSKNODATA))
115 msknodataValues = msknodata.split(';')
116 for msknodataValue in msknodataValues:
117 commands.append('-msknodata')
118 commands.append(msknodataValue)
119
120 extra = str(self.getParameterValue(self.EXTRA))
121 if len(extra) > 0:
122 commands.append(extra)
123
124 pktoolsUtils.runpktools(commands, progress)

## Member Data Documentation

## ◆ BAND

string qgis.pkreclass.pkreclass.BAND = "BAND"
| static

Definition at line 43 of file pkreclass.py.

## ◆ CLASS

string qgis.pkreclass.pkreclass.CLASS = "CLASS"
| static

Definition at line 42 of file pkreclass.py.

## ◆ EXTRA

string qgis.pkreclass.pkreclass.EXTRA = 'EXTRA'
| static

Definition at line 50 of file pkreclass.py.

## ◆ group

qgis.pkreclass.pkreclass.group

Definition at line 57 of file pkreclass.py.

## ◆ INPUT

string qgis.pkreclass.pkreclass.INPUT = "INPUT"
| static

Definition at line 40 of file pkreclass.py.

## ◆ MASK

string qgis.pkreclass.pkreclass.MASK = "MASK"
| static

Definition at line 45 of file pkreclass.py.

## ◆ MSKNODATA

string qgis.pkreclass.pkreclass.MSKNODATA = "MSKNODATA"
| static

Definition at line 46 of file pkreclass.py.

## ◆ name

qgis.pkreclass.pkreclass.name

Definition at line 56 of file pkreclass.py.

## ◆ NODATA

string qgis.pkreclass.pkreclass.NODATA = "NODATA"
| static

Definition at line 47 of file pkreclass.py.

## ◆ OUTPUT

string qgis.pkreclass.pkreclass.OUTPUT = "OUTPUT"
| static

Definition at line 41 of file pkreclass.py.

## ◆ RECLASS

string qgis.pkreclass.pkreclass.RECLASS = "RECLASS"
| static

Definition at line 44 of file pkreclass.py.

## ◆ RTYPE

string qgis.pkreclass.pkreclass.RTYPE = 'RTYPE'
| static

Definition at line 48 of file pkreclass.py.

## ◆ TYPE

list qgis.pkreclass.pkreclass.TYPE = ['none', 'Byte','Int16','UInt16','UInt32','Int32','Float32','Float64','CInt16','CInt32','CFloat32','CFloat64']
| static

Definition at line 49 of file pkreclass.py.

The documentation for this class was generated from the following file:

- /tmp/slackdce/slackrepo.NvCr9x/build_pktools/PKTOOLS-2.6.7.6/qgis/pkreclass.py