Configure pickups and deliveries
We will walk through the critical parameters relevant to this use case.
The location object
-
The location object contains a list of coordinates in [lat,lng] format. Other properties in the request will refer to coordinates specified in the location object via their index parameter. An example of a location object can be understood in the Table.
-
"Location": "51.388997,-0.119022 | 51.391915,-0.103666 | 51.369777,-0.10438 | 51.365014,-0.105654 | 51.351818,-0.014773"
-
So for example, if let’s say in the vehicle's property, the start_index is 2, then the starting coordinate for that vehicle is 51.369777,-0.10438 as per the above table.
Jobs object: service, time_windows, pickup, delivery
-
service: Indicates how much time will be spent operating for a job. Here, for every job, we need to spend 1581 seconds there working
-
time_windows: Indicates the period that a job needs to be finished in. The value type used is the UNIX timestamp. Here, every job needs to be finished in the time period of 1662015600 [GMT: Thursday, September 1, 2022, 7:00:00 AM] to 1662051600 [GMT: Thursday, September 1, 2022, 5:00:00 PM]
-
pickup: Indicates how many items need to be picked up. It is a multidimensional property in that it can represent pickup for different kinds of items. There must be a corresponding vehicle with the same dimension capacity with specified pickups. Here, we have a job that needs to pick up two kinds of items and their quantities are 2 and 1 respectively.
-
delivery: Indicates how many items need to be delivered. It is multidimensional and can represent delivery for different kinds of items. Similar to the pickup property, the vehicles must have the capacity of the same dimension specified for deliveries.
Additionally, the quantities specified in the job's delivery property will be added to the initial load of a vehicle that is going to take this job. [If you want to specify that the cargo to be delivered is to be picked up from a specified place, you should use the shipment property]. In this example, we have a job that needs to deliver two kinds of items [specified in pickup] and their quantities are 2 and 1 respectively.
vehicles: start_index, end_index, capacity, time_window
- start_index: Indicates the initial position of a vehicle. The index refers to one of the coordinates present in the "location" object. Here, we have a vehicle starting at the coordinate represented by the index 8.
- end_index: Indicates the ending position of a vehicle after finishing all the tasks assigned to it. The index refers to one of the coordinates present in the "location" object. Here, we have a vehicle ending at the coordinate represented by the index 8.
- capacity: Indicates how many passengers/cargo can be loaded. It is multidimensional and can be used to represent the capacity for different kinds of cargo. Here, the vehicle can load 8 units of a kind of passenger/cargo.
- time_window: This property defines the working time period of a vehicle. This means that this vehicle will only be able to do a job whose time_window range is within the time_window range of the vehicle.
The body of the POST method will look like the following -
Request Example
Result
What you can see above is a visual representation of the complete optimized trip in this example. The large icon marks the start and end location of the trip. The location dot marked as 1, is the first stop for this trip.