VectorRenderer

class VectorRenderer(**properties: Any)

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 VectorRenderer from the given JSON style.

The stylesheet should contain a list of tile sources. Tiles will be downloaded using TileDownloader’s.

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.

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, VectorRenderer only 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_sheet property will be replaced with a new instance of VectorSpriteSheet.

Deprecated since version 1.1: Use the methods of sprite_sheet instead.

Parameters:
  • sprites_pixbuf – a Pixbuf

  • sprites_json – a JSON string

Properties

class VectorRenderer
props.sprite_sheet: VectorSpriteSheet

The sprite sheet used to render icons and textures.

Added in version 1.1.

props.style_json: str

A map style, in Mapbox Style Specification format.

Note that not all features of the specification are supported.