Skip to content

Directions (Turn-by-Turn)

The Directions feature provides turn-by-turn navigation instructions along the route.


What are Directions?

Directions provide step-by-step navigation instructions for drivers. They include detailed information for each maneuver.


Basic Usage

Query Parameter: direction

Use the direction query parameter to specify the route geometry format:

Value Description
geocode [lat, lon] coordinate array for each action
polyline String in Google Encoded Polyline format
(not specified) directions field is returned as null

Request Example

curl -X POST "https://api.flio.ai/solver/route?apiKey=YOUR-API-KEY&direction=geocode" \
  -H "Content-Type: application/json" \
  -d '{
    "origin": {"latitude": 41.0082, "longitude": 28.9784},
    "destination": {"latitude": 41.0150, "longitude": 28.9850}
  }'

Response Format

RouteSectionActionModel

The following information is returned for each maneuver:

Field Type Description
action ManeuverAction Maneuver type
direction ManeuverDirection Turn direction
severity ManeuverSeverity Maneuver difficulty level
instruction String Human-readable instruction
offset Integer Distance from the start of the section (m)
duration Integer Duration of this maneuver (seconds)
length Integer Length of this maneuver (meters)

ManeuverAction Enum

Action Description
depart Departing from the start point
arrive Arriving at the destination
continue Continuing on the road
turn Turn
ramp Entering/exiting a ramp
exit Exit
roundaboutEnter Entering a roundabout
roundaboutExit Exiting a roundabout
roundaboutPass Passing through a roundabout
uTurn U-turn
keep Lane keeping
enterHighway Entering a highway
continueHighway Continuing on a highway
board Boarding a ferry
charging Charging station
chargingSetup Charging preparation

ManeuverDirection Enum

Direction Description
left Left
right Right
middle Straight/center

ManeuverSeverity Enum

Severity Description
light Gentle turn
quite Quite gentle
heavy Sharp
quiteNormal Quite normal
normal Normal
quiteDifficult Quite difficult
difficult Difficult

NOTE: Severity values indicate the difficulty of the turn.


Use Cases

1. Navigation Application

import requests

API_BASE_URL = "https://api.flio.ai"
API_KEY = "YOUR-API-KEY"

payload = {
    "origin": {"latitude": 41.0082, "longitude": 28.9784},
    "destination": {"latitude": 41.0150, "longitude": 28.9850}
}

url = f"{API_BASE_URL}/solver/route?apiKey={API_KEY}&direction=geocode"
response = requests.post(url, json=payload)
result = response.json()

# Turn-by-turn instructions
for section in result['routes'][0]['sections']:
    for action in section.get('actions', []):
        print(f"{action['instruction']}")

2. Map Integration

The polyline format is ideal for use with map libraries:

curl -X POST "https://api.flio.ai/solver/route?apiKey=YOUR-API-KEY&direction=polyline" \
  -H "Content-Type: application/json" \
  -d '{...}'

Example Response

{
  "routes": [
    {
      "sections": [
        {
          "actions": [
            {
              "action": "depart",
              "direction": "middle",
              "severity": "normal",
              "instruction": "Start from Sultanahmet Meydanı",
              "offset": 0,
              "duration": 0,
              "length": 0
            },
            {
              "action": "turn",
              "direction": "right",
              "severity": "light",
              "instruction": "Turn right",
              "offset": 150,
              "duration": 30,
              "length": 200
            },
            {
              "action": "arrive",
              "direction": "middle",
              "severity": "normal",
              "instruction": "You have arrived at Taksim Meydanı",
              "offset": 5000,
              "duration": 600,
              "length": 5000
            }
          ],
          "directions": [[41.0082, 28.9784], [41.0090, 28.9790], ...]
        }
      ]
    }
  ]
}

Directions (Turn-by-Turn) — Flio.ai

Next Steps