MapSource

class MapSource(**properties: Any)

Superclasses: Object

Subclasses: RasterRenderer, VectorRenderer

The base class for all map sources. Map sources fill Tile objects with images from various sources: a web API, for example, or a test pattern generated on demand.

The most common map source is RasterRenderer, which fetches tiles using a TileDownloader.

Methods

class MapSource
fill_tile_async(tile: Tile, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronous version of shumate_map_source_fill_tile().

Parameters:
  • tile – a Tile

  • cancellable – a Cancellable

  • callback – a AsyncReadyCallback to execute upon completion

  • user_data – closure data for callback

fill_tile_finish(result: AsyncResult) bool

Gets the success value of a completed fill_tile_async() operation.

Parameters:

result – a AsyncResult provided to callback

get_column_count(zoom_level: int) int

Gets the number of tiles in a column at this zoom level for this map source.

Parameters:

zoom_level – the zoom level

get_id() str

Gets map source’s id.

get_latitude(zoom_level: float, y: float) float

Gets the latitude corresponding to this y position in the map source’s projection.

Parameters:
  • zoom_level – the zoom level

  • y – a y position

get_license() str

Gets map source’s license.

get_license_uri() str

Gets map source’s license URI.

get_longitude(zoom_level: float, x: float) float

Gets the longitude corresponding to this x position in the map source’s projection.

Parameters:
  • zoom_level – the zoom level

  • x – a x position

get_max_zoom_level() int

Gets map source’s maximum zoom level.

get_meters_per_pixel(zoom_level: float, latitude: float, longitude: float) float

Gets meters per pixel at the position on the map using this map source’s projection.

Parameters:
  • zoom_level – the zoom level

  • latitude – a latitude

  • longitude – a longitude

get_min_zoom_level() int

Gets map source’s minimum zoom level.

get_name() str

Gets map source’s name.

get_projection() MapProjection

Gets map source’s projection.

get_row_count(zoom_level: int) int

Gets the number of tiles in a row at this zoom level for this map source.

Parameters:

zoom_level – the zoom level

get_tile_size() int

Gets map source’s tile size.

get_tile_size_at_zoom(zoom_level: float) float

Gets the apparent size of the map tiles at the given fractional zoom level.

As the map is zoomed in, a tile gets bigger and bigger until, at the next integer zoom level, it “splits” into four tiles at the next zoom level. Thus, the size increase follows an exponential curve, base 2.

Parameters:

zoom_level – a zoom level

get_x(zoom_level: float, longitude: float) float

Gets the x position on the map using this map source’s projection. (0, 0) is located at the top left.

Parameters:
  • zoom_level – the zoom level

  • longitude – a longitude

get_y(zoom_level: float, latitude: float) float

Gets the y position on the map using this map source’s projection. (0, 0) is located at the top left.

Parameters:
  • zoom_level – the zoom level

  • latitude – a latitude

set_id(id: str) None

Sets the map source’s id.

Parameters:

id – an id

set_license(license: str) None

Sets the map source’s license.

Parameters:

license – the licence

set_license_uri(license_uri: str) None

Sets the map source’s license URI.

Parameters:

license_uri – the licence URI

set_max_zoom_level(zoom_level: int) None

Sets the map source’s maximum zoom level.

Parameters:

zoom_level – the maximum zoom level

set_min_zoom_level(zoom_level: int) None

Sets the map source’s minimal zoom level.

Parameters:

zoom_level – the minimal zoom level

set_name(name: str) None

Sets the map source’s name.

Parameters:

name – a name

set_projection(projection: MapProjection) None

Sets the map source’s projection.

Parameters:

projection – a MapProjection

set_tile_size(tile_size: int) None

Sets the map source’s tile size.

Parameters:

tile_size – the tile size

Properties

class MapSource
props.id: str

The id of the map source

props.license: str

The usage license of the map source

props.license_uri: str

The usage license’s uri for more information

props.max_zoom_level: int

The maximum zoom level

props.min_zoom_level: int

The minimum zoom level

props.name: str

The name of the map source

props.projection: MapProjection

The map projection of the map source

props.tile_size: int

The tile size of the map source

Virtual Methods

class MapSource
do_fill_tile_async(tile: Tile, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronous version of shumate_map_source_fill_tile().

Parameters:
  • tile – a Tile

  • cancellable – a Cancellable

  • callback – a AsyncReadyCallback to execute upon completion

  • user_data – closure data for callback

do_fill_tile_finish(result: AsyncResult) bool

Gets the success value of a completed fill_tile_async() operation.

Parameters:

result – a AsyncResult provided to callback

Fields

class MapSource
parent_instance