Map#
Superclasses: Widget, InitiallyUnowned, Object
Implemented Interfaces: Accessible, Buildable, ConstraintTarget
The Map widget is a Widget that show and allows interaction with
the user.
This is the base widget and doesn’t have advanced features. You can check the
SimpleMap for a ready-to-use widget.
By default, a Viewport is created and can be accessed with
get_viewport.
Unless created with new_simple, the widget doesn’t hold any
layer and won’t show anything. A Layer can be added or removed
using the add_layer or remove_layer
methods.
Constructors#
Methods#
- class Map
- 
- center_on(latitude: float, longitude: float) None#
- Centers the map on these coordinates. - Parameters:
- latitude – the longitude to center the map at 
- longitude – the longitude to center the map at 
 
 
 - go_to(latitude: float, longitude: float) None#
- Move from the current position to these coordinates. All tiles in the intermediate view WILL be loaded! - Parameters:
- latitude – the longitude to center the map at 
- longitude – the longitude to center the map at 
 
 
 - go_to_full(latitude: float, longitude: float, zoom_level: float) None#
- Move from the current position to these coordinates and zoom to the given zoom level. All tiles in the intermediate view WILL be loaded! - Parameters:
- latitude – the longitude to center the map at 
- longitude – the longitude to center the map at 
- zoom_level – the zoom level to end at 
 
 
 - go_to_full_with_duration(latitude: float, longitude: float, zoom_level: float, duration_ms: int) None#
- Move from the current position to these coordinates and zoom to the given zoom level. The given duration is used instead of the map’s default - go_to_duration. All tiles in the intermediate view WILL be loaded!- Parameters:
- latitude – the longitude to center the map at 
- longitude – the longitude to center the map at 
- zoom_level – the zoom level to end at 
- duration_ms – animation duration in milliseconds 
 
 
 - insert_layer_above(layer: Layer, next_sibling: Layer | None = None) None#
- Adds - layerto- selfabove- next_siblingor, if- next_siblingis- None, at the bottom of the layer list.
 - insert_layer_behind(layer: Layer, next_sibling: Layer | None = None) None#
- Adds - layerto- selfbehind- next_siblingor, if- next_siblingis- None, at the top of the layer list.
 - set_animate_zoom(value: bool) None#
- Should the view animate zoom level changes. - Parameters:
- value – a - gboolean
 
 - set_go_to_duration(duration: int) None#
- Set the duration of the transition of - go_to.- Parameters:
- duration – the animation duration, in milliseconds 
 
 - set_map_source(map_source: MapSource) None#
- Changes the currently used map source. #:func: - unrefwill be called on the previous one.- As a side effect, changing the primary map source will also clear all secondary map sources. - Parameters:
- map_source – a - MapSource
 
 - set_zoom_on_double_click(value: bool) None#
- Should the view zoom in and recenter when the user double click on the map. - Parameters:
- value – a - gboolean
 
 - stop_go_to() None#
- Stop the go to animation. The view will stay where it was when the animation was stopped. 
 - zoom_in() None#
- Zooms the map in. If - animate_zoomis- TRUE, the change will be animated.
 - zoom_out() None#
- Zooms the map out. If - animate_zoomis- TRUE, the change will be animated.
 
Properties#
- class Map