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 direction in path item as specified in https://doc.navitia.io/#path-item #4174

Open
yfe404 opened this issue Nov 25, 2023 · 0 comments
Open

Comments

@yfe404
Copy link

yfe404 commented Nov 25, 2023

path_item = section.street_network.path_items.add()

path.direction = andyamo_instruction.get("type", 0)

# Check if path.direction is an int or can be cast to an int
try:
    # Attempt to cast to an int
    path.direction = int(path.direction)
except (ValueError, TypeError):
    # If casting fails, default to 0
    path.direction = 0


# Valhalla format: https://valhalla.github.io/valhalla/api/turn-by-turn/api-reference/#trip-legs-and-maneuvers
if path.direction == 10:  ## means right turn as defined in Valhalla (See link above)
    path.direction = 90 
elif path.direction == 15: ## means left turn as defined in Valhalla (See link above)
    path.direction = -90 
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

No branches or pull requests

1 participant