Toll Calculations¶
Toll Calculations computes the toll costs along the route and displays them in different currencies.
What are Toll Calculations?¶
The Toll Calculations feature calculates the toll stations and their costs along the route. It is used for budget planning and cost analysis.
Basic Usage¶
Toll Calculation in the Request Body¶
{
"origin": {"latitude": 41.0082, "longitude": 28.9784},
"destination": {"latitude": 41.0150, "longitude": 28.9850},
"tolls": true,
"currency": "TRY"
}
Toll Parameters¶
| Field | Type | Required | Description |
|---|---|---|---|
| tolls | Boolean | Optional | Toll cost calculation (default: false) |
| currency | Currency | Optional | Currency: "USD", "EUR", "TRY" |
Use Cases¶
1. Cost Analysis¶
{
"origin": {"latitude": 41.0082, "longitude": 28.9784},
"destination": {"latitude": 41.0150, "longitude": 28.9850},
"tolls": true,
"currency": "TRY"
}
2. Currency Conversion¶
{
"origin": {"latitude": 41.0082, "longitude": 28.9784},
"destination": {"latitude": 41.0150, "longitude": 28.9850},
"tolls": true,
"currency": "EUR"
}
3. Truck Route with Toll¶
{
"origin": {"latitude": 41.0082, "longitude": 28.9784},
"destination": {"latitude": 41.0150, "longitude": 28.9850},
"vehicle": {"vehicleType": "truck"},
"tolls": true,
"currency": "USD"
}
Response Format¶
Toll Response Structure¶
{
"routes": [
{
"summary": {
"distance": 15000,
"duration": 1200,
"cost": 45.50
},
"sections": [
{
"tolls": {
"summary": {
"total": 45.50,
"currency": "TRY"
},
"tollSystems": [
{
"id": "system_1",
"name": "Kuzey Marmara Otoyolu"
}
],
"tollCosts": [
{
"tollSystem": {"id": "system_1", "name": "Kuzey Marmara Otoyolu"},
"fares": [
{
"id": "fare_1",
"name": "Class 1 Vehicle",
"price": 45.50,
"currency": "TRY",
"estimated": false,
"reason": "Standard toll rate"
}
]
}
]
}
}
]
}
]
}
Python Example¶
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},
"tolls": True,
"currency": "TRY"
}
url = f"{API_BASE_URL}/solver/route?apiKey={API_KEY}"
response = requests.post(url, json=payload)
result = response.json()
toll_cost = result['routes'][0]['summary']['cost']
print(f"Total Toll Cost: {toll_cost} TRY")
Toll Calculations — Flio.ai