heremaps/here-location-services-python

WaypointOptions do not apply to all `via` waypoints

twslankard opened this issue · 2 comments

In order for a via point to be a "passthrough" waypoint, it must have !passThrough=true applied to it. A quick scan of the code shows that the waypoint options are not applied to each waypoint, and are only added at the very end (to the final waypoint):

if via:
lat, lng = via[0]
via_str = f"?via={lat},{lng}"
if len(via) > 1:
vias = "&".join("via=" + str(item[0]) + "," + str(item[1]) for item in via[1:])
via_str = via_str + "&" + vias
if via_place_options:
via_place_opt = ";".join(
key + "=" + str(val)
for key, val in vars(via_place_options).items()
if val is not None
)
via_str = via_str + ";" + via_place_opt
if via_waypoint_options:
via_way_opt = "!".join(
key + "=" + str(val)
for key, val in vars(via_waypoint_options).items()
if val is not None
)
via_str = via_str + "!" + via_way_opt
url += via_str

Ideally, the user should be able to specify a WayPointOptions object with each via point. This would fix the issue.

Bear with me and I can provide an example of expected versus current behavior. If possible, I will also try to submit a PR.

sackh commented

Thanks, @twslankard for raising this issue. I have fixed this issue in #11, feel free to close this issue if your expectations are met.

Thanks @sackh . So far it seems to work just fine!