27.1.22. Vector Tiles

27.1.22.1. Write vector tiles (MBTiles)

Exports one or more vector layers to vector tiles, a data format optimized for fast map rendering and small data size.

MBTiles is a specification for storing tiled map data in SQLite databases for immediate usage and for transfer. MBTiles files are known as tilesets.

Parâmetros

Label

Nome

Type

Descrição

Input layers

INPUT

[vector: any] [list]

A list of layers to combine to generate the vector tiles

Minimum zoom level

MIN_ZOOM

[number]

Default: 0

The lowest zoom level for which the tileset provides data. Set between 0 and 24.

Maximum zoom level

MAX_ZOOM

[number]

Default: 3

The highest zoom level for which the tileset provides data. Set between 0 and 24.

Extent

Opcional

EXTENT

[extent]

Default: Not set

The maximum extent of the rendered map area. Bounds must define an area covered by all zoom levels.

Metadata: Name

Opcional

META_NAME

[string]

Name of the tileset

Metadata: Description

Opcional

META_DESCRIPTION

[string]

A description of the tileset’s contents

Metadata: Attribution

Opcional

META_ATTRIBUTION

[string]

An attribution string, which explains the sources of data and/or style for the map.

Metadata: Version

Opcional

META_VERSION

[string]

The version of the tileset. This refers to a revision of the tileset itself, not of the MBTiles specification.

Metadata: Type

Opcional

META_TYPE

[string]

Type of tileset. Possible values are overlay or baselayer.

Metadata: Center

Opcional

META_CENTER

[string]

The center (string of comma-separated numbers: the longitude, latitude, and zoom level) of the default view of the map. Example: -122.1906,37.7599,11

Destination MBTiles

OUTPUT

[vector tiles]

Default: [Save to temporary file]

Specification of the output MBTiles file. One of:

  • Save to a Temporary File

  • Save to File…

Resultados

Label

Nome

Type

Descrição

Destination MBTiles

OUTPUT

[file]

Output vector tiles .mbtiles file.

Python code

Algorithm ID: native:writevectortiles_mbtiles

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.

27.1.22.2. Write vector tiles (XYZ)

Exports one or more vector layers to vector tiles, a data format optimized for fast map rendering and small data size.

Parâmetros

Label

Nome

Type

Descrição

File template

XYZ_TEMPLATE

[string]

Default: “{z}/{x}/{y}.pbf”

Template to generate the vector tiles url

Input layers

INPUT

[vector: any] [list]

A list of layers to combine to generate the vector tiles

Minimum zoom level

MIN_ZOOM

[number]

Default: 0

The lowest zoom level for which the tileset provides data. Set between 0 and 24.

Maximum zoom level

MAX_ZOOM

[number]

Default: 3

The highest zoom level for which the tileset provides data. Set between 0 and 24.

Extent

Opcional

EXTENT

[extent]

Default: Not set

The maximum extent of the rendered map area. Bounds must define an area covered by all zoom levels.

Output directory

OUTPUT_DIRECTORY

[folder]

Default: [Save to temporary folder]

Specification of the output vector tiles folder. One of:

  • Save to a Temporary Directory

  • Save to Directory

Resultados

Label

Nome

Type

Descrição

Output directory

OUTPUT_DIRECTORY

[folder]

A folder containing different subsets of the vector tiles files (.pbf) stored in subfolders corresponding to the zoom levels.

Python code

Algorithm ID: native:writevectortiles_xyz

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.