DataSource

class DataSource(**properties: Any)

Superclasses: Object

Subclasses: TileDownloader

The base class used to retrieve tiles as Bytes.

Methods

class DataSource
get_max_zoom_level() int

Gets the data source’s maximum zoom level.

Added in version 1.1.

get_min_zoom_level() int

Gets the data source’s minimum zoom level.

Added in version 1.1.

get_tile_data_async(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Gets the data for the tile at the given coordinates.

Some data sources may return data multiple times. For example, TileDownloader may return data from a cache, then return updated data from the network. received_data is emitted each time data is received, then callback is called after the last update.

Parameters:
  • x – the X coordinate to fetch

  • y – the Y coordinate to fetch

  • zoom_level – the Z coordinate to fetch

  • cancellable – a Cancellable

  • callback – a AsyncReadyCallback to execute upon completion

  • user_data – closure data for callback

get_tile_data_finish(result: AsyncResult) Bytes | None

Gets the final result of a request started with get_tile_data_async().

Parameters:

result – a AsyncResult provided to callback

set_max_zoom_level(zoom_level: int) None

Sets the data source’s maximum zoom level.

Added in version 1.1.

Parameters:

zoom_level – the maximum zoom level

set_min_zoom_level(zoom_level: int) None

Sets the data source’s minimum zoom level.

Added in version 1.1.

Parameters:

zoom_level – the minimum zoom level

start_request(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None) DataSourceRequest

Begins a request for a tile.

Added in version 1.1.

Parameters:
  • x – X coordinate to request

  • y – Y coordinate to request

  • zoom_level – zoom level to request

  • cancellable – for cancelling the request

Properties

class DataSource
props.max_zoom_level: int

The maximum zoom level

Added in version 1.1.

props.min_zoom_level: int

The minimum zoom level

Added in version 1.1.

Signals

class DataSource.signals
received_data(x: int, y: int, zoom_level: int, bytes: Bytes) None

Emitted when data is received for any tile. This includes any intermediate steps, such as data from the file cache, as well as the final result.

Deprecated since version 1.1: Use start_request and connect to the notify signals of the resulting DataSourceRequest.

Parameters:
  • x – the X coordinate of the tile

  • y – the Y coordinate of the tile

  • zoom_level – the zoom level of the tile

  • bytes – the received data

Virtual Methods

class DataSource
do_get_tile_data_async(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Gets the data for the tile at the given coordinates.

Some data sources may return data multiple times. For example, TileDownloader may return data from a cache, then return updated data from the network. received_data is emitted each time data is received, then callback is called after the last update.

Parameters:
  • x – the X coordinate to fetch

  • y – the Y coordinate to fetch

  • zoom_level – the Z coordinate to fetch

  • cancellable – a Cancellable

  • callback – a AsyncReadyCallback to execute upon completion

  • user_data – closure data for callback

do_get_tile_data_finish(result: AsyncResult) Bytes | None

Gets the final result of a request started with get_tile_data_async().

Parameters:

result – a AsyncResult provided to callback

do_start_request(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None) DataSourceRequest

Begins a request for a tile.

Added in version 1.1.

Parameters:
  • x – X coordinate to request

  • y – Y coordinate to request

  • zoom_level – zoom level to request

  • cancellable – for cancelling the request

Fields

class DataSource
parent_instance