-> How to assign primary and secondary territories to vehicles

Our service supports the assignment of vehicles to territories. A vehicle only handles orders in the designated territories. A territory consists of at least one postal code and can have several vehicles which are assigned to it.

Before a vehicle-territory relation can be created the territory needs to be defined first. This can be done via our webinterface in the Territory Editor manually or via our API.

A vehicle can have one or more primary and also one or more secondary territories. The primary territory is the main area where the vehicle operates. Therefore a vehicle will only handle shipments in the secondary territory when all shipments which can be fulfilled in the primary territory have been delivered or picked up and the vehicle has capacity and driving time left.
Please note:
A territory can either be assigned as a primary or as a secondary territory for each vehicle.
In other words a territory can not be assigned as primary and secondary territory for the same vehicle.
But a territory can be assigned as primary and secondary territory for different vehicles.

Example:

  • vehicle_A
    • primary territory: territory_1
    • secondary territory: territory_2
  • vehicle_B
    • primary territory: territory_2
    • secondary territory: territory_1

There are several ways to assign territories to vehicles…

…if the fleet is handled in the Smartlane system:

  1. Use the vehicle editor in the webinterface


  1. Use the API and assign the territory when creating the vehicle or PATCH an existing vehicle
{
      "obeys_territory_mapping": true,
      "territory_custom_ids": [
        "Gebiet1"
      ],
      "secondary_territory_custom_ids": [
        "Gebiet Zentrum"
      ]
}

…if the fleet is provided in the optimization request:

Define the assigned territories for a vehicle in the vehicles section of the request. Please note that the parameter obeys_territory_mappingneeds to be set to true additionally otherwise the vehicle is allowed to go everywhere. The definition is analougus to the code snippet above. For more details and examples please check the API reference.