Shumate.VectorRenderer

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object Shumate.MapSource Shumate.MapSource GObject.Object->Shumate.MapSource Shumate.VectorRenderer Shumate.VectorRenderer Gio.Initable->Shumate.VectorRenderer Shumate.MapSource->Shumate.VectorRenderer

Subclasses:

None

Methods

Inherited:

Shumate.MapSource (26), GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

is_supported ()

class

new (id, style_json)

get_sprite_sheet ()

set_data_source (name, data_source)

set_sprite_sheet (sprites)

set_sprite_sheet_data (sprites_pixbuf, sprites_json)

Virtual Methods

Inherited:

Shumate.MapSource (2), GObject.Object (7), Gio.Initable (1)

Properties

Inherited:

Shumate.MapSource (8)

Name

Type

Flags

Short Description

sprite-sheet

Shumate.VectorSpriteSheet

r/w/en

sprite-sheet

style-json

str

r/w/co/en

Style JSON

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Shumate.VectorRenderer(**kwargs)
Bases:

Shumate.MapSource, Gio.Initable

Abstract:

No

Structure:

Shumate.VectorRendererClass

A [class`MapSource`] that renders tiles from a given vector data source.

classmethod is_supported()
Returns:

True if libshumate was compiled with -Dvector_renderer=true or False if it was not

Return type:

bool

Checks whether libshumate was compiled with vector tile support. If it was not, vector renderers cannot be created or used.

classmethod new(id, style_json)
Parameters:
  • id (str) – an ID for the map source

  • style_json (str) – a vector style

Raises:

GLib.Error

Returns:

a newly constructed [class`VectorRenderer`], or None if error is set

Return type:

Shumate.VectorRenderer

Creates a new [class`VectorRenderer`] from the given JSON style.

The stylesheet should contain a list of tile sources. Tiles will be downloaded using [class`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.

get_sprite_sheet()
Returns:

the [class`VectorSpriteSheet`]

Return type:

Shumate.VectorSpriteSheet

Gets the sprite sheet used to render icons and textures.

New in version 1.1.

set_data_source(name, data_source)
Parameters:

Adds a data source to the renderer.

Currently, [class`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.

New in version 1.2.

set_sprite_sheet(sprites)
Parameters:

sprites (Shumate.VectorSpriteSheet) – a [class`VectorSpriteSheet`]

Sets the sprite sheet used to render icons and textures.

New in version 1.1.

set_sprite_sheet_data(sprites_pixbuf, sprites_json)
Parameters:
  • sprites_pixbuf (GdkPixbuf.Pixbuf) – a [class`GdkPixbuf`.Pixbuf]

  • sprites_json (str) – a JSON string

Raises:

GLib.Error

Returns:

whether the sprite sheet was loaded successfully

Return type:

bool

Sets the sprite sheet used by the style JSON to render icons and textures.

The existing [property`VectorRenderer`:py:data::sprite-sheet<Shumate.VectorRenderer.props.sprite_sheet>] property will be replaced with a new instance of [class`VectorSpriteSheet`].

Deprecated since version 1.1: Use the methods of [property`VectorRenderer`:sprite-sheet] instead.

Property Details

Shumate.VectorRenderer.props.sprite_sheet
Name:

sprite-sheet

Type:

Shumate.VectorSpriteSheet

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The sprite sheet used to render icons and textures.

New in version 1.1.

Shumate.VectorRenderer.props.style_json
Name:

style-json

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY, EXPLICIT_NOTIFY

A map style, in Mapbox Style Specification format.

Note that not all features of the specification are supported.