SimpleMap#

class SimpleMap(**properties: Any)#

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

A ready-to-use map Widget.If you want to use your own implementation, you can look at the Map widget.

The simple map contains a zoom widget, a License at the bottom, a Scale and a Compass.

Constructors#

class SimpleMap
classmethod new() SimpleMap#

Methods#

class SimpleMap
add_overlay_layer(layer: Layer) None#

Adds a map layer as an overlay on top of the base map.

Parameters:

layer – a Layer to add

get_base_map_layer() MapLayer#

Gets the MapLayer that displays the base map.

Added in version 1.4.

get_compass() Compass#

Gets the compass widget for the map.

get_license() License#

Gets the license widget for the map.

get_map() Map#

Gets the SimpleMap's underlying Map.

get_map_source() MapSource#

Gets the map source for the current base layer.

get_scale() Scale#

Gets the scale widget for the map.

get_show_zoom_buttons() bool#

Gets whether or not the zoom buttons are shown.

get_viewport() Viewport#

Gets the map’s viewport, needed for constructing map layers that will be added to it.

insert_overlay_layer_above(layer: Layer, sibling: Layer) None#

Inserts a map layer as an overlay on top of the base map. The layer will appear above sibling, or at the bottom (but still above the base map) if sibling is None.

Added in version 1.5.

Parameters:
  • layer – a Layer to insert

  • sibling

insert_overlay_layer_behind(layer: Layer, sibling: Layer) None#

Inserts a map layer as an overlay on top of the base map. The layer will appear just below sibling, or above everything else if sibling is None.

Added in version 1.5.

Parameters:
  • layer – a Layer to insert

  • sibling

remove_overlay_layer(layer: Layer) None#

Removes a layer from the map.

Parameters:

layer – a Layer that was added to the map previously

set_map_source(map_source: MapSource | None = None) None#

Sets the source for the base map.

Parameters:

map_source – a MapSource

set_show_zoom_buttons(show_zoom_buttons: bool) None#

Sets whether or not the zoom buttons are shown.

Parameters:

show_zoom_buttonsTrue to show the zoom buttons, False to hide them

Properties#

class SimpleMap
props.base_map_layer: MapLayer#

The MapLayer that displays the map source.

This is a read-only property. To change the basemap, set the map_source property.

Added in version 1.4.

props.compass: Compass#
props.license: License#
props.map: Map#
props.map_source: MapSource#
props.scale: Scale#
props.show_zoom_buttons: bool#
props.viewport: Viewport#

Signals#

class SimpleMap.signals
symbol_clicked(event: SymbolEvent) None#

Emitted when a symbol in the base map layer (not in overlay layers) is clicked.

Added in version 1.1.

Parameters:

event – a SymbolEvent with details about the clicked symbol.