def processAlgorithm(self, feedback): inputFile = self.getParameterValue(self.INPUT_LAYER) zFactor = self.getParameterValue(self.Z_FACTOR) azimuth = self.getParameterValue(self.AZIMUTH) vAngle = self.getParameterValue(self.V_ANGLE) outputFile = self.getOutputValue(self.OUTPUT_LAYER) outputFormat = raster.formatShortNameFromFileName(outputFile) hillshade = QgsHillshadeFilter(inputFile, outputFile, outputFormat, azimuth, vAngle) hillshade.setZFactor(zFactor) hillshade.processRaster(None)
def processAlgorithm(self, parameters, context, feedback): inputFile = self.parameterAsRasterLayer(parameters, self.INPUT, context).source() zFactor = self.parameterAsDouble(parameters, self.Z_FACTOR, context) azimuth = self.parameterAsDouble(parameters, self.AZIMUTH, context) vAngle = self.parameterAsDouble(parameters, self.V_ANGLE, context) outputFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context) outputFormat = QgsRasterFileWriter.driverForExtension(os.path.splitext(outputFile)[1]) hillshade = QgsHillshadeFilter(inputFile, outputFile, outputFormat, azimuth, vAngle) hillshade.setZFactor(zFactor) hillshade.processRaster(feedback) return {self.OUTPUT: outputFile}
def processAlgorithm(self, parameters, context, feedback): inputFile = exportRasterLayer(self.parameterAsRasterLayer(parameters, self.INPUT, context)) zFactor = self.parameterAsDouble(parameters, self.Z_FACTOR, context) azimuth = self.parameterAsDouble(parameters, self.AZIMUTH, context) vAngle = self.parameterAsDouble(parameters, self.V_ANGLE, context) outputFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context) outputFormat = raster.formatShortNameFromFileName(outputFile) hillshade = QgsHillshadeFilter(inputFile, outputFile, outputFormat, azimuth, vAngle) hillshade.setZFactor(zFactor) hillshade.processRaster(feedback) return {self.OUTPUT: outputFile}