VectorRenderer#
Superclasses: MapSource, Object
Implemented Interfaces: Initable
A MapSource that renders tiles from a given vector data source.
Constructors#
- class VectorRenderer
- classmethod new(id: str, style_json: str) VectorRenderer#
Creates a new
VectorRendererfrom the given JSON style.The stylesheet should contain a list of tile sources. Tiles will be downloaded using
TileDownloaders.See the MapLibre Style Specification for details on
style_json, but be aware that libshumate does not support every feature of the specification.- Parameters:
id – an ID for the map source
style_json – a vector style
Methods#
- class VectorRenderer
- get_sprite_sheet() VectorSpriteSheet#
Gets the sprite sheet used to render icons and textures.
Added in version 1.1.
- classmethod is_supported() bool#
Checks whether libshumate was compiled with vector tile support. If it was not, vector renderers cannot be created or used.
- set_data_source(name: str, data_source: DataSource) None#
Adds a data source to the renderer.
Currently,
VectorRendereronly supports one data source and throws an error if the style does not contain exactly one data source. However, support for multiple sources may be added in the future, so this method accepts a name parameter. If the name does not match the one expected by the style, this method will have no effect.Added in version 1.2.
- Parameters:
name – the name of the data source
data_source – a
DataSource
- set_sprite_sheet(sprites: VectorSpriteSheet) None#
Sets the sprite sheet used to render icons and textures.
Added in version 1.1.
- Parameters:
sprites – a
VectorSpriteSheet
- set_sprite_sheet_data(sprites_pixbuf: Pixbuf, sprites_json: str) bool#
Sets the sprite sheet used by the style JSON to render icons and textures.
The existing
sprite_sheetproperty will be replaced with a new instance ofVectorSpriteSheet.Deprecated since version 1.1: Use the methods of
sprite_sheetinstead.- Parameters:
sprites_pixbuf – a
Pixbufsprites_json – a JSON string
Properties#
- class VectorRenderer
- props.sprite_sheet: VectorSpriteSheet#
The type of the None singleton.
Added in version 1.1.