pktools 2.6.7
Processing Kernel for geospatial data
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qgis.pkgetmask.pkgetmask Class Reference
Inheritance diagram for qgis.pkgetmask.pkgetmask:
Inheritance graph
[legend]
Collaboration diagram for qgis.pkgetmask.pkgetmask:
Collaboration graph
[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 BAND = "BAND"
 
string MIN = "MIN"
 
string MAX = "MAX"
 
list OPERATOR_OPTIONS = ["OR", "AND"]
 
string OPERATOR = "OPERATOR"
 
string DATA = "DATA"
 
string NODATA = "NODATA"
 
string OUTPUT = "OUTPUT"
 
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 pkgetmask.py.

Member Function Documentation

◆ cliName()

def qgis.pkgetmask.pkgetmask.cliName (   self)

Definition at line 53 of file pkgetmask.py.

53 def cliName(self):
54 return "pkgetmask"
55

◆ defineCharacteristics()

def qgis.pkgetmask.pkgetmask.defineCharacteristics (   self)

Definition at line 56 of file pkgetmask.py.

56 def defineCharacteristics(self):
57 self.name = "create mask from raster dataset"
58 self.group = "[pktools] raster"
59 self.addParameter(ParameterRaster(self.INPUT, 'Input layer raster data set',ParameterRaster))
60 self.addParameter(ParameterString(self.BAND, "Band(s) used for mask (e.g., 0;1)","0"))
61 self.addParameter(ParameterString(self.MIN, "Minimum valid value (one value per band)","none"))
62 self.addParameter(ParameterString(self.MAX, "Maximum valid value (one value per band)","none"))
63 self.addParameter(ParameterSelection(self.OPERATOR,"getmask rule",self.OPERATOR_OPTIONS, 0))
64 self.addParameter(ParameterString(self.DATA, "write value(s) for valid pixels (e.g., 0;255)","1"))
65 self.addParameter(ParameterString(self.NODATA, "write value(s) for invalid pixels","0"))
66 self.addOutput(OutputRaster(self.OUTPUT, "Output raster data set"))
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.pkgetmask.pkgetmask.processAlgorithm (   self,
  progress 
)

Definition at line 71 of file pkgetmask.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 band=self.getParameterValue(self.BAND)
80 bandValues = band.split(';')
81 for bandValue in bandValues:
82 commands.append('-band')
83 commands.append(bandValue)
84 min=self.getParameterValue(self.MIN)
85 if min != "none":
86 minValues = min.split(';')
87 for minValue in minValues:
88 commands.append('-min')
89 commands.append(minValue)
90 max=self.getParameterValue(self.MAX)
91 if max != "none":
92 maxValues = max.split(';')
93 for maxValue in maxValues:
94 commands.append('-max')
95 commands.append(maxValue)
96 commands.append("-p")
97 commands.append(self.OPERATOR_OPTIONS[self.getParameterValue(self.OPERATOR)])
98 data=self.getParameterValue(self.DATA)
99 if data != "none":
100 dataValues = data.split(';')
101 for dataValue in dataValues:
102 commands.append('-data')
103 commands.append(dataValue)
104 nodata=self.getParameterValue(self.NODATA)
105 if nodata != "none":
106 nodataValues = nodata.split(';')
107 for nodataValue in nodataValues:
108 commands.append('-nodata')
109 commands.append(nodataValue)
110 if self.TYPE[self.getParameterValue(self.RTYPE)] != "none":
111 commands.append('-ot')
112 commands.append(self.TYPE[self.getParameterValue(self.RTYPE)])
113 output=self.getOutputValue(self.OUTPUT)
114 if output != "":
115 commands.append("-o")
116 commands.append('"' + output + '"')
117
118 data=self.getParameterValue(self.DATA)
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.pkgetmask.pkgetmask.BAND = "BAND"
static

Definition at line 41 of file pkgetmask.py.

◆ DATA

string qgis.pkgetmask.pkgetmask.DATA = "DATA"
static

Definition at line 46 of file pkgetmask.py.

◆ EXTRA

string qgis.pkgetmask.pkgetmask.EXTRA = 'EXTRA'
static

Definition at line 51 of file pkgetmask.py.

◆ group

qgis.pkgetmask.pkgetmask.group

Definition at line 58 of file pkgetmask.py.

◆ INPUT

string qgis.pkgetmask.pkgetmask.INPUT = "INPUT"
static

Definition at line 40 of file pkgetmask.py.

◆ MAX

string qgis.pkgetmask.pkgetmask.MAX = "MAX"
static

Definition at line 43 of file pkgetmask.py.

◆ MIN

string qgis.pkgetmask.pkgetmask.MIN = "MIN"
static

Definition at line 42 of file pkgetmask.py.

◆ name

qgis.pkgetmask.pkgetmask.name

Definition at line 57 of file pkgetmask.py.

◆ NODATA

string qgis.pkgetmask.pkgetmask.NODATA = "NODATA"
static

Definition at line 47 of file pkgetmask.py.

◆ OPERATOR

string qgis.pkgetmask.pkgetmask.OPERATOR = "OPERATOR"
static

Definition at line 45 of file pkgetmask.py.

◆ OPERATOR_OPTIONS

list qgis.pkgetmask.pkgetmask.OPERATOR_OPTIONS = ["OR", "AND"]
static

Definition at line 44 of file pkgetmask.py.

◆ OUTPUT

string qgis.pkgetmask.pkgetmask.OUTPUT = "OUTPUT"
static

Definition at line 48 of file pkgetmask.py.

◆ RTYPE

string qgis.pkgetmask.pkgetmask.RTYPE = 'RTYPE'
static

Definition at line 49 of file pkgetmask.py.

◆ TYPE

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

Definition at line 50 of file pkgetmask.py.


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