• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

  • Integrations

Configure pickups and deliveries

Introduction

Try Example

We will walk through the critical parameters relevant to this use case.

The location object

  1. 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.

  2. "Location": "51.388997,-0.119022 | 51.391915,-0.103666 | 51.369777,-0.10438 | 51.365014,-0.105654 | 51.351818,-0.014773"

    location51.388997,-0.11902251.391915,-0.10366651.369777,-0.1043851.365014,-0.10565451.351818,-0.014773
    Index01234
  3. 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 "jobs":[
      {
         "id":1963406,
         "location_index":0,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ],
         "pickup": [2,1]
      },
      {
         "id":1966875,
         "location_index":1,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ],
         "delivery": [2,1]
      },
  • 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  "vehicles":[
      {
         "id":1,
         "start_index":8,
         "end_index":8,
         "capacity":[
            8, 8
         ],
         "time_window":[
            1662017413,
            1662046213
         ]
      }
   ]
  • 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
   "jobs":[
      {
         "id":1963406,
         "location_index":0,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ],
         "pickup": [2,1]
      },
      {
         "id":1966875,
         "location_index":1,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ],
         "delivery": [2,1]
      },
      {
         "id":1968117,
         "location_index":2,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ]
      },
      {
         "id":1966748,
         "location_index":3,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ]
      },
      {
         "id":1968020,
         "location_index":4,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ]
      },
      {
         "id":1968195,
         "location_index":5,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ]
      },
      {
         "id":1968224,
         "location_index":6,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ]
      },
      {
         "id":1968184,
         "location_index":7,
         "service":1581,
         "time_windows":[
            [
               1662015600,
               1662051600
            ]
         ]
      }
   ],
   "locations":{
      "id":362,
      "location":"51.388997,-0.119022|51.391915,-0.103666|51.369777,-0.10438|51.365014,-0.105654|51.351818,-0.014773|51.389717,-0.108457|51.407651,-0.097479|51.333745,-0.120681|51.387792,-0.121271"
   },
   "description":"Florin E for 2022-09-01",
   "vehicles":[
      {
         "id":1,
         "start_index":8,
         "end_index":8,
         "capacity":[
            8, 8
         ],
         "time_window":[
            1662017413,
            1662046213
         ]
      }
   ]
}

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.

Optimized Stops
Stop ID
Arrival
Business
skills
Priority
Address
Travel Time(min)
Type
-
4:30 pm--
-
0
start
4
4:55 pmZemlak and Sons3,5
6050 Auto Center Dr, Buena Park...
25.5
job
2
5:25 pmKessler PLC3,4
621 E 23rd St, Long Beach CA 908...
50.1
job
4
5:46 pmDaniel PLC2,4
1901 E Lomita Blvd, Wilmington, CA...
66.2
job
5
6:01 pmKessler LLC1,5
22401 Catskill Ave, Carson,CA 907...
76.6
job