2026-02-28 11:50:34

24.1.18.栅格工具

24.1.18.3. 将地图转换为栅格

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.

参数

标注

名称

类型

描述

Minimum extent to render (xmin, xmax, ymin, ymax)

EXTENT

[范围]

Specify the extent of the output raster layer.

It will internally be extended to a multiple of the tile size.

Available methods are:

Calculate from layer…: uses extent of a layer loaded in the current project

Calculate from layout map…: uses extent of a layout map item

in the active project

Calculate from bookmark…: uses extent of a saved bookmark

Use map canvas extent

Draw on canvas: click and drag a rectangle delimiting the area to take into account

Enter the coordinates as xmin, xmax, ymin, ymax

瓦片尺寸

TILE_SIZE

[numeric: integer]

默认值: 1024

Size of the tile of the output raster layer. Minimum value: 64.

Map units per pixel

MAP_UNITS_PER_PIXEL

[numeric: double]

Default: 100.0

Pixel size (in map units). Minimum value: 0.0

Make background transparent

MAKE_BACKGROUND_TRANSPARENT

[boolean]

Default: False

Allows exporting the map with a transparent background.

Outputs an RGBA (instead of RGB) image if set to True.

Map theme to render

可选

MAP_THEME

[enumeration]

Use an existing map theme for the

rendering.

Single layer to render

可选

LAYER

[enumeration]

Choose a single layer for the rendering

Output layer

OUTPUT

[栅格]

默认: [保存到临时文件]

Specification of the output raster. One of:

保存到临时文件

保存到文件…

输出

标注

名称

类型

描述

Output layer

OUTPUT

[栅格]

Output raster layer

Python代码

Algorithm ID: native:rasterize

import processing

processing.run("algorithm_id", {parameter_dictionary})

当你在数据处理工具箱某个算法前悬停时,算法 id 将会展现。*参数字*将会提供参数的名称与数值。参考详见`数据处理_控制台`以获取如何从Python控制台中运行数据处理算法。