Toll

Example 4 – Tolls with hourly rates

Some toll plazas, especially in Argentina and Chile, have prices that vary according to the day, time or season of the year the route is being traveled.

In Argentina, for example, concessionaires have special rates for peak times, weekends and public holidays, or specific times of the year such as low season and high season.

Below is the tariff table for Argentina’s AUSA concessionaire, which offers two types of tariff, one for regular hours and one for peak hours.

In Brazil, this type of tariff is rarer, but some concessionaires already charge different values on weekends and public holidays

In this example we have a route with a 4-axle truck that will pass through the Sarmiento gantry in Argentina. According to the table above, this gantry has conditioning values for peak hours. Below is the full request:

{
  "calculationMode": "THE_FASTEST",
  "points": [
    {
      "latitude": -34.566702,
      "longitude": -58.406596,
      "siteId": "p1"
    },
    {
      "latitude": -34.566436,
      "longitude": -58.408582,
      "siteId": "p2"
    }
  ],
  "toll": {
    "vehicleType": "TRUCK_WITH_FOUR_DOUBLE_AXLES"
  }
}

The result can be seen on the map below:

The response will come in JSON format.

As in the previous examples, tollCosts shows the total values of tolls on the entire route. In each object returned in legs, an object tollCalculation will be returned containing an object tolls with the values and information of each toll on the corresponding stretch, and legTotalCost which shows the total value of tolls on that stretch. The field vehicleType will also be returned, indicating the vehicle used on that stretch.

Inside each object at tolls we will have the information for each toll. With the following differences:

  • price – Normal toll in local currency, charged at off-peak times or any other condition;
  • conditions – Array with all the toll’s conditional values. It tells you if there are price variations due to any conditions such as the day of the week, the time of day and whether it is done with automatic or manual payment. In the case of this example, we have the following information:
    • daysOfWeek – Array with the days of the week to which the rate applies. The possible values are: [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY]
    • subConditions – Indicates subconditions for the day of the week to which the tariff applies;
      • periods – Array with the periods in which the rate applies on the day of the week. In this example, there is the period "NORMAL" and the period "HOLIDAY". The possible values are: [NORMAL, HOLIDAY, LOW_SEASON, HIGH_SEASON].
      • timesWindow – Array with the time intervals in["HH:mm:ss = HH:mm:ss"] format.
      • billingsType – Type of toll collection. Possible values: [NORMAL, TAG];
      • value – Toll value in local currency.

The full response can be found below:

{
    "id": "658084734d0aa15a056e8f31",
    "clientId": "maplink",
    "totalDistance": 327,
    "totalNominalDuration": 31,
    "averageSpeed": 52.00,
    "tollCosts": 508.03,
    "legs": [
        {
            "distance": 327,
            "nominalDuration": 31,
            "averageSpeed": 52.0,
            "points": "zh~qEfpncJJ]HM\\Q\\C^LRTJb@@RAVOj@?XS\\aDvF",
            "tollCalculation": {
                "tolls": [
                    {
                        "id": "1032",
                        "name": "Pórtico - Sarmiento",
                        "address": "Avenida Sarmiento, 4254",
                        "city": " ",
                        "state": {
                            "name": "Ciudad Autonoma de Buenos Aires",
                            "code": "Ciudad Autonoma de Buenos Aires"
                        },
                        "country": "Argentina",
                        "concession": "Ausa",
                        "direction": "WEST",
                        "coordinates": {
                            "latitude": -34.5671991,
                            "longitude": -58.4063059
                        },
                        "serviceTypes": [],
                        "price": 508.03,
                        "conditions": [
                            {
                                "daysOfWeek": [
                                    "MONDAY",
                                    "TUESDAY",
                                    "WEDNESDAY",
                                    "THURSDAY",
                                    "FRIDAY"
                                ],
                                "subConditions": [
                                    {
                                        "periods": [
                                            "NORMAL"
                                        ],
                                        "subConditions": [
                                            {
                                                "timesWindow": [
                                                    "16:00:00 - 19:59:59",
                                                    "07:00:00 - 10:59:59"
                                                ],
                                                "subConditions": [
                                                    {
                                                        "billingsType": [
                                                            "NORMAL"
                                                        ],
                                                        "value": 1221.56
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "daysOfWeek": [
                                    "SUNDAY",
                                    "SATURDAY"
                                ],
                                "subConditions": [
                                    {
                                        "periods": [
                                            "NORMAL"
                                        ],
                                        "subConditions": [
                                            {
                                                "timesWindow": [
                                                    "17:00:00 - 20:59:59"
                                                ],
                                                "subConditions": [
                                                    {
                                                        "billingsType": [
                                                            "NORMAL"
                                                        ],
                                                        "value": 1221.56
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "daysOfWeek": [
                                    "MONDAY",
                                    "TUESDAY",
                                    "WEDNESDAY",
                                    "THURSDAY",
                                    "FRIDAY",
                                    "SUNDAY",
                                    "SATURDAY"
                                ],
                                "subConditions": [
                                    {
                                        "periods": [
                                            "HOLIDAY"
                                        ],
                                        "subConditions": [
                                            {
                                                "timesWindow": [
                                                    "17:00:00 - 20:59:59"
                                                ],
                                                "subConditions": [
                                                    {
                                                        "billingsType": [
                                                            "NORMAL"
                                                        ],
                                                        "value": 1221.56
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "legTotalCost": 508.03,
                "vehicleType": "TRUCK_WITH_FOUR_DOUBLE_AXLES"
            }
        }
    ],
    "source": "MAPLINK"
}