Skip to content

Add direction in path item as specified in https://doc.navitia.io/#path-item #4174

@yfe404

Description

@yfe404

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 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions