23.1.11. Raster tools¶
23.1.11.1. Convert map to raster¶
Creates a raster image of map canvas content.
A map theme can be selected to render a predetermined set of layers with a defined style for each layer.
Alternatively, a single layer can be selected if no map theme is set.
If neither map theme nor layer is set, the current map content will be rendered. The minimum extent entered will internally be extended to be a multiple of the tile size.
23.1.11.1.1. Parâmetros¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Minimum extent to render (xmin, xmax, ymin, ymax) |
|
[extent] |
Specify the extent of the output raster layer. One of:
It will internally be extended to a multiple of the tile size. |
Tile size |
|
[number] Default: 1024 |
Size of the tile of the output raster layer. Minimum value: 64. |
Map units per pixel |
|
[number] Default: 100.0 |
Pixel size (in map units). Minimum value: 0.0 |
Make background transparent |
|
[boolean] Default: False |
Allows exporting the map with a transparent background.
Outputs an RGBA (instead of RGB) image if set to |
Map theme to render Opcional |
|
[enumeration] |
Use an existing map theme for the rendering. |
Single layer to render Opcional |
|
[enumeration] |
Choose a single layer for the rendering |
Output layer |
|
[raster] Default: Save to temporary file |
Specification of the output raster. One of:
The file encoding can also be changed here. |
23.1.11.1.2. Resultados¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Output layer |
|
[raster] |
Output raster layer |
23.1.11.1.3. Python code¶
Algorithm ID: qgis:rasterize
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usando os algoritmos do processamento a partir da consola for details on how to run processing algorithms from the Python console.
23.1.11.2. Create constant raster layer¶
Generates a raster layer where all pixels have the same value.
23.1.11.2.1. Parâmetros¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Desired extent (xmin, xmax, ymin, ymax) |
|
[extent] |
Specify the extent of the output raster layer. One of:
It will internally be extended to a multiple of the tile size. |
Target CRS |
|
[crs] Default: Project CRS |
CRS for the output raster layer |
Pixel size |
|
[number] Default: 0.1 |
Pixel size (X=Y) in map units. Minimum value: 0.01 |
Constant value |
|
[number] Default: 1 |
Constant pixel value for the output raster layer. |
Constant |
|
[raster] |
Specification of the output raster. One of:
The file encoding can also be changed here. |
23.1.11.2.2. Resultados¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Constant |
|
[raster] |
Raster covering the desired extent with the specified pixel size and value. |
23.1.11.2.3. Python code¶
Algorithm ID: qgis:createconstantrasterlayer
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usando os algoritmos do processamento a partir da consola for details on how to run processing algorithms from the Python console.
23.1.11.3. Generate XYZ tiles (Directory)¶
Generates raster “XYZ” tiles using the current QGIS project as individual images to a directory structure.
23.1.11.3.1. Parâmetros¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Extent (xmin, xmax, ymin, ymax) |
|
[extent] |
Specify the extent of the tiles. One of:
It will internally be extended to a multiple of the tile size. |
Minimum zoom |
|
[number] Default: 12 |
Minimum 0, maximum 25. |
Maximum zoom |
|
[number] Default: 12 |
Minimum 0, maximum 25. |
DPI |
|
[number] Default: 96 |
Minimum 48, maximum 600. |
Background color Opcional |
|
[color] Default: QColor(0, 0, 0, 0) |
Choose the background color for the tiles |
Tile format |
|
[enumeration] Default: 0 |
One of:
|
Quality (JPG only) Opcional |
|
[number] Default: 75 |
Minimum 1, maximum 100. |
Metatile size Opcional |
|
[number] Default: 4 |
Specify a custom metatile size when generating XYZ tiles. Larger values may speed up the rendering of tiles and provide better labelling (fewer gaps without labels) at the expense of using more memory. Minimum 1, maximum 20. |
Tile width Opcional |
|
[number] Default: 256 |
Minimum 1, maximum 4096. |
Tile height Opcional |
|
[number] Default: 256 |
Minimum 1, maximum 4096. |
Use inverted tile Y axis (TMS conventions) Opcional |
|
[boolean] Default: False |
|
Output directory |
|
[folder] Default: |
Specification of the output raster. One of:
The file encoding can also be changed here. |
Output html (Leaflet) |
|
[html] Default: |
Specification of the output HTML file. One of:
|
23.1.11.3.2. Resultados¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Output directory |
|
[folder] |
Output directory (for the tiles) |
Output html (Leaflet) |
|
[html] |
The output HTML (Leaflet) file |
23.1.11.3.3. Python code¶
Algorithm ID: qgis:tilesxyzdirectory
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usando os algoritmos do processamento a partir da consola for details on how to run processing algorithms from the Python console.
23.1.11.4. Generate XYZ tiles (MBTiles)¶
Generates raster “XYZ” tiles using the current QGIS project as a single file in the “MBTiles” format.
23.1.11.4.1. Parâmetros¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Extent (xmin, xmax, ymin, ymax) |
|
[extent] |
Specify the extent of the tiles. One of:
It will internally be extended to a multiple of the tile size. |
Minimum zoom |
|
[number] Default: 12 |
Minimum 0, maximum 25. |
Maximum zoom |
|
[number] Default: 12 |
Minimum 0, maximum 25. |
DPI |
|
[number] Default: 96 |
Minimum 48, maximum 600. |
Background color Opcional |
|
[color] Default: QColor(0, 0, 0, 0) |
Choose the background color for the tiles |
Tile format |
|
[enumeration] Default: 0 |
One of:
|
Quality (JPG only) Opcional |
|
[number] Default: 75 |
Minimum 1, maximum 100. |
Metatile size Opcional |
|
[number] Default: 4 |
Specify a custom metatile size when generating XYZ tiles. Larger values may speed up the rendering of tiles and provide better labelling (fewer gaps without labels) at the expense of using more memory. Minimum 1, maximum 20. |
Output file (for MBTiles) |
|
[file] Default: |
Specification of the output file. One of:
The file encoding can also be changed here. |
23.1.11.4.2. Resultados¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Output file (for MBTiles) |
|
[file] |
The output file. |
23.1.11.4.3. Python code¶
Algorithm ID: qgis:tilesxyzmbtiles
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usando os algoritmos do processamento a partir da consola for details on how to run processing algorithms from the Python console.
23.1.11.5. Set style for raster layer¶
Sets the style of a raster layer. The style must be defined as a
QML
file.
No new output are created: the QML
style is assigned to the raster
layer chosen.
Veja também
23.1.11.5.1. Parâmetros¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Raster layer |
|
[raster] |
The raster layer |
Style file |
|
[file] |
Path to the |
23.1.11.5.2. Resultados¶
Label |
Nome |
Type |
Descrição |
---|---|---|---|
Raster layer |
|
[raster] |
The raster layer with the chosen style |
23.1.11.5.3. Python code¶
Algorithm ID: qgis:setstyleforrasterlayer
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See Usando os algoritmos do processamento a partir da consola for details on how to run processing algorithms from the Python console.