From e9d341fccec56eb7d5b5bc68b2ed18c9fb5ec250 Mon Sep 17 00:00:00 2001 From: lehtonenp <115632450+lehtonenp@users.noreply.github.com> Date: Thu, 14 Mar 2024 09:31:34 +0200 Subject: [PATCH 1/5] Modify Create constant raster to be compatible with the toolkit --- .../create_constant_raster.py | 143 ++++++++++++++---- 1 file changed, 111 insertions(+), 32 deletions(-) diff --git a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py index bf5b64f2..5b330c58 100644 --- a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py +++ b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py @@ -1,8 +1,8 @@ from qgis.core import ( QgsProcessingParameterCrs, - QgsProcessingParameterExtent, QgsProcessingParameterNumber, QgsProcessingParameterRasterDestination, + QgsProcessingParameterRasterLayer, ) from eis_qgis_plugin.processing.eis_processing_algorithm import EISProcessingAlgorithm @@ -16,47 +16,126 @@ def __init__(self) -> None: self._display_name = "Create constant raster" self._group = "Raster Processing" self._group_id = "raster_processing" - self._short_help_string = "Create a constant raster based on a user-defined value." + self._short_help_string = '''Create a constant raster based on a user-defined value. + Provide 3 methods for raster creation: + 1. Set extent and coordinate system based on a template raster. + 2. Set extent from origin, based on the western and northern coordinates and the pixel size. + 3. Set extent from bounds, based on western, northern, eastern and southern points. + + Always provide values for height and width for the last two options, which correspond to + the desired number of pixels for rows and columns. + ''' def initAlgorithm(self, config=None): self.alg_parameters = [ - "extent", "target_crs", "pixel_size", "constant_value", "out_raster" - ] + "constant_value", + "template_raster", + "coord_west", + "coord_north", + "coord_east", + "coord_south", + "target_epsg", + "target_pixel_size", + "raster_width", + "raster_height", + "nodata_value", + "output_raster", + ] + + constant_value_param = QgsProcessingParameterNumber( + name=self.alg_parameters[0], + description="Constant value", + type=QgsProcessingParameterNumber.Double, + ) + constant_value_param.setHelp("The constant value to use in the raster.") + self.addParameter(constant_value_param) + + template_raster_param = QgsProcessingParameterRasterLayer( + name=self.alg_parameters[1], + description="Template raster", + optional=True, + ) + template_raster_param.setHelp("An optional raster to use as a template for the output.") + self.addParameter(template_raster_param) + + coord_west_param = QgsProcessingParameterNumber( + name=self.alg_parameters[2], + description="Western coordinate", + optional=True, + type=QgsProcessingParameterNumber.Double, + ) + coord_west_param.setHelp("The western coordinate of the output raster in [m].") + self.addParameter(coord_west_param) + + coord_north_param = QgsProcessingParameterNumber( + name=self.alg_parameters[3], + description="Northern coordinate", + optional=True, + type=QgsProcessingParameterNumber.Double, + ) + coord_north_param.setHelp("The northern coordinate of the output raster in [m].") + self.addParameter(coord_north_param) + + coord_east_param = QgsProcessingParameterNumber( + name=self.alg_parameters[4], + description="Eastern coordinate", + optional=True, + type=QgsProcessingParameterNumber.Double, + ) + coord_east_param.setHelp("The eastern coordinate of the output raster in [m].") + self.addParameter(coord_east_param) + + coord_south_param = QgsProcessingParameterNumber( + name=self.alg_parameters[5], + description="Southern coordinate", + optional=True, + type=QgsProcessingParameterNumber.Double, + ) + coord_south_param.setHelp("The southern coordinate of the output raster in [m].") + self.addParameter(coord_south_param) + + target_epsg_param = QgsProcessingParameterCrs( + name=self.alg_parameters[6], + description="Coordinate system", + ) + target_epsg_param.setHelp("The EPSG code for the output raster.") + self.addParameter(target_epsg_param) - self.addParameter( - QgsProcessingParameterExtent( - name=self.alg_parameters[0], - description="Extent", - optional=True, - ) + target_pixel_size_param = QgsProcessingParameterNumber( + name=self.alg_parameters[7], + description="Target pixel size", + optional=True, ) + target_pixel_size_param.setHelp("The pixel size of the output raster.") + self.addParameter(target_pixel_size_param) - self.addParameter( - QgsProcessingParameterCrs( - name=self.alg_parameters[1], - description="Target CRS", - optional=True, - ) + raster_width_param = QgsProcessingParameterNumber( + name=self.alg_parameters[8], + description="Raster width", + optional=True, ) + raster_width_param.setHelp("The width of the output raster.") + self.addParameter(raster_width_param) - self.addParameter( - QgsProcessingParameterNumber( - name=self.alg_parameters[2], - description="Target pixel size", - # optional=True, - defaultValue=0.01 - ) + raster_height_param = QgsProcessingParameterNumber( + name=self.alg_parameters[9], + description="Raster height", + optional=True, ) + raster_height_param.setHelp("The height of the output raster.") + self.addParameter(raster_height_param) - self.addParameter( - QgsProcessingParameterNumber( - name=self.alg_parameters[3], - description="Constant value to use.", - ) + nodata_value_param = QgsProcessingParameterNumber( + name=self.alg_parameters[10], + description="Nodata value", + optional=True, + type=QgsProcessingParameterNumber.Double, ) + nodata_value_param.setHelp("The nodata value of the output raster.") + self.addParameter(nodata_value_param) - self.addParameter( - QgsProcessingParameterRasterDestination( - name=self.alg_parameters[4], description="out_raster", - ) + output_raster_param = QgsProcessingParameterRasterDestination( + name=self.alg_parameters[11], description="Output raster" ) + output_raster_param.setHelp("The Output raster.") + self.addParameter(output_raster_param) From 04222fe7b2a9497f895e085905ac31b541947501 Mon Sep 17 00:00:00 2001 From: lehtonenp <115632450+lehtonenp@users.noreply.github.com> Date: Tue, 19 Mar 2024 14:23:26 +0200 Subject: [PATCH 2/5] Change extent parameter to be QgsProcessingParameterExtent, change numbering of parameters --- .../create_constant_raster.py | 56 ++++--------------- 1 file changed, 12 insertions(+), 44 deletions(-) diff --git a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py index 5b330c58..cebc22b8 100644 --- a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py +++ b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py @@ -1,5 +1,6 @@ from qgis.core import ( QgsProcessingParameterCrs, + QgsProcessingParameterExtent, QgsProcessingParameterNumber, QgsProcessingParameterRasterDestination, QgsProcessingParameterRasterLayer, @@ -30,10 +31,7 @@ def initAlgorithm(self, config=None): self.alg_parameters = [ "constant_value", "template_raster", - "coord_west", - "coord_north", - "coord_east", - "coord_south", + "extent", "target_epsg", "target_pixel_size", "raster_width", @@ -58,51 +56,21 @@ def initAlgorithm(self, config=None): template_raster_param.setHelp("An optional raster to use as a template for the output.") self.addParameter(template_raster_param) - coord_west_param = QgsProcessingParameterNumber( - name=self.alg_parameters[2], - description="Western coordinate", - optional=True, - type=QgsProcessingParameterNumber.Double, - ) - coord_west_param.setHelp("The western coordinate of the output raster in [m].") - self.addParameter(coord_west_param) - - coord_north_param = QgsProcessingParameterNumber( - name=self.alg_parameters[3], - description="Northern coordinate", - optional=True, - type=QgsProcessingParameterNumber.Double, - ) - coord_north_param.setHelp("The northern coordinate of the output raster in [m].") - self.addParameter(coord_north_param) - - coord_east_param = QgsProcessingParameterNumber( - name=self.alg_parameters[4], - description="Eastern coordinate", - optional=True, - type=QgsProcessingParameterNumber.Double, + extent_param = QgsProcessingParameterExtent( + name=self.alg_parameters[2], description="Raster extent", optional=True ) - coord_east_param.setHelp("The eastern coordinate of the output raster in [m].") - self.addParameter(coord_east_param) - - coord_south_param = QgsProcessingParameterNumber( - name=self.alg_parameters[5], - description="Southern coordinate", - optional=True, - type=QgsProcessingParameterNumber.Double, - ) - coord_south_param.setHelp("The southern coordinate of the output raster in [m].") - self.addParameter(coord_south_param) + extent_param.setHelp("The extent of the output raster.") + self.addParameter(extent_param) target_epsg_param = QgsProcessingParameterCrs( - name=self.alg_parameters[6], + name=self.alg_parameters[3], description="Coordinate system", ) target_epsg_param.setHelp("The EPSG code for the output raster.") self.addParameter(target_epsg_param) target_pixel_size_param = QgsProcessingParameterNumber( - name=self.alg_parameters[7], + name=self.alg_parameters[4], description="Target pixel size", optional=True, ) @@ -110,7 +78,7 @@ def initAlgorithm(self, config=None): self.addParameter(target_pixel_size_param) raster_width_param = QgsProcessingParameterNumber( - name=self.alg_parameters[8], + name=self.alg_parameters[5], description="Raster width", optional=True, ) @@ -118,7 +86,7 @@ def initAlgorithm(self, config=None): self.addParameter(raster_width_param) raster_height_param = QgsProcessingParameterNumber( - name=self.alg_parameters[9], + name=self.alg_parameters[6], description="Raster height", optional=True, ) @@ -126,7 +94,7 @@ def initAlgorithm(self, config=None): self.addParameter(raster_height_param) nodata_value_param = QgsProcessingParameterNumber( - name=self.alg_parameters[10], + name=self.alg_parameters[7], description="Nodata value", optional=True, type=QgsProcessingParameterNumber.Double, @@ -135,7 +103,7 @@ def initAlgorithm(self, config=None): self.addParameter(nodata_value_param) output_raster_param = QgsProcessingParameterRasterDestination( - name=self.alg_parameters[11], description="Output raster" + name=self.alg_parameters[8], description="Output raster" ) output_raster_param.setHelp("The Output raster.") self.addParameter(output_raster_param) From 0bb04546cea854c5d8bc26f4c5c277a67ff13e36 Mon Sep 17 00:00:00 2001 From: lehtonenp <115632450+lehtonenp@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:21:35 +0200 Subject: [PATCH 3/5] Separate template and manual raster creation functions --- ...> create_constant_raster_from_template.py} | 38 ++------- .../create_constant_raster_manually.py | 82 +++++++++++++++++++ 2 files changed, 88 insertions(+), 32 deletions(-) rename eis_qgis_plugin/processing/algorithms/raster_processing/{create_constant_raster.py => create_constant_raster_from_template.py} (65%) create mode 100644 eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py diff --git a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_from_template.py similarity index 65% rename from eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py rename to eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_from_template.py index cebc22b8..2b31457f 100644 --- a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster.py +++ b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_from_template.py @@ -9,23 +9,15 @@ from eis_qgis_plugin.processing.eis_processing_algorithm import EISProcessingAlgorithm -class EISCreateConstantRaster(EISProcessingAlgorithm): +class EISCreateConstantRasterFromTemplate(EISProcessingAlgorithm): def __init__(self) -> None: super().__init__() - self._name = "create_constant_raster" - self._display_name = "Create constant raster" + self._name = "create_constant_raster_from_template" + self._display_name = "Create constant raster from template" self._group = "Raster Processing" self._group_id = "raster_processing" - self._short_help_string = '''Create a constant raster based on a user-defined value. - Provide 3 methods for raster creation: - 1. Set extent and coordinate system based on a template raster. - 2. Set extent from origin, based on the western and northern coordinates and the pixel size. - 3. Set extent from bounds, based on western, northern, eastern and southern points. - - Always provide values for height and width for the last two options, which correspond to - the desired number of pixels for rows and columns. - ''' + self._short_help_string = "Create a constant raster based on a template raster." def initAlgorithm(self, config=None): self.alg_parameters = [ @@ -34,8 +26,6 @@ def initAlgorithm(self, config=None): "extent", "target_epsg", "target_pixel_size", - "raster_width", - "raster_height", "nodata_value", "output_raster", ] @@ -77,24 +67,8 @@ def initAlgorithm(self, config=None): target_pixel_size_param.setHelp("The pixel size of the output raster.") self.addParameter(target_pixel_size_param) - raster_width_param = QgsProcessingParameterNumber( - name=self.alg_parameters[5], - description="Raster width", - optional=True, - ) - raster_width_param.setHelp("The width of the output raster.") - self.addParameter(raster_width_param) - - raster_height_param = QgsProcessingParameterNumber( - name=self.alg_parameters[6], - description="Raster height", - optional=True, - ) - raster_height_param.setHelp("The height of the output raster.") - self.addParameter(raster_height_param) - nodata_value_param = QgsProcessingParameterNumber( - name=self.alg_parameters[7], + name=self.alg_parameters[5], description="Nodata value", optional=True, type=QgsProcessingParameterNumber.Double, @@ -103,7 +77,7 @@ def initAlgorithm(self, config=None): self.addParameter(nodata_value_param) output_raster_param = QgsProcessingParameterRasterDestination( - name=self.alg_parameters[8], description="Output raster" + name=self.alg_parameters[6], description="Output raster" ) output_raster_param.setHelp("The Output raster.") self.addParameter(output_raster_param) diff --git a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py new file mode 100644 index 00000000..e68ce309 --- /dev/null +++ b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py @@ -0,0 +1,82 @@ +from qgis.core import ( + QgsProcessingParameterCrs, + QgsProcessingParameterExtent, + QgsProcessingParameterNumber, + QgsProcessingParameterRasterDestination, + QgsProcessingParameterRasterLayer, +) + +from eis_qgis_plugin.processing.eis_processing_algorithm import EISProcessingAlgorithm + + +class EISCreateConstantRasterManually(EISProcessingAlgorithm): + def __init__(self) -> None: + super().__init__() + + self._name = "create_constant_raster_manually" + self._display_name = "Create constant raster manually" + self._group = "Raster Processing" + self._group_id = "raster_processing" + self._short_help_string = "Create a constant raster manually." + + def initAlgorithm(self, config=None): + self.alg_parameters = [ + "constant_value", + "target_epsg", + "target_pixel_size", + "raster_width", + "raster_height", + "nodata_value", + "output_raster", + ] + + constant_value_param = QgsProcessingParameterNumber( + name=self.alg_parameters[0], + description="Constant value", + type=QgsProcessingParameterNumber.Double, + ) + constant_value_param.setHelp("The constant value to use in the raster.") + self.addParameter(constant_value_param) + + target_epsg_param = QgsProcessingParameterCrs( + name=self.alg_parameters[1], + description="Coordinate system", + ) + target_epsg_param.setHelp("The EPSG code for the output raster.") + self.addParameter(target_epsg_param) + + target_pixel_size_param = QgsProcessingParameterNumber( + name=self.alg_parameters[2], + description="Target pixel size", + ) + target_pixel_size_param.setHelp("The pixel size of the output raster.") + self.addParameter(target_pixel_size_param) + + raster_width_param = QgsProcessingParameterNumber( + name=self.alg_parameters[3], + description="Raster width", + ) + raster_width_param.setHelp("The width of the output raster.") + self.addParameter(raster_width_param) + + raster_height_param = QgsProcessingParameterNumber( + name=self.alg_parameters[4], + description="Raster height", + ) + raster_height_param.setHelp("The height of the output raster.") + self.addParameter(raster_height_param) + + nodata_value_param = QgsProcessingParameterNumber( + name=self.alg_parameters[5], + description="Nodata value", + optional=True, + type=QgsProcessingParameterNumber.Double, + ) + nodata_value_param.setHelp("The nodata value of the output raster.") + self.addParameter(nodata_value_param) + + output_raster_param = QgsProcessingParameterRasterDestination( + name=self.alg_parameters[6], description="Output raster" + ) + output_raster_param.setHelp("The Output raster.") + self.addParameter(output_raster_param) From 436a0c559a1025c72abcad9631deb159444994e1 Mon Sep 17 00:00:00 2001 From: lehtonenp <115632450+lehtonenp@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:45:59 +0200 Subject: [PATCH 4/5] Remove unused imports --- .../raster_processing/create_constant_raster_manually.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py index e68ce309..c82778ad 100644 --- a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py +++ b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py @@ -1,9 +1,7 @@ from qgis.core import ( QgsProcessingParameterCrs, - QgsProcessingParameterExtent, QgsProcessingParameterNumber, QgsProcessingParameterRasterDestination, - QgsProcessingParameterRasterLayer, ) from eis_qgis_plugin.processing.eis_processing_algorithm import EISProcessingAlgorithm From 59dd39ae2b06aec4d74332a77e0b8f0a751782f9 Mon Sep 17 00:00:00 2001 From: Niko Aarnio Date: Tue, 16 Apr 2024 11:05:51 +0300 Subject: [PATCH 5/5] Modify create constant raster to reflect CLI --- .../create_constant_raster_from_template.py | 43 ++++------------- .../create_constant_raster_manually.py | 48 +++++++++---------- 2 files changed, 31 insertions(+), 60 deletions(-) diff --git a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_from_template.py b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_from_template.py index 2b31457f..1891abf2 100644 --- a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_from_template.py +++ b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_from_template.py @@ -1,6 +1,4 @@ from qgis.core import ( - QgsProcessingParameterCrs, - QgsProcessingParameterExtent, QgsProcessingParameterNumber, QgsProcessingParameterRasterDestination, QgsProcessingParameterRasterLayer, @@ -17,15 +15,12 @@ def __init__(self) -> None: self._display_name = "Create constant raster from template" self._group = "Raster Processing" self._group_id = "raster_processing" - self._short_help_string = "Create a constant raster based on a template raster." + self._short_help_string = "Create a constant raster from a template raster." def initAlgorithm(self, config=None): self.alg_parameters = [ "constant_value", "template_raster", - "extent", - "target_epsg", - "target_pixel_size", "nodata_value", "output_raster", ] @@ -35,49 +30,27 @@ def initAlgorithm(self, config=None): description="Constant value", type=QgsProcessingParameterNumber.Double, ) - constant_value_param.setHelp("The constant value to use in the raster.") + constant_value_param.setHelp("The constant value of the output raster.") self.addParameter(constant_value_param) template_raster_param = QgsProcessingParameterRasterLayer( name=self.alg_parameters[1], - description="Template raster", - optional=True, + description="Template/base raster", ) - template_raster_param.setHelp("An optional raster to use as a template for the output.") + template_raster_param.setHelp("The raster to use as the template for the output raster grid properties.") self.addParameter(template_raster_param) - extent_param = QgsProcessingParameterExtent( - name=self.alg_parameters[2], description="Raster extent", optional=True - ) - extent_param.setHelp("The extent of the output raster.") - self.addParameter(extent_param) - - target_epsg_param = QgsProcessingParameterCrs( - name=self.alg_parameters[3], - description="Coordinate system", - ) - target_epsg_param.setHelp("The EPSG code for the output raster.") - self.addParameter(target_epsg_param) - - target_pixel_size_param = QgsProcessingParameterNumber( - name=self.alg_parameters[4], - description="Target pixel size", - optional=True, - ) - target_pixel_size_param.setHelp("The pixel size of the output raster.") - self.addParameter(target_pixel_size_param) - nodata_value_param = QgsProcessingParameterNumber( - name=self.alg_parameters[5], + name=self.alg_parameters[2], description="Nodata value", - optional=True, type=QgsProcessingParameterNumber.Double, + defaultValue=-9999 ) nodata_value_param.setHelp("The nodata value of the output raster.") self.addParameter(nodata_value_param) output_raster_param = QgsProcessingParameterRasterDestination( - name=self.alg_parameters[6], description="Output raster" + name=self.alg_parameters[3], description="Output raster" ) - output_raster_param.setHelp("The Output raster.") + output_raster_param.setHelp("The output constant raster.") self.addParameter(output_raster_param) diff --git a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py index c82778ad..aecf3a62 100644 --- a/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py +++ b/eis_qgis_plugin/processing/algorithms/raster_processing/create_constant_raster_manually.py @@ -1,5 +1,6 @@ from qgis.core import ( QgsProcessingParameterCrs, + QgsProcessingParameterExtent, QgsProcessingParameterNumber, QgsProcessingParameterRasterDestination, ) @@ -15,15 +16,19 @@ def __init__(self) -> None: self._display_name = "Create constant raster manually" self._group = "Raster Processing" self._group_id = "raster_processing" - self._short_help_string = "Create a constant raster manually." + self._short_help_string = """ + Create a constant raster manually by defining CRS, extent and pixel size. + + If the resulting raster height and width are not exact multiples of the pixel size, the \ + output raster extent will differ slightly from the defined extent. + """ def initAlgorithm(self, config=None): self.alg_parameters = [ "constant_value", "target_epsg", + "extent", "target_pixel_size", - "raster_width", - "raster_height", "nodata_value", "output_raster", ] @@ -33,48 +38,41 @@ def initAlgorithm(self, config=None): description="Constant value", type=QgsProcessingParameterNumber.Double, ) - constant_value_param.setHelp("The constant value to use in the raster.") + constant_value_param.setHelp("The constant value of the output raster.") self.addParameter(constant_value_param) target_epsg_param = QgsProcessingParameterCrs( name=self.alg_parameters[1], - description="Coordinate system", + description="Target CRS", ) - target_epsg_param.setHelp("The EPSG code for the output raster.") + target_epsg_param.setHelp("The CRS of the output raster.") self.addParameter(target_epsg_param) - target_pixel_size_param = QgsProcessingParameterNumber( + extent_param = QgsProcessingParameterExtent( name=self.alg_parameters[2], - description="Target pixel size", + description="Extent", ) - target_pixel_size_param.setHelp("The pixel size of the output raster.") - self.addParameter(target_pixel_size_param) + extent_param.setHelp("The extent of the output raster.") + self.addParameter(extent_param) - raster_width_param = QgsProcessingParameterNumber( + target_pixel_size_param = QgsProcessingParameterNumber( name=self.alg_parameters[3], - description="Raster width", - ) - raster_width_param.setHelp("The width of the output raster.") - self.addParameter(raster_width_param) - - raster_height_param = QgsProcessingParameterNumber( - name=self.alg_parameters[4], - description="Raster height", + description="Target pixel size", ) - raster_height_param.setHelp("The height of the output raster.") - self.addParameter(raster_height_param) + target_pixel_size_param.setHelp("The pixel size of the output raster.") + self.addParameter(target_pixel_size_param) nodata_value_param = QgsProcessingParameterNumber( - name=self.alg_parameters[5], + name=self.alg_parameters[4], description="Nodata value", - optional=True, type=QgsProcessingParameterNumber.Double, + defaultValue=-9999 ) nodata_value_param.setHelp("The nodata value of the output raster.") self.addParameter(nodata_value_param) output_raster_param = QgsProcessingParameterRasterDestination( - name=self.alg_parameters[6], description="Output raster" + name=self.alg_parameters[5], description="Output raster" ) - output_raster_param.setHelp("The Output raster.") + output_raster_param.setHelp("The output constant raster.") self.addParameter(output_raster_param)