The Map is a widget specifically for displaying a geographic map. It uses OpenStreetMap as map tile provider, YOURS for routing calculation and Nominatim to convert geographic coordinates to/from address names. But custom providers can be added.
It supports some basic but yet nice features:
This widget supports the scrollable interface.
If you wish to control the scolling behaviour using these functions, inherit both the widget class and the Scrollable class using multiple inheritance, for example:
class ScrollableGenlist(Genlist, Scrollable):
def __init__(self, canvas, *args, **kwargs):
Genlist.__init__(self, canvas)
None
The default overlay type.
The Class overlay is used to group marker together.
A group of overlays.
This class can follow another overlay.
This is used to draw a route result on the map.
Simply draw a line on the map.
Simply draw a polygon on the map.
Simply draw a circle on the map.
This will draw a dinamic scale on the map.
Route should prioritize time
Route should prioritize distance
Route should consider an automobile will be used.
Route should consider a bicycle will be used by the user.
Route should consider user will be walking.
Map tile provider
Route service provider
Name service provider
Bases: efl.elementary.__init__.Object
This is the class that actually implement the widget.
Parameters: |
|
---|
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
Add a callback to be called on the “clicked” signal.
Delete a previously attached callback
Add a callback to be called on the “clicked,double” signal.
Delete a previously attached callback
When the map has received focus.
New in version 1.8.
Add a callback to be called on the “language,changed” signal.
Delete a previously attached callback
Add a callback to be called on the “loaded” signal.
Delete a previously attached callback
Add a callback to be called on the “longpressed” signal.
Delete a previously attached callback
Add a callback to be called on the “name,load” signal.
Delete a previously attached callback
Add a callback to be called on the “name,loaded” signal.
Delete a previously attached callback
Add a callback to be called on the “name,loaded,fail” signal.
Delete a previously attached callback
Add a callback to be called on the “overlay,clicked” signal.
Delete a previously attached callback
Add a callback to be called on the “overlay,del” signal.
Delete a previously attached callback
Add a callback to be called on the “press” signal.
Delete a previously attached callback
Add a callback to be called on the “route,load” signal.
Delete a previously attached callback
Add a callback to be called on the “route,loaded” signal.
Delete a previously attached callback
Add a callback to be called on the “route,loaded,fail” signal.
Delete a previously attached callback
Add a callback to be called on the “scroll” signal.
Add a callback to be called on the “scroll,anim,start” signal.
Delete a previously attached callback
Add a callback to be called on the “scroll,anim,stop” signal.
Delete a previously attached callback
Delete a previously attached callback
Add a callback to be called on the “scroll,drag,start” signal.
Delete a previously attached callback
Add a callback to be called on the “scroll,drag,stop” signal.
Delete a previously attached callback
Add a callback to be called on the “tile,load” signal.
Delete a previously attached callback
Add a callback to be called on the “tile,loaded” signal.
Delete a previously attached callback
Add a callback to be called on the “tile,loaded,fail” signal.
Delete a previously attached callback
When the map has lost focus.
New in version 1.8.
Add a callback to be called on the “zoom,change” signal.
Delete a previously attached callback
Add a callback to be called on the “zoom,start” signal.
Delete a previously attached callback
Add a callback to be called on the “zoom,stop” signal.
Delete a previously attached callback
Convert canvas coordinates into geographic coordinates.
This gets longitude and latitude from canvas x, y coordinates. The canvas coordinates mean x, y coordinate from current viewport.
Parameters: |
|
---|---|
Returns: | (lon, lat) |
Return type: | tuple of float |
See also
Request an address or geographic coordinates (longitude, latitude) from a given address or geographic coordinate(longitude, latitude).
If you want to get address from geographic coordinates, set param address to None and set lon and lat as you want to query.
Instead if you want to query the geographic coordinates for a given address set address to something different than None.
To get the string for this address, MapName.address_get() should be used after the name_cb callback or “name,loaded” signal is called.
In the same way to get the longitude and latitude, MapName.region_get() should be used.
Parameters: |
|
---|---|
Returns: | a new name object |
Return type: |
Note
Any other arguments (positional or named) passed to the function will be passed back in the name_cb function
Add a new overlay to the map object. This overlay has a default type.
An overlay will be created and shown in a specific point of the map, defined by lon and lat.
The created overlay has a default style layout before content or icon is set. If content or icon is set, those are displayed instead of default style layout.
Parameters: |
|
---|---|
Returns: | a newly created overlay |
Return type: |
Add a new bubble overlay to the map object.
A bubble will not be displayed before geographic coordinates are set or any other overlays are followed.
This overlay has a bubble style layout and icon or content can not be set.
Returns: | a new bubble style overlay |
---|---|
Return type: | MapOverlayBubble |
See also
Add a new circle overlay to the map object.
This overlay has a circle type.
Parameters: |
|
---|---|
Returns: | a new circle style overlay |
Return type: |
See also
Add a new class overlay to the map object.
This overlay has a class type. This overlay is not shown before overlay members are appended. If overlay members in the same class are close, group overlays are created. If they are far away, group overlays are hidden. When group overlays are shown, they have default style layouts at first.
You can change the state (hidden, paused, etc.) or set the content or icon of the group overlays by changing the state of the class overlay. Do not modify the group overlay itself. Also these changes have an influence on the overlays in the same class even if each overlay is alone and is not grouped.
Returns: | a new class style overlay |
---|---|
Return type: | MapOverlayClass |
See also
Add a new line overlay to the map object.
This overlay has a line type.
Parameters: |
|
---|---|
Returns: | a new line style overlay |
Return type: |
See also
Add a new polygon overlay to the map object.
This overlay has a polygon type. At least 3 regions should be added to show the polygon overlay.
Returns: | a new polygon style overlay |
---|---|
Return type: | MapOverlayPolygon |
See also
Add a new route overlay to the map object.
This overlay has a route type. This overlay has a route style layout and icon or content can not be set.
Parameters: | route (efl.elementary.map.MapRoute) – The route object to make an overlay from. |
---|---|
Returns: | a new route style overlay |
Return type: | MapOverlayRoute |
See also
Add a new scale overlay to the map object.
This overlay has a scale type. The scale overlay shows the ratio of a distance on the map to the corresponding distance.
Parameters: |
|
---|---|
Returns: | a new scale style overlay |
Return type: |
See also
The list of all the overlays in the map object.
This list includes group overlays also. So this can change dynamically while zooming and panning.
Returns: | a list of all overlays |
---|---|
Return type: | list of MapOverlay objects |
Move and zoom the map to display a list of overlays.
The map will be centered on the center point of the overlays in the list. Then the map will be zoomed in order to fit the overlays using the maximum zoom which allows display of all the overlays provided.
Parameters: | overlays (list of MapOverlay) – the list of overlays to show |
---|
Warning
All the overlays in the list should belong to the same map object.
The paused state of the map object.
This set/get the paused state to on (True) or off (False) for the map.
The default is off.
This will stop zooming using animation, changing zoom levels will change instantly. This will stop any existing animations that are running.
Type: | bool |
---|
The current geographic coordinates of the map.
This gets the current center coordinates of the map object. It can be set by region_bring_in() and region_show().
Type: | tuple of float (lon, lat) |
---|
Animatedly bring in given coordinates to the center of the map.
This causes the map to jump to the given lon and lat coordinates and show it (by scrolling) in the center of the viewport, if it is not already centered. This will use animation to do so and take a period of time to complete.
Parameters: |
|
---|
See also
Show the given coordinates at the center of the map, immediately.
This causes the map to redraw its viewport’s contents to the region containing the given lat and lon, that will be moved to the center of the map.
Parameters: |
|
---|
See also
Convert geographic coordinates into canvas coordinates.
This gets canvas x, y coordinates from longitude and latitude. The canvas coordinates mean x, y coordinate from current viewport.
Parameters: |
|
---|---|
Returns: | (x, y) |
Return type: | tuple of int |
See also
Animatedly set the zoom level of the map and bring in given coordinates to the center of the map.
This causes map to zoom into specific zoom level and also move to the given lat and lon coordinates and show it (by scrolling) in the center of the viewport concurrently.
Parameters: |
|
---|
New in version 1.11.
The rotation of the map.
Rotate (or get the rotation) of the map around the Z axis. The rotation is expressed using the tuple: (degree, cx, cy), where degree is an angle that range from 0.0 to 360.0, while cx and cy are the center of rotation expressed in canvas units.
Type: | a tuple (float, int, int) |
---|
Add a new route to the map object.
A route will be traced by point on coordinates (flat, flon) to point on coordinates (tlat, tlon), using the route service set with source_set().
It will take type on consideration to define the route, depending if the user will be walking or driving, the route may vary. One of ELM_MAP_ROUTE_TYPE_MOTOCAR, ELM_MAP_ROUTE_TYPE_BICYCLE, or ELM_MAP_ROUTE_TYPE_FOOT need to be used.
Another parameter is what the route should prioritize, the minor distance or the less time to be spend on the route. So method should be one of ELM_MAP_ROUTE_METHOD_SHORTEST or ELM_MAP_ROUTE_METHOD_FASTEST.
Parameters: |
|
---|---|
Returns: | a new route object |
Return type: |
Note
Any other arguments (positional or named) passed to the function will be passed back in the route_cb function
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
Deprecated since version 1.8: You should combine with Scrollable class instead.
Get the name of currently used source for a specific type.
Parameters: | source_type (Map source types) – the type of the source. Must be one of: ELM_MAP_SOURCE_TYPE_TILE, ELM_MAP_SOURCE_TYPE_ROUTE or ELM_MAP_SOURCE_TYPE_NAME |
---|
See also
Set the current source of the map for a specific type.
Map widget retrieves tile images that composes the map from a web service. This web service can be set with this method for ELM_MAP_SOURCE_TYPE_TILE type. A different service can return a different maps with different information and it can use different zoom values.
Map widget provides route data based on a external web service. This web service can be set with this method for ELM_MAP_SOURCE_TYPE_ROUTE type.
Map widget also provide geoname data based on a external web service. This web service can be set with this method for ELM_MAP_SOURCE_TYPE_NAME type.
The current source can be get using elm_map_source_get().
Parameters: |
|
---|
See also
Get the names of available sources for a specific type.
This will provide a list with all available sources for the given type.
Default available sources of tile type:
Default available sources of route type:
Default available sources of name type:
Parameters: | type (Map source types) – the type of the source. Must be one of: ELM_MAP_SOURCE_TYPE_TILE, ELM_MAP_SOURCE_TYPE_ROUTE or ELM_MAP_SOURCE_TYPE_NAME |
---|
See also
Get the information of tile load status.
This gets the current tiles requested and the count of the loaded ones.
Returns: | the number of requested and completed tiles |
---|---|
Return type: | tuple of 2 int |
The user agent used by the map object to access routing services.
User agent is a client application implementing a network protocol used in communications within a client–server distributed computing system.
The user_agent identification string will be transmitted in a header field User-Agent.
Type: | string |
---|
Mouse wheel can be used by the user to zoom in / out the map.
This property disable the mouse wheel usage.
Type: | bool |
---|
The zoom level of the map.
This property will respect the limits defined by zoom_min and zoom_max. By default these values are 0 (world map) and 18 (maximum zoom).
This property should be used when zoom mode is set to ELM_MAP_ZOOM_MODE_MANUAL. That is the default mode, and can be set with zoom_mode.
Type: | int |
---|
The maximum zoom of the source.
The minimum zoom of the source.
The zoom mode used by the map object.
This sets the zoom mode to manual or one of the automatic levels. Manual (ELM_MAP_ZOOM_MODE_MANUAL) means that zoom is set manually by the zoom property and will stay at that level until changed by code or until zoom_mode is changed. This is the default mode.
The Automatic modes will allow the map object to automatically adjust zoom mode based on properties. ELM_MAP_ZOOM_MODE_AUTO_FIT will adjust zoom so the map fits inside the scroll frame with no pixels outside this area. ELM_MAP_ZOOM_MODE_AUTO_FILL will be similar but ensure no pixels within the frame are left unfilled. Do not forget that the valid sizes are 2^zoom, consequently the map may be smaller than the scroller view.
Type: | int |
---|
Bases: object
This class represents a calculated route.
A route will be traced by point on coordinates to point on coordinates , using the route service set with Map.source_set().
See also
Remove a route from the map.
The route distance in kilometers.
Type: | float |
---|
Get the informational text of the route nodes.
Type: | string |
---|
Get the informational text of the route waypoints.
Type: | string |
---|
Bases: object
This class represent the result of a name/coordinates query and can be used to extract the needed information from the results.
The address of the name object.
Type: | string |
---|
Remove a name from the map.
Get the coordinates of the name.
Type: | tuple of float (lon, lat) |
---|
Bases: object
Base class for all the MapOverlay objects
See also
Set a callback to be called when the overlay is clicked.
If the overlay is clicked, the callback func will be called. The clicked overlay is returned by callback.
You can add callback to the class overlay. If one of the group overlays in this class is clicked, func will be called and return a virtual group overlays.
Parameters: | func (callable) – the callback to be called |
---|
Note
Any extra argument (positional or named) passed to this function will be passed back in the callback.
Unset the callback previously attached to this overlay.
The color of the overlay.
It uses an additive color model, so each color channel represents how much of each primary colors must to be used. 0 represents absence of this color, so if all of the three are set to 0, the color will be black.
These component values should be integers in the range 0 to 255, (single 8-bit byte).
By default is set to solid red (r = 255, g = 0, b = 0, a = 255).
For alpha channel, 0 represents completely transparent, and 255, opaque.
Type: | tuple of 4 int (red, green, blue, alpha) |
---|
Note
Only default, class and route type overlay support this function.
The content object of the overlay.
The content should be resized or set size hints before set to the overlay.
This content is what will be inside the overlay that will be displayed. If a content is set, icon and default style layout are no more used before the content is deleted.
Type: | efl.evas.Object |
---|
Note
Only default and class type overlay support this function.
Warning
Do not modify this object (move, show, hide, del, etc.) after set.
Delete the overlay and remove it from the map
The minimum zoom from where the overlay is displayed.
The overlay only will be displayed when the map is displayed at this value or bigger.
Type: | int |
---|
If the overlay is hidden or not.
Type: | bool |
---|
The icon that is used to display the overlay.
Type: | efl.evas.Object |
---|
Note
Only default and class type overlay support this function.
Warning
Do not modify this object (move, show, hide, del, etc.) after set.
Pause or unpause the overlay.
This sets the paused state to on (True) or off (False) for the overlay.
The default is off.
This will stop moving the overlay coordinates instantly. even if map being scrolled or zoomed.
Type: | bool |
---|
The geographic coordinates of the overlay.
This represent the center coordinates of the overlay.
Type: | tuple of float (lon, lat) |
---|
Note
Only default and bubble type overlay support this function.
Center the map on this overlay, immediately.
This causes the map to redraw its viewport’s contents to the region containing the given overlay’s coordinates, that will be moved to the center of the map.
See also
Map.overlays_show() if more than one overlay need to be displayed
Get the type of the overlay
Type: | Map overlay types |
---|
Whether the overlay is visible or not.
The visible of the overlay can not be set. This value can only change dynamically while zooming and panning.
Type: | bool |
---|
Bases: efl.elementary.__init__.MapOverlay
This is a virtual overlay type that rapreset a set of different overlays grouped together.
See also
Add a new overlay member to the class overlay.
Parameters: | overlay (MapOverlay) – the overlay to be added as a member. |
---|
The overlay members of the class overlay.
The group overlays are virtually overlays. Those are shown and hidden dynamically. You can add callback to the class overlay. If one of the group overlays in this class is clicked, callback will be called and return a virtual group overlays.
You can change the state (hidden, paused, etc.) or set the content or icon of the group overlays by changing the state of the class overlay.
Type: | list of MapOverlay |
---|
Warning
Do not modify the group overlay itself.
Remove the given overlay to the overlay class.
Parameters: | overlay (MapOverlay) – the overlay to add as member |
---|
the maximum zoom from where the overlay members in the class can be grouped.
Overlay members in the class only will be grouped when the map is displayed at less than zoom_max.
Type: | int |
---|
Bases: efl.elementary.__init__.MapOverlay
This overlay type has a bubble style. And can follow another overlay.
Note
This overlay has a bubble style layout and icon or content can not be set.
See also
Add a content object to the bubble overlay.
Added contents will be displayed inside the bubble overlay.
Parameters: | content (efl.evas.Object) – The content to be added to the bubble overlay. |
---|
Clear all contents inside the bubble overlay.
This will delete all contents inside the bubble overlay.
Follow another overlay.
Bubble overlay will follow the parent overlay’s movement (hide, show, move).
Parameters: | overlay (MapOverlay) – another overlay to follow. |
---|
Bases: efl.elementary.__init__.MapOverlay
This style of overlay is drawn as a simple line.
See also
Bases: efl.elementary.__init__.MapOverlay
This overlay style is represented by a polygon. The polygon is described by the points added using the region_add() method.
At least 3 regions should be added to show the polygon overlay.
See also
Add a geographic coordinates to the polygon overlay.
Parameters: |
|
---|
Bases: efl.elementary.__init__.MapOverlay
This style of overlay is drawn as a simple circle.
See also
Bases: efl.elementary.__init__.MapOverlay
The scale overlay shows the ratio of a distance on the map to the corresponding distance.
See also