Shumate.MapSource

g GObject.Object GObject.Object Shumate.MapSource Shumate.MapSource GObject.Object->Shumate.MapSource

Subclasses:

Shumate.RasterRenderer, Shumate.VectorRenderer

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

fill_tile_async (tile, cancellable, callback, *user_data)

fill_tile_finish (result)

get_column_count (zoom_level)

get_id ()

get_latitude (zoom_level, y)

get_license ()

get_license_uri ()

get_longitude (zoom_level, x)

get_max_zoom_level ()

get_meters_per_pixel (zoom_level, latitude, longitude)

get_min_zoom_level ()

get_name ()

get_projection ()

get_row_count (zoom_level)

get_tile_size ()

get_tile_size_at_zoom (zoom_level)

get_x (zoom_level, longitude)

get_y (zoom_level, latitude)

set_id (id)

set_license (license)

set_license_uri (license_uri)

set_max_zoom_level (zoom_level)

set_min_zoom_level (zoom_level)

set_name (name)

set_projection (projection)

set_tile_size (tile_size)

Virtual Methods

Inherited:

GObject.Object (7)

do_fill_tile_async (tile, cancellable, callback, *user_data)

do_fill_tile_finish (result)

Properties

Name

Type

Flags

Short Description

id

str

r/w/c/en

The id of the map source

license

str

r/w/c/en

The usage license of the map source

license-uri

str

r/w/c/en

The usage license’s uri for more information

max-zoom-level

int

r/w/c/en

The maximum zoom level

min-zoom-level

int

r/w/c/en

The minimum zoom level

name

str

r/w/c/en

The name of the map source

projection

Shumate.MapProjection

r/w/c/en

The map projection

tile-size

int

r/w/c/en

The map size

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Shumate.MapSource(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

Shumate.MapSourceClass

The base class for all map sources. Map sources fill [class`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 [class`RasterRenderer`], which fetches tiles using a [class`TileDownloader`].

fill_tile_async(tile, cancellable, callback, *user_data)
Parameters:

Asynchronous version of shumate_map_source_fill_tile().

fill_tile_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult provided to callback

Raises:

GLib.Error

Returns:

True if the tile was filled with valid data, otherwise False

Return type:

bool

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

get_column_count(zoom_level)
Parameters:

zoom_level (int) – the zoom level

Returns:

the number of tiles in a column

Return type:

int

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

get_id()
Returns:

the map source’s id.

Return type:

str

Gets map source’s id.

get_latitude(zoom_level, y)
Parameters:
  • zoom_level (float) – the zoom level

  • y (float) – a y position

Returns:

the latitude

Return type:

float

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

get_license()
Returns:

the map source’s license.

Return type:

str

Gets map source’s license.

get_license_uri()
Returns:

the map source’s license URI.

Return type:

str

Gets map source’s license URI.

get_longitude(zoom_level, x)
Parameters:
  • zoom_level (float) – the zoom level

  • x (float) – a x position

Returns:

the longitude

Return type:

float

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

get_max_zoom_level()
Returns:

the maximum zoom level this map source supports

Return type:

int

Gets map source’s maximum zoom level.

get_meters_per_pixel(zoom_level, latitude, longitude)
Parameters:
  • zoom_level (float) – the zoom level

  • latitude (float) – a latitude

  • longitude (float) – a longitude

Returns:

the meters per pixel

Return type:

float

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

get_min_zoom_level()
Returns:

the miminum zoom level this map source supports

Return type:

int

Gets map source’s minimum zoom level.

get_name()
Returns:

the map source’s name.

Return type:

str

Gets map source’s name.

get_projection()
Returns:

the map source’s projection.

Return type:

Shumate.MapProjection

Gets map source’s projection.

get_row_count(zoom_level)
Parameters:

zoom_level (int) – the zoom level

Returns:

the number of tiles in a row

Return type:

int

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

get_tile_size()
Returns:

the tile’s size (width and height) in pixels for this map source

Return type:

int

Gets map source’s tile size.

get_tile_size_at_zoom(zoom_level)
Parameters:

zoom_level (float) – a zoom level

Returns:

the tile’s size (width and height) in pixels for this map source at this zoom level

Return type:

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.

get_x(zoom_level, longitude)
Parameters:
  • zoom_level (float) – the zoom level

  • longitude (float) – a longitude

Returns:

the x position

Return type:

float

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

get_y(zoom_level, latitude)
Parameters:
  • zoom_level (float) – the zoom level

  • latitude (float) – a latitude

Returns:

the y position

Return type:

float

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

set_id(id)
Parameters:

id (str) – an id

Sets the map source’s id.

set_license(license)
Parameters:

license (str) – the licence

Sets the map source’s license.

set_license_uri(license_uri)
Parameters:

license_uri (str) – the licence URI

Sets the map source’s license URI.

set_max_zoom_level(zoom_level)
Parameters:

zoom_level (int) – the maximum zoom level

Sets the map source’s maximum zoom level.

set_min_zoom_level(zoom_level)
Parameters:

zoom_level (int) – the minimal zoom level

Sets the map source’s minimal zoom level.

set_name(name)
Parameters:

name (str) – a name

Sets the map source’s name.

set_projection(projection)
Parameters:

projection (Shumate.MapProjection) – a Shumate.MapProjection

Sets the map source’s projection.

set_tile_size(tile_size)
Parameters:

tile_size (int) – the tile size

Sets the map source’s tile size.

do_fill_tile_async(tile, cancellable, callback, *user_data) virtual
Parameters:

Asynchronous version of shumate_map_source_fill_tile().

do_fill_tile_finish(result) virtual
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult provided to callback

Returns:

True if the tile was filled with valid data, otherwise False

Return type:

bool

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

Property Details

Shumate.MapSource.props.id
Name:

id

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The id of the map source

Shumate.MapSource.props.license
Name:

license

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The usage license of the map source

Shumate.MapSource.props.license_uri
Name:

license-uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The usage license’s uri for more information

Shumate.MapSource.props.max_zoom_level
Name:

max-zoom-level

Type:

int

Default Value:

18

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The maximum zoom level

Shumate.MapSource.props.min_zoom_level
Name:

min-zoom-level

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The minimum zoom level

Shumate.MapSource.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The name of the map source

Shumate.MapSource.props.projection
Name:

projection

Type:

Shumate.MapProjection

Default Value:

Shumate.MapProjection.MERCATOR

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The map projection of the map source

Shumate.MapSource.props.tile_size
Name:

tile-size

Type:

int

Default Value:

256

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The tile size of the map source