Trip

Calculating tolls on stretches with varying axles

In addition to allowing tolls to be calculated on the route, the Trip API allows different types of vehicles to be specified for specific sections of the route. Ideal for routes that use different types of vehicles or for routes where vehicle axles are raised/lowered on certain sections.

In the following example, we have a route between São Paulo and Matão, which passes through different cities. The route will be made with a 4 double axle vehicle, however, one of the axles will be suspended on the stretch from Jundiaí to Rio Claro, and on the stretch from Rio Claro to São Carlos another axle will be suspended. After São Carlos, all the axles will be lowered to their final destination.

To do this, you need to add the following parameters inside toll:

  • vehicleType – Type of vehicle used during the route;
  • variableAxles – Array of objects with the specific rules for each section. Each object must contain the following parameters:
    • fromSiteId – String with the ID of the starting point where the new rule should be applied;
    • toSiteId – String with the ID of the end point of the section where the new rule is to be applied;
    • newVehicleType – New type of vehicle to be considered for the stretch in question.

The points referenced in fromSiteId and toSiteId must be listed in the points parameter and must have the same name used in siteId. At vehicleType and newVehicleType, the following values are possible:

  • MOTORCYCLE
  • CAR
  • CAR_WITH_THREE_SIMPLE_AXLES
  • CAR_WITH_FOUR_SIMPLE_AXLES
  • BUS_WITH_TWO_DOUBLE_AXLES
  • BUS_WITH_THREE_DOUBLE_AXLES
  • BUS_WITH_FOUR_DOUBLE_AXLES
  • BUS_WITH_FIVE_DOUBLE_AXLES
  • TRUCK_WITH_TWO_SINGLE_AXIS
  • TRUCK_WITH_TWO_DOUBLE_AXLES
  • TRUCK_WITH_THREE_DOUBLE_AXLES
  • TRUCK_WITH_FOUR_DOUBLE_AXLES
  • TRUCK_WITH_FIVE_DOUBLE_AXLES
  • TRUCK_WITH_SIX_DOUBLE_AXLES
  • TRUCK_WITH_SEVEN_DOUBLE_AXLES
  • TRUCK_WITH_EIGHT_DOUBLE_AXLES
  • TRUCK_WITH_NINE_DOUBLE_AXLES
  • TRUCK_WITH_TEN_DOUBLE_AXLES

Below is a complete example of what the request would look like for the route between São Paulo and Matão detailed above:

{
    "calculationMode": "THE_FASTEST",
    "points": [
        {
            "latitude": -23.555771,
            "longitude": -46.639557,
            "siteId": "SP"
        },
        {
            "latitude": -23.18567,
            "longitude": -46.88926,
            "siteId": "JUNDIAI"
        },
        {
            "latitude": -22.905082,
            "longitude": -47.061333,
            "siteId": "CAMPINAS"
        },
        {
            "latitude": -22.410765,
            "longitude": -47.559621,
            "siteId": "RIO CLARO"
        },
        {
            "latitude": -22.017056,
            "longitude": -47.889687,
            "siteId": "SÃO CARLOS"
        },
        {
            "latitude": -21.779084,
            "longitude": -48.179264,
            "siteId": "ARARAQUARA"
        },
        {
            "latitude": -21.605827,
            "longitude": -48.362041,
            "siteId": "MATÃO"
        }
    ],
    "toll": {
        "vehicleType": "TRUCK_WITH_FOUR_DOUBLE_AXLES",
        "variableAxles": [
            {
                "fromSiteId": "JUNDIAI",
                "toSiteId": "RIO CLARO",
                "newVehicleType": "TRUCK_WITH_THREE_DOUBLE_AXLES"
            },
            {
                "fromSiteId": "RIO CLARO",
                "toSiteId": "SÃO CARLOS",
                "newVehicleType": "TRUCK_WITH_TWO_DOUBLE_AXLES"
            }
        ]
    }
}