OsmGpsMap.Map¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.DrawingArea (1), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c |
map auto center |
||
r/w/c |
the amount of the window the gps point must move before auto centering |
||
r/w/c |
map auto download |
||
r/w/co |
The number of pixels the user has to move the pointer in order to start dragging |
||
r/w/c |
The radius of the gps point highlight circle |
||
r/w/c |
The radius of the gps point inner circle |
||
r/w/c |
The width of the lines drawn for the gps track |
||
r/w/co |
The map source tile repository image format (jpg, png) |
||
r |
Latitude in degrees |
||
r |
Longitude in degrees |
||
r/w/c |
The map source ID |
||
r/w/co |
Initial map x location |
||
r/w/co |
Initial map y location |
||
r/w/co |
Maximum zoom level |
||
r/w/co |
Minimum zoom level |
||
r/w/co |
HTTP proxy uri or |
||
r/w/c |
should all gps points be recorded in a trip history |
||
r/w/co |
Map source tile repository uri |
||
r/w/c |
should the current gps point be shown on the map |
||
r/w/c |
should the recorded trip history be shown on the map |
||
r/w/c |
Tile cache dir |
||
r/w/co |
Base directory to which friendly and auto paths are appended |
||
r/w/co |
Number of zoom-levels to upsample tiles |
||
r |
The number of tiles currently waiting to download |
||
r/w/c |
HTTP user agent or |
||
r/w/co |
Map zoom level |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class OsmGpsMap.Map(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod get_default_cache_directory()¶
- Return type:
Returns (transfer full): the default cache directory for the library, that is the base directory to which the full cache path is appended. If
OsmGpsMap.Map
:tile-cache-base
is omitted from the constructor then this value is used.
- classmethod new()¶
- Returns:
a newly created
OsmGpsMap.Map
object.- Return type:
Returns a new
OsmGpsMap.Map
object, defaults to showing data fromOpenStreetMap See the properties description for more information about construction parameters than could be passed to g_object_new()
- classmethod source_get_copyright(source)¶
- Parameters:
source (
OsmGpsMap.MapSource_t
) – aOsmGpsMap.MapSource_t
source id- Returns:
Source copyright information
- Return type:
Get copyright information for the source
New in version 1.2.0.
- classmethod source_get_friendly_name(source)¶
- Parameters:
source (
OsmGpsMap.MapSource_t
) – aOsmGpsMap.MapSource_t
source id- Returns:
Nice printable source name
- Return type:
Get friendly name for source
New in version 0.7.0.
- classmethod source_get_image_format(source)¶
- Parameters:
source (
OsmGpsMap.MapSource_t
) – aOsmGpsMap.MapSource_t
source id- Returns:
source tile image format
- Return type:
Get tile image format for the source
New in version 0.7.0.
- classmethod source_get_max_zoom(source)¶
- Parameters:
source (
OsmGpsMap.MapSource_t
) – aOsmGpsMap.MapSource_t
source id- Returns:
source maximum zoom level
- Return type:
Get maximum zoom level for the source
New in version 0.7.0.
- classmethod source_get_min_zoom(source)¶
- Parameters:
source (
OsmGpsMap.MapSource_t
) – aOsmGpsMap.MapSource_t
source id- Returns:
source minimum zoom level
- Return type:
Get minimum zoom level for the source
New in version 0.7.0.
- classmethod source_get_repo_uri(source)¶
- Parameters:
source (
OsmGpsMap.MapSource_t
) – aOsmGpsMap.MapSource_t
source id- Returns:
Source repo URI
- Return type:
Get repository URI address for the source
New in version 0.7.0.
- classmethod source_is_valid(source)¶
- Parameters:
source (
OsmGpsMap.MapSource_t
) – aOsmGpsMap.MapSource_t
source id- Returns:
Validity of the source (whether repo uri is not null)
- Return type:
Check whether source is considered valid
New in version 0.7.0.
- convert_geographic_to_screen(pt)¶
- Parameters:
pt (
OsmGpsMap.MapPoint
) – location- Returns:
- pixel_x:
pixel location on map, x axis
- pixel_y:
pixel location on map, y axis
- Return type:
Convert the given location on the globe to the corresponding pixel locations on the map.
New in version 0.7.0.
- convert_screen_to_geographic(pixel_x, pixel_y)¶
- Parameters:
- Returns:
location
- Return type:
Convert the given pixel location on the map into corresponding location on the globe
New in version 0.7.0.
- download_cancel_all()¶
Cancels all tiles currently being downloaded. Typically used if you wish to cacel a large number of tiles queued using
OsmGpsMap.Map.download_maps
()New in version 0.7.0.
- download_maps(pt1, pt2, zoom_start, zoom_end)¶
- Parameters:
pt1 (
OsmGpsMap.MapPoint
) – nort west cornerpt2 (
OsmGpsMap.MapPoint
) – south east cornerzoom_start (
int
) – start of zoom rangezoom_end (
int
) – end of zoom range
Downloads all tiles over the supplied zoom range in the rectangular region specified by pt1 (north west corner) to pt2 (south east corner)
- get_bbox()¶
- Returns:
- pt1:
point to be filled with the top left location
- pt2:
point to be filled with the bottom right location
- Return type:
(pt1:
OsmGpsMap.MapPoint
, pt2:OsmGpsMap.MapPoint
)
Returns the geographic locations of the bounding box describing the contents of the current window, i.e the top left and bottom right corners.
- get_event_location(event)¶
- Parameters:
event (
Gdk.EventButton
) – A #GtkEventButton that occured on the map- Returns:
The point on the globe corresponding to the click
- Return type:
A convenience function for getting the geographic location of events, such as mouse clicks, on the map
Free returned point with
GLib.free
New in version 0.7.0.
- get_scale()¶
- Returns:
the scale of the map at the center, in meters/pixel.
- Return type:
Get the scale of the map at the center, in meters/pixel.
- gps_add(latitude, longitude, heading)¶
- Parameters:
latitude (
float
) – latitude in degreeslongitude (
float
) – longitude in degreesheading (
float
) – GPS degrees orOsmGpsMap.MAP_INVALID
to disable showing heading
Set current GPS point to given lat/lon point with given heading. If record-trip-history is set, add point to trip history
New in version 0.7.0.
- gps_clear()¶
Clear GPS track history
New in version 0.7.0.
- gps_get_track()¶
- Returns:
The
OsmGpsMap.MapTrack
of the internal GPS track, i.e. that which is modified when callingOsmGpsMap.Map.gps_add
(). You must not free this.- Return type:
Get internal GPS track history
New in version 0.7.0.
- image_add(latitude, longitude, image)¶
- Parameters:
latitude (
float
) – latitude in degreeslongitude (
float
) – longitude in degreesimage (
GdkPixbuf.Pixbuf
) – Image pixbuf
- Returns:
A
OsmGpsMap.MapImage
representing the added pixbuf- Return type:
Creates OsmGpsMapImage with given params and adds it to map images
New in version 0.7.0.
- image_add_with_alignment(latitude, longitude, image, xalign, yalign)¶
- Parameters:
latitude (
float
) – latitude in degreeslongitude (
float
) – longitude in degreesimage (
GdkPixbuf.Pixbuf
) – Image pixbufxalign (
float
) – x-align of imageyalign (
float
) – y-align of image
- Returns:
A
OsmGpsMap.MapImage
representing the added pixbuf- Return type:
Creates OsmGpsMapImage with given params and adds it to map images
New in version 0.7.0.
- image_add_with_alignment_z(latitude, longitude, image, xalign, yalign, zorder)¶
- Parameters:
- Returns:
A
OsmGpsMap.MapImage
representing the added pixbuf- Return type:
Creates OsmGpsMapImage with given params and adds it to map images
New in version 0.7.4.
- image_add_z(latitude, longitude, image, zorder)¶
- Parameters:
latitude (
float
) – latitude in degreeslongitude (
float
) – longitude in degreesimage (
GdkPixbuf.Pixbuf
) – Image pixbufzorder (
int
) – z-order of image
- Returns:
A
OsmGpsMap.MapImage
representing the added pixbuf- Return type:
Creates OsmGpsMapImage with given params and adds it to map images
New in version 0.7.4.
- image_remove(image)¶
- Parameters:
image (
OsmGpsMap.MapImage
) – a OsmGpsMapImage to remove- Returns:
true if image was on list of images
- Return type:
Remove image from list of images
New in version 0.7.0.
- image_remove_all()¶
Remove all images from map
New in version 0.7.0.
- layer_add(layer)¶
- Parameters:
layer (
OsmGpsMap.MapLayer
) – aOsmGpsMap.MapLayer
object
Add layer to map
New in version 0.7.0.
- layer_remove(layer)¶
- Parameters:
layer (
OsmGpsMap.MapLayer
) – aOsmGpsMap.MapLayer
object- Returns:
whether layer was found and removed
- Return type:
Remove layer from map
New in version 0.7.0.
- layer_remove_all()¶
Remove all layers from map
New in version 0.7.0.
- map_redraw_idle()¶
- polygon_add(poly)¶
- Parameters:
poly (
OsmGpsMap.MapPolygon
) –
- polygon_remove(poly)¶
- Parameters:
poly (
OsmGpsMap.MapPolygon
) –- Return type:
- polygon_remove_all()¶
- scroll(dx, dy)¶
- Parameters:
Scrolls the map by dx, dy pixels (positive north, east)
- set_center(latitude, longitude)¶
-
Set map center, does not change zoom level
- set_center_and_zoom(latitude, longitude, zoom)¶
- Parameters:
Set map center and desired zoom level
New in version 0.7.0.
- set_keyboard_shortcut(key, keyval)¶
- Parameters:
key (
OsmGpsMap.MapKey_t
) – aOsmGpsMap.MapKey_t
keyval (
int
) – a keyval to bind
Associates a keyboard shortcut with the supplied keyval (as returned by
Gdk.keyval_from_name
or simiar). The action given in key will be triggered when the corresponding keyval is pressed. By default no keyboard shortcuts are associated.
- set_zoom(zoom)¶
-
Set map zoom to the desired zoom level
- track_add(track)¶
- Parameters:
track (
OsmGpsMap.MapTrack
) – a OsmGpsMapTrack object
Add a track to map
New in version 0.7.0.
- track_remove(track)¶
- Parameters:
track (
OsmGpsMap.MapTrack
) – aOsmGpsMap.MapTrack
object- Return type:
Remove given track from map
New in version 0.7.0.
- track_remove_all()¶
Remove all tracks
New in version 0.7.0.
- zoom_fit_bbox(latitude1, latitude2, longitude1, longitude2)¶
- Parameters:
Zoom and center the map so that both points fit inside the window.
New in version 1.1.0.
- do_draw_gps_point(cr) virtual¶
- Parameters:
cr (
cairo.Context
) –
Signal Details¶
- OsmGpsMap.Map.signals.changed(map)¶
- Signal Name:
changed
- Flags:
- Parameters:
map (
OsmGpsMap.Map
) – The object which received the signal
The
OsmGpsMap.Map
::changed
signal is emitted any time the map zoom or map center is chaged (such as by dragging or zooming).If you are only interested in the map zoom, then you can simply connect to
::notify
::zoom
Property Details¶
- OsmGpsMap.Map.props.auto_center¶
-
map auto center
- OsmGpsMap.Map.props.auto_center_threshold¶
-
the amount of the window the gps point must move before auto centering
- OsmGpsMap.Map.props.auto_download¶
-
map auto download
- OsmGpsMap.Map.props.drag_limit¶
- Name:
drag-limit
- Type:
- Default Value:
10
- Flags:
The number of pixels the user has to move the pointer in order to start dragging
- OsmGpsMap.Map.props.gps_track_highlight_radius¶
-
The radius of the gps point highlight circle
- OsmGpsMap.Map.props.gps_track_point_radius¶
-
The radius of the gps point inner circle
- OsmGpsMap.Map.props.gps_track_width¶
-
The width of the lines drawn for the gps track
- OsmGpsMap.Map.props.image_format¶
- Name:
image-format
- Type:
- Default Value:
'png'
- Flags:
The map source tile repository image format (jpg, png)
- OsmGpsMap.Map.props.latitude¶
-
Latitude in degrees
- OsmGpsMap.Map.props.longitude¶
-
Longitude in degrees
- OsmGpsMap.Map.props.map_source¶
-
A
OsmGpsMap.MapSource_t
representing the tile repository to useIf you do not wish to use the default map tiles (provided by OpenStreeMap) it is recommened that you set this property at construction, instead of setting
OsmGpsMap.Map
:repo-uri
.
- OsmGpsMap.Map.props.map_x¶
- Name:
map-x
- Type:
- Default Value:
890
- Flags:
Initial map x location
- OsmGpsMap.Map.props.map_y¶
- Name:
map-y
- Type:
- Default Value:
515
- Flags:
Initial map y location
- OsmGpsMap.Map.props.max_zoom¶
- Name:
max-zoom
- Type:
- Default Value:
20
- Flags:
Maximum zoom level
- OsmGpsMap.Map.props.min_zoom¶
- Name:
min-zoom
- Type:
- Default Value:
1
- Flags:
Minimum zoom level
- OsmGpsMap.Map.props.record_trip_history¶
-
should all gps points be recorded in a trip history
- OsmGpsMap.Map.props.repo_uri¶
- Name:
repo-uri
- Type:
- Default Value:
'https://tile.openstreetmap.org/#Z/#X/#Y.png'
- Flags:
A URI string which defines the location and format to fetch tiles for the map. The string is of the format “http://tile.openstreetmap.org/#Z/#X/#Y.png”. Characters that begin with # are treated as tokens and replaced according to the following rules;
<itemizedlist> <listitem> <para> \#X - X-tile, slippy map format </para> </listitem> <listitem> <para> \#Y - Y-tile, slippy map format, mercator projection </para> </listitem> <listitem> <para> \#Z - Zoom level, where min_zoom >= zoom <= max_zoom </para> </listitem> <listitem> <para> \#S - Zoom level, where -max_zoom >= (zoom-max_zoom) <= min_zoom </para> </listitem> <listitem> <para> \#Q - Quad tree format, set of “qrts” </para> </listitem> <listitem> <para> \#Q0 - Quad tree format, set of “0123” </para> </listitem> <listitem> <para> \#YS - Not Implemented </para> </listitem> <listitem> <para> \#R - Random integer in range [0,4] </para> </listitem> </itemizedlist>
<note> <para> If you do not wish to use the default map tiles (provided by OpenStreeMap) it is recommened that you use one of the predefined map sources, and thus you should construct the map by setting
OsmGpsMap.Map
:map-source
and notOsmGpsMap.Map
:repo-uri
. TheOsmGpsMap.Map
:repo-uri
property is primarily designed for applications that wish complete control of tile repository management, or wish to useOsmGpsMap.Map
with a tile repository it does not explicitly support. </para> </note>
- OsmGpsMap.Map.props.show_gps_point¶
-
Controls whether the current gps point is shown on the map. Note that for derived classes that implement the draw_gps_point vfunc, if this property is
False
- OsmGpsMap.Map.props.show_trip_history¶
-
should the recorded trip history be shown on the map
- OsmGpsMap.Map.props.tile_cache¶
-
Either a full path or one of the special format URIs
OsmGpsMap.MAP_CACHE_DISABLED
,OsmGpsMap.MAP_CACHE_AUTO
,OsmGpsMap.MAP_CACHE_FRIENDLY
. Also seeOsmGpsMap.Map
:tile-cache-base
for a full understanding.OsmGpsMap.MAP_CACHE_DISABLED
disables the on disk tile cache (so all tiles are fetched from the network.OsmGpsMap.MAP_CACHE_AUTO
causes the tile cache to be /tile-cache-base/md5(repo-uri), where md5 is the md5sum ofOsmGpsMap.Map
:repo-uri
.OsmGpsMap.MAP_CACHE_FRIENDLY
causes the tile cache to be /tile-cache-base/friendlyname(repo-uri).Any other string is interpreted as a local path, i.e. /path/to/cache
- OsmGpsMap.Map.props.tile_cache_base¶
- Name:
tile-cache-base
- Type:
- Default Value:
- Flags:
The base directory of the tile cache when you have constructed the map with
OsmGpsMap.Map
:tile-cache
set toOsmGpsMap.MAP_CACHE_AUTO
orOsmGpsMap.MAP_CACHE_FRIENDLY
The string is interpreted as a local path, i.e. /path/to/cache. If
None
is supplied, map tiles are cached starting in the users cache directory, (as outlined in theXDG Base Directory Specification). To get the base directory where map tiles will be cached call
OsmGpsMap.Map.get_default_cache_directory
()
- OsmGpsMap.Map.props.tile_zoom_offset¶
- Name:
tile-zoom-offset
- Type:
- Default Value:
0
- Flags:
Number of zoom-levels to upsample tiles
- OsmGpsMap.Map.props.tiles_queued¶
-
The number of tiles currently waiting to download. Connect to
::notify
::tiles-queued
if you want to be informed when this changes
- OsmGpsMap.Map.props.user_agent¶
-
The default user-agent for downloading tiles from the
OsmGpsMap.Map
:map-source
is “libosmgpsmap/VERSION”. The value ofOsmGpsMap.Map
:user-agent
will be appended to it.New in version 1.2.0.
- OsmGpsMap.Map.props.zoom¶
- Name:
zoom
- Type:
- Default Value:
3
- Flags:
The map zoom level. Connect to
::notify
::zoom
if you want to be informed when this changes.