Skip to content

Commit 1053823

Browse files
authoredAug 11, 2017
[processing] improve rasterize dialog UI, add help (#5008)
1 parent 5336a0d commit 1053823

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed
 

‎python/plugins/processing/algs/help/qgis.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,17 @@ qgis:rasterlayerhistogram: >
473473
qgis:rasterlayerstatistics: >
474474
This algorithm computes basic statistics from the values in a given band of the raster layer.
475475

476+
qgis:rasterize: >
477+
This algorithm rasterizes map canvas content.
478+
479+
A map theme can be selected to render a predetermined set of layers with a defined style for each layer.
480+
481+
Alternatively, a single layer can be selected if not map theme is set.
Code has comments. Press enter to view.
482+
483+
If neither map theme nor the layer is set, the current map content will be rendered.
484+
485+
The minimum extent entered will internally be extended to be a multiple of the tile size.
486+
476487
qgis:refactorfields: >
477488
This algorithm allows editing the structure of the attributes table of a vector layer. Fields can be modified in their type and name, using a fields mapping.
478489

‎python/plugins/processing/algs/qgis/Rasterize.py

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -84,31 +84,10 @@ def initAlgorithm(self, config=None):
8484
with some other properties.
8585
"""
8686
# The parameters
87-
map_theme_param = QgsProcessingParameterString(
88-
self.MAP_THEME,
89-
description=self.tr(
90-
'Map theme to render.'),
91-
defaultValue=None, optional=True)
92-
93-
map_theme_param.setMetadata(
94-
{'widget_wrapper': {
95-
'class':
96-
'processing.gui.wrappers_map_theme.MapThemeWrapper'}})
97-
self.addParameter(map_theme_param)
98-
99-
self.addParameter(
100-
QgsProcessingParameterMapLayer(
101-
self.LAYER,
102-
description=self.tr(
103-
'Layer to render. Will only be used if the map theme '
104-
'is not set. '
105-
'If both, map theme and layer are not '
106-
'set, the current map content will be rendered.'),
107-
optional=True))
10887
self.addParameter(
10988
QgsProcessingParameterExtent(self.EXTENT, description=self.tr(
110-
'The minimum extent to render. Will internally be extended to '
111-
'be a multiple of the tile sizes.')))
89+
'Minimum extent to render')))
90+
11291
self.addParameter(
11392
QgsProcessingParameterNumber(
11493
self.TILE_SIZE,
@@ -125,6 +104,25 @@ def initAlgorithm(self, config=None):
125104
type=QgsProcessingParameterNumber.Double
126105
))
127106

107+
map_theme_param = QgsProcessingParameterString(
108+
self.MAP_THEME,
109+
description=self.tr(
110+
'Map theme to render'),
111+
defaultValue=None, optional=True)
112+
113+
map_theme_param.setMetadata(
114+
{'widget_wrapper': {
115+
'class':
116+
'processing.gui.wrappers_map_theme.MapThemeWrapper'}})
117+
self.addParameter(map_theme_param)
118+
119+
self.addParameter(
120+
QgsProcessingParameterMapLayer(
121+
self.LAYER,
122+
description=self.tr(
123+
'Single layer to render'),
124+
optional=True))
125+
128126
# We add a raster layer as output
129127
self.addParameter(QgsProcessingParameterRasterDestination(
130128
self.OUTPUT,
@@ -133,7 +131,7 @@ def initAlgorithm(self, config=None):
133131

134132
def name(self):
135133
# Unique (non-user visible) name of algorithm
136-
return 'Rasterize'
134+
return 'rasterize'
137135

138136
def displayName(self):
139137
# The name that the user will see in the toolbox

3 commit comments

Comments
 (3)

nyalldawson commented on Aug 11, 2017

@nyalldawson
Collaborator

@nirvn @m-kuhn do you mind if we rename this alg from "rasterize" to "render"? To me "Rasterize" is a specific operation which takes a vector layer and converts to raster (i.e. taking the raster values directly from an attribute in the vector layer). It'd be nice to keep the "rasterize" name free for a future algorithm which does this operation.

m-kuhn commented on Aug 11, 2017

@m-kuhn
Member

No objections, CC @marioba

nirvn commented on Aug 11, 2017

@nirvn
ContributorAuthor

No objections.

Please sign in to comment.