pktools 2.6.7
Processing Kernel for geospatial data
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qgis.pkcomposite.pkcomposite Class Reference
Inheritance diagram for qgis.pkcomposite.pkcomposite:
Inheritance graph
[legend]
Collaboration diagram for qgis.pkcomposite.pkcomposite:
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 OUTPUT = "OUTPUT"
 
list CRULE_OPTIONS = ["overwrite", "maxndvi", "maxband", "minband", "validband", "mean", "mode", "median", "sum", "minallbands", "maxallbands","stdev"]
 
string CRULE = "CRULE"
 
string DX = "DX"
 
string DY = "DY"
 
string PROJWIN = 'PROJWIN'
 
string CB = "CB"
 
string SRCNODATA = "SRCNODATA"
 
string BNDNODATA = "BNDNODATA"
 
string DSTNODATA = "DSTNODATA"
 
string MINGUI = "MINGUI"
 
string MAXGUI = "MAXGUI"
 
list RESAMPLE_OPTIONS = ['near', 'bilinear']
 
string RESAMPLE = "RESAMPLE"
 
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 pkcomposite.py.

Member Function Documentation

◆ cliName()

def qgis.pkcomposite.pkcomposite.cliName (   self)

Definition at line 59 of file pkcomposite.py.

59 def cliName(self):
60 return "pkcomposite"
61

◆ defineCharacteristics()

def qgis.pkcomposite.pkcomposite.defineCharacteristics (   self)

Definition at line 62 of file pkcomposite.py.

62 def defineCharacteristics(self):
63 self.name = "composite/mosaic raster datasets"
64 self.group = "[pktools] raster"
65 self.addParameter(ParameterMultipleInput(self.INPUT, 'Input layer raster data set',ParameterMultipleInput.TYPE_RASTER))
66 self.addParameter(ParameterSelection(self.CRULE,"composite rule",self.CRULE_OPTIONS, 0))
67 self.addOutput(OutputRaster(self.OUTPUT, "Output raster data set"))
68 self.addParameter(ParameterSelection(self.RTYPE, 'Output raster type (leave as none to keep original type)', self.TYPE, 0))
69 self.addParameter(ParameterNumber(self.DX, "Output resolution in x (leave 0 for no change)",0.0,None,0.0))
70 self.addParameter(ParameterNumber(self.DY, "Output resolution in y (leave 0 for no change)",0.0,None,0.0))
71 self.addParameter(ParameterExtent(self.PROJWIN,
72 'Georeferenced boundingbox'))
73 self.addParameter(ParameterString(self.CB, "band index(es) used for the composite rule (0 based), e.g., 0;1 in case of maxndvi","0"))
74 self.addParameter(ParameterString(self.SRCNODATA, "invalid value(s) for input raster dataset (e.g., 0;255)","none"))
75 self.addParameter(ParameterString(self.BNDNODATA, "Band(s) in input image to check if pixel is valid (e.g., 0;1)","0"))
76 self.addParameter(ParameterString(self.DSTNODATA, "nodata value to put in output raster dataset if not valid or out of bounds","0"))
77 self.addParameter(ParameterString(self.MINGUI, "flag values smaller or equal to this value as invalid","none"))
78 self.addParameter(ParameterString(self.MAXGUI, "flag values larger or equal to this value as invalid","none"))
79 self.addParameter(ParameterSelection(self.RESAMPLE,"resampling method",self.RESAMPLE_OPTIONS, 0))
80 self.addParameter(ParameterString(self.EXTRA,
81 'Additional parameters', '-of GTiff', optional=True))
82

◆ processAlgorithm()

def qgis.pkcomposite.pkcomposite.processAlgorithm (   self,
  progress 
)

Definition at line 83 of file pkcomposite.py.

83 def processAlgorithm(self, progress):
84 cliPath = '"' + os.path.join(pktoolsUtils.pktoolsPath(), self.cliName()) + '"'
85 commands = [cliPath]
86
87 input=self.getParameterValue(self.INPUT)
88 inputFiles = input.split(';')
89 for inputFile in inputFiles:
90 commands.append('-i')
91 commands.append('"' + inputFile + '"')
92
93 if self.TYPE[self.getParameterValue(self.RTYPE)] != "none":
94 commands.append('-ot')
95 commands.append(self.TYPE[self.getParameterValue(self.RTYPE)])
96 output=self.getOutputValue(self.OUTPUT)
97 if output != "":
98 commands.append("-o")
99 commands.append('"' + output + '"')
100 commands.append("-cr")
101 commands.append(self.CRULE_OPTIONS[self.getParameterValue(self.CRULE)])
102 if self.getParameterValue(self.DX) != 0:
103 commands.append("-dx")
104 commands.append(str(self.getParameterValue(self.DX)))
105 if self.getParameterValue(self.DY) != 0:
106 commands.append("-dy")
107 commands.append(str(self.getParameterValue(self.DY)))
108 projwin = str(self.getParameterValue(self.PROJWIN))
109 regionCoords = projwin.split(',')
110 commands.append('-ulx')
111 commands.append(regionCoords[0])
112 commands.append('-uly')
113 commands.append(regionCoords[3])
114 commands.append('-lrx')
115 commands.append(regionCoords[1])
116 commands.append('-lry')
117 commands.append(regionCoords[2])
118 cb=self.getParameterValue(self.CB)
119 cbValues = cb.split(';')
120 for cbValue in cbValues:
121 commands.append('-cb')
122 commands.append(cbValue)
123 srcnodata=self.getParameterValue(self.SRCNODATA)
124 if srcnodata != "none":
125 srcnodataValues = srcnodata.split(';')
126 for srcnodataValue in srcnodataValues:
127 commands.append('-srcnodata')
128 commands.append(srcnodataValue)
129 bndnodata=self.getParameterValue(self.BNDNODATA)
130 bndnodataValues = bndnodata.split(';')
131 for bndnodataValue in bndnodataValues:
132 commands.append('-bndnodata')
133 commands.append(bndnodataValue)
134 commands.append('-dstnodata')
135 commands.append(self.getParameterValue(self.DSTNODATA))
136
137 minGUI=self.getParameterValue(self.MINGUI)
138 if minGUI != "none":
139 minValues = minGUI.split(';')
140 for minValue in minValues:
141 commands.append('-min')
142 commands.append(minValue)
143 maxGUI=self.getParameterValue(self.MAXGUI)
144 if maxGUI != "none":
145 maxValues = maxGUI.split(';')
146 for maxValue in maxValues:
147 commands.append('-max')
148 commands.append(maxValue)
149 commands.append("-r")
150 commands.append(self.RESAMPLE_OPTIONS[self.getParameterValue(self.RESAMPLE)])
151 extra = str(self.getParameterValue(self.EXTRA))
152 if len(extra) > 0:
153 commands.append(extra)
154
155 pktoolsUtils.runpktools(commands, progress)

Member Data Documentation

◆ BNDNODATA

string qgis.pkcomposite.pkcomposite.BNDNODATA = "BNDNODATA"
static

Definition at line 49 of file pkcomposite.py.

◆ CB

string qgis.pkcomposite.pkcomposite.CB = "CB"
static

Definition at line 47 of file pkcomposite.py.

◆ CRULE

string qgis.pkcomposite.pkcomposite.CRULE = "CRULE"
static

Definition at line 43 of file pkcomposite.py.

◆ CRULE_OPTIONS

list qgis.pkcomposite.pkcomposite.CRULE_OPTIONS = ["overwrite", "maxndvi", "maxband", "minband", "validband", "mean", "mode", "median", "sum", "minallbands", "maxallbands","stdev"]
static

Definition at line 42 of file pkcomposite.py.

◆ DSTNODATA

string qgis.pkcomposite.pkcomposite.DSTNODATA = "DSTNODATA"
static

Definition at line 50 of file pkcomposite.py.

◆ DX

string qgis.pkcomposite.pkcomposite.DX = "DX"
static

Definition at line 44 of file pkcomposite.py.

◆ DY

string qgis.pkcomposite.pkcomposite.DY = "DY"
static

Definition at line 45 of file pkcomposite.py.

◆ EXTRA

string qgis.pkcomposite.pkcomposite.EXTRA = 'EXTRA'
static

Definition at line 57 of file pkcomposite.py.

◆ group

qgis.pkcomposite.pkcomposite.group

Definition at line 64 of file pkcomposite.py.

◆ INPUT

string qgis.pkcomposite.pkcomposite.INPUT = "INPUT"
static

Definition at line 40 of file pkcomposite.py.

◆ MAXGUI

string qgis.pkcomposite.pkcomposite.MAXGUI = "MAXGUI"
static

Definition at line 52 of file pkcomposite.py.

◆ MINGUI

string qgis.pkcomposite.pkcomposite.MINGUI = "MINGUI"
static

Definition at line 51 of file pkcomposite.py.

◆ name

qgis.pkcomposite.pkcomposite.name

Definition at line 63 of file pkcomposite.py.

◆ OUTPUT

string qgis.pkcomposite.pkcomposite.OUTPUT = "OUTPUT"
static

Definition at line 41 of file pkcomposite.py.

◆ PROJWIN

string qgis.pkcomposite.pkcomposite.PROJWIN = 'PROJWIN'
static

Definition at line 46 of file pkcomposite.py.

◆ RESAMPLE

string qgis.pkcomposite.pkcomposite.RESAMPLE = "RESAMPLE"
static

Definition at line 54 of file pkcomposite.py.

◆ RESAMPLE_OPTIONS

list qgis.pkcomposite.pkcomposite.RESAMPLE_OPTIONS = ['near', 'bilinear']
static

Definition at line 53 of file pkcomposite.py.

◆ RTYPE

string qgis.pkcomposite.pkcomposite.RTYPE = 'RTYPE'
static

Definition at line 55 of file pkcomposite.py.

◆ SRCNODATA

string qgis.pkcomposite.pkcomposite.SRCNODATA = "SRCNODATA"
static

Definition at line 48 of file pkcomposite.py.

◆ TYPE

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

Definition at line 56 of file pkcomposite.py.


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