Bug report #21656

How to insert result fonction in raster created

Added by Babacar FASSA about 5 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Rasters
Affected QGIS version:3.4.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:29472

Description

Hello,

I am doing a script, but I have a problem with the insertion of the result that my calculation function provided in my raster output that I created. Does anyone know how to insert the output result into a raster output that has been declared.

That's what I started to do:

class ExampleProcessingAlgorithm(QgsProcessingAlgorithm):

#Declaration de nos shapes comme des variables text
Vector_layer_of_communes = 'Vector_layer_of_communes'
OUTPUT_raster = 'OUTPUT_raster'
Commune_name='Commune_name'
INSEE_code='INSEE_code'
EPSG_code='EPSG_code'
def processAlgorithm(self, parameters, context, feedback):
#Parametrage des shapes dentree
shape_commune = self.parameterAsSource(parameters, self.Vector_layer_of_communes, context)
#Parametrage du resultat en fichier de sorti
output_path_raster = self.parameterAsOutputLayer(parameters, self.OUTPUT_raster, context)
attribut_INSEE_code = self.parameterAsString(parameters, self.INSEE_code, context)
attribut_Commune_name = self.parameterAsString(parameters, self.Commune_name, context)
attribut_EPSG_code = self.parameterAsString(parameters, self.EPSG_code, context)
def recuperation_cadastre_commune(layer,INSEE_code,Commune_name,EPSG_code):
rlayer = QgsRasterLayer(urlWithParams, 'Cadastre_'+n_couche+'_'+c_insee, 'wms')
output_path_raster=rlayer
#My problem is here, how to insert this raster in my OUTPUT_raster created
#Fonction de calcul du besoin
recuperation_cadastre_commune(shape_commune,attribut_INSEE_code,attribut_Commune_name,attribut_EPSG_code)
results = {}
results[self.OUTPUT_raster] = output_path_raster
return results#{}

script_create_cadastre.py Magnifier (6.6 KB) Babacar FASSA, 2019-03-22 06:03 PM

History

#1 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

for questions use the users/developers mailing lists, the qgis irc channel or gis.stackexchange. Thanks!

Also available in: Atom PDF