Maps Module Reference
New in version 0.0.6.
Control the macOS Maps application using JXA-like syntax.
Classes:
|
A class for managing and interacting with Maps.app. |
|
A class for interacting with directions in Maps.app. |
|
A wrapper around a list of directions. |
|
A class for interacting with sidebar locations in Maps.app. |
|
A wrapper around a list of sidebar locations. |
|
A class for interacting with sidebar locations in Maps.app. |
|
A wrapper around a list of locations. |
- class PyXA.apps.Maps.XAMapsApplication(properties)[source]
Bases:
XAApplication
A class for managing and interacting with Maps.app.
See also
XAMapsSidebarLocation
,XAMapsDirection
New in version 0.0.6.
Methods:
directions_to
(destination_address[, ...])Queries for directions to the destination address, optionally starting from a source address.
drop_pin
(latitude, longitude[, name])Drops at pin at the specified coordinate.
new_tab
()Opens a new tab.
Orients the map with North facing upward.
search
(query[, latitude, longitude, exact])Searches Maps for the given query, centered at the (optional) specified location.
show_address
(address)Centers the map at the specified address.
show_coordinate
(latitude, longitude)Centers the map at the specified coordinate.
Gets a list of sidebar locations.
tabs
()Gets a list of tabs.
Toggles the sidebar.
zoom_in
()Zoom in on the currently centered location of the map.
zoom_out
()Zoom out on the currently centered location of the map.
Attributes:
Whether the sidebar is currently showing.
- directions_to(destination_address: str | XAText, source_address: str | XAText | None = None, transport_type: Literal['d', 'driving', 'w', 'walking', 'p', 'pt', 'r', 'public transit', 'transit'] | None = None)[source]
Queries for directions to the destination address, optionally starting from a source address.
If no source address is provided, the current location is used.
- Parameters:
destination_address (str) – The address to retrieve directions to
source_address (Union[str, None], optional) – The address to start the directions from, defaults to None
transport_type (Union[Literal["d", "driving", "w", "walking", "p", "pt", "r", "public transit", "transit"], None], optional) – The type of directions to retrieve, defaults to None
New in version 0.0.6.
- drop_pin(latitude: float, longitude: float, name: str | None = None)[source]
Drops at pin at the specified coordinate.
- Parameters:
latitude (float) – The latitude of the coordinate at which to drop a pin
longitude (float) – The longitude of the coordinate at which to drop a pin
name (Union[str, None], optional) – The name of the pin, defaults to None
New in version 0.0.6.
- orient_north() XAMapsApplication [source]
Orients the map with North facing upward.
New in version 0.0.6.
- search(query: str | XAText, latitude: float | None = None, longitude: float | None = None, exact: bool = True)[source]
Searches Maps for the given query, centered at the (optional) specified location.
- Parameters:
query (str) – The term to search for
latitude (Union[float, None], optional) – The latitude of the location to center the search at, defaults to None
longitude (Union[float, None], optional) – The longitude of the location to center the search at, defaults to None
exact (bool, optional) – Whether search results must be centered on the specified location versus allowing further away results, defaults to True
New in version 0.0.6.
- show_address(address: str)[source]
Centers the map at the specified address.
- Parameters:
address (str) – The address to display
New in version 0.0.6.
- show_coordinate(latitude: float, longitude: float)[source]
Centers the map at the specified coordinate.
- Parameters:
latitude (float) – The latitude of the coordinate to display
longitude (float) – The longitude of the coordinate to display
New in version 0.0.6.
- sidebar_locations() XAMapsSidebarLocationList [source]
Gets a list of sidebar locations.
- Returns:
The list of locations
- Return type:
New in version 0.0.6.
- property sidebar_showing: bool
Whether the sidebar is currently showing.
- tabs() XAMapsTabList [source]
Gets a list of tabs.
- Returns:
The list of tabs
- Return type:
New in version 0.0.6.
- zoom_in() XAMapsApplication [source]
Zoom in on the currently centered location of the map.
New in version 0.0.6.
- zoom_out() XAMapsApplication [source]
Zoom out on the currently centered location of the map.
New in version 0.0.6.
- class PyXA.apps.Maps.XAMapsDirections(properties)[source]
Bases:
XAObject
A class for interacting with directions in Maps.app.
New in version 0.0.6.
Attributes:
The ending address of the directions
The duration of the currently selected route from the source address to the destination address
Whether the currently selected route has tolls
Whether there are weather warnings along the currently selected route
The starting address of the directions
- destination_address: str
The ending address of the directions
- duration: float
The duration of the currently selected route from the source address to the destination address
- has_tolls: bool
Whether the currently selected route has tolls
- has_weather_warnings: bool
Whether there are weather warnings along the currently selected route
- source_address: str
The starting address of the directions
- class PyXA.apps.Maps.XAMapsDirectionsList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of directions.
New in version 0.0.3.
- class PyXA.apps.Maps.XAMapsSidebarLocation(properties)[source]
Bases:
XAObject
A class for interacting with sidebar locations in Maps.app.
New in version 0.0.6.
Attributes:
The description of the location element.
The name of the location.
Whether the location element is currently selected.
Methods:
- property description: str
The description of the location element.
- property name: str
The name of the location.
- property selected: bool
Whether the location element is currently selected.
- class PyXA.apps.Maps.XAMapsSidebarLocationList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of sidebar locations.
New in version 0.0.3.
Methods:
name
()
- class PyXA.apps.Maps.XAMapsTab(properties)[source]
Bases:
XASystemEventsUIElement
A class for interacting with sidebar locations in Maps.app.
New in version 0.0.6.
Methods:
close
()Attributes:
All properties of the tab.
- property properties: dict
All properties of the tab.