Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add alternates to valhalla #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nilsnolde
Copy link
Member

Didn't do a test. I'd wait for #85 to be merged and do a live test.

@nilsnolde
Copy link
Member Author

I actually think we need some general re-write of all of this.. We've been patching a lot of shit in the past 12 months, like the static functions so we can use its logic outside of routingpy. All the typing is really off. Now I saw we're generally returning a Direction object, unless it's with alternatives, then we return a Directions (plural) object. That's really stupid haha. We can collect some ideas about v2.

factor = 0.621371 if units == "mi" else 1
distance += int(leg["summary"]["length"] * 1000 * factor)
def parse_direction_json(response, units, alternatives):
routes = response["alternates"] + [response] if alternatives else [response]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, this needs to be the normal route first as that's the lowest cost

@nilsnolde
Copy link
Member Author

I was just very surprised by the weird conflicts, turns out you accidentally approved the wrong pull request 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants