Skip to content

Commit 862a7cf

Browse files
authored
Get more OTP itinerary info + fix wrong coords order (#113)
1 parent a008971 commit 862a7cf

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

routingpy/routers/google.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,8 @@ def parse_direction_json(response, alternatives):
369369
duration += leg["duration"]["value"]
370370
distance += leg["distance"]["value"]
371371
for step in leg["steps"]:
372-
geometry.extend(
373-
[
374-
list(reversed(coords))
375-
for coords in utils.decode_polyline5(step["polyline"]["points"])
376-
]
377-
)
372+
geometry.extend(utils.decode_polyline5(step["polyline"]["points"]))
373+
378374
return Direction(geometry=geometry, duration=duration, distance=distance, raw=response)
379375

380376
def isochrones(self): # pragma: no cover

routingpy/routers/opentripplanner_v2.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class OpenTripPlannerV2:
3232

3333
def __init__(
3434
self,
35-
api_key: Optional[str] = None,
3635
base_url: Optional[str] = _DEFAULT_BASE_URL,
3736
user_agent: Optional[str] = None,
3837
timeout: Optional[int] = DEFAULT,
@@ -45,8 +44,6 @@ def __init__(
4544
"""
4645
Initializes an OpenTripPlannerV2 client.
4746
48-
:param api_key: NOT USED, only for compatibility with other providers.
49-
5047
:param base_url: The base URL for the request. Defaults to localhost. Should not have a
5148
trailing slash.
5249
:type base_url: str
@@ -148,9 +145,14 @@ def directions(
148145
) {{
149146
itineraries {{
150147
duration
148+
startTime
149+
endTime
151150
legs {{
151+
startTime
152+
endTime
152153
duration
153154
distance
155+
mode
154156
legGeometry {{
155157
points
156158
}}
@@ -195,7 +197,7 @@ def _parse_legs(self, legs):
195197
geometry = []
196198
for leg in legs:
197199
points = utils.decode_polyline5(leg["legGeometry"]["points"])
198-
geometry.extend(points)
200+
geometry.extend(list(reversed(points)))
199201
distance += int(leg["distance"])
200202

201203
return geometry, distance
@@ -283,13 +285,13 @@ def raster(
283285
use. Default: "WALK,TRANSIT"
284286
:type profile: str
285287
286-
:time: Departure date and time. The default value is now.
288+
:time: Departure date and time (timezone aware). The default value is now (UTC).
287289
:type time: datetime.datetime
288290
289291
:cutoff: The maximum travel duration in seconds. The default value is one hour.
290292
291-
:arrive_by: Whether the itinerary should depart at the specified time (False), or arrive to
292-
the destination at the specified time (True). Default value: False.
293+
:arrive_by: Set to False when searching from the location and True when searching to the
294+
location. Default value: False.
293295
:type arrive_by: bool
294296
295297
:param dry_run: Print URL and parameters without sending the request.

0 commit comments

Comments
 (0)