Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion olamaps/routing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Literal


def directions(
Expand All @@ -8,6 +8,7 @@ def directions(
waypoints: Optional[list[str]] = None,
alternatives: Optional[bool] = None,
steps: Optional[bool] = None,
overview: Optional[Literal['full', 'simplified', 'false']] = 'full'
) -> list:
"""
Provides routable path between two or more points. Accepts coordinates in lat,long format.
Expand All @@ -17,6 +18,7 @@ def directions(
:param waypoints: List of coordinates in lat,lng format
:param alternatives: Whether or not to provide multiple routes
:param steps: Whether or not to provide steps for the route
:param overview: Overview geometry either full, simplified or false
"""

assert len(origin), "Invalid origin coordinates provided."
Expand All @@ -32,6 +34,9 @@ def directions(
params["alternatives"] = str(alternatives).lower()
if steps:
params["steps"] = str(steps).lower()
if overview:
params["overview"] = overview


response = self._request(
"POST",
Expand All @@ -49,6 +54,7 @@ async def async_directions(
waypoints: Optional[list[str]] = None,
alternatives: Optional[bool] = None,
steps: Optional[bool] = None,
overview: Optional[Literal['full', 'simplified', 'false']] = 'full'
) -> list:
"""
Provides routable path between two or more points. Accepts coordinates in lat,long format.
Expand All @@ -58,6 +64,7 @@ async def async_directions(
:param waypoints: List of coordinates in lat,lng format
:param alternatives: Whether or not to provide multiple routes
:param steps: Whether or not to provide steps for the route
:param overview: Overview geometry either full, simplified or false
"""

assert len(origin), "Invalid origin coordinates provided."
Expand All @@ -73,6 +80,8 @@ async def async_directions(
params["alternatives"] = str(alternatives).lower()
if steps:
params["steps"] = str(steps).lower()
if overview:
params["overview"] = overview

response = await self._request(
"POST",
Expand Down