Description
The Last Mile Delivery service is a use case specific Vehicle Routing Problem (VRP) algorithm designed for a fleet of vehicles that are delivering packages to the final customers. For example, this can be used for a single distribution center or store delivering to the final customer location and can be quite dense delivering to a few customers on most streets but is not intended to visit every house on every street.
Delivery companies need to determine which orders (package delivery location) should be serviced by each route (delivery vehicle and driver) and in what sequence the orders should be visited. The primary goal is to best service the orders by producing geographically clustered routes so the drivers can easily deliver to everyone and minimize the overall operating cost for the fleet of vehicles.
The Network Analyst Route service finds the best route for a single vehicle to visit many stops whereas the Last Mile Delivery service and the Vehicle Routing Problem service both find the best routes for a fleet of vehicles to service many orders. The Vehicle Routing Problem service has lots of flexibility and can model many different constraints, but the algorithm is also limited by this flexibility. The Last Mile Delivery service supports a subset of the constraints but for the ones it does support is able to provide a better quality and performant algorithm.
How to use the service
To use last mile delivery service, you need to follow a three step workflow:
- Make the
submit
request with the appropriate request parameters to get a job id.Job - Using the job id, make periodical request to check the job status. If
job
isStatus esri
, continue to make request. If job failed, the response contains the error messages. If job succeeded, proceed to next step. If job has been executing for a while and you want to cancel it, you can appendJob Executing /cancel
to the request url to cancel the job. - Use the job id to get one or more results.
Request
POST https://logisticsbeta.arcgis.com/arcgis/rest/services/World/VehicleRoutingProblem/GPServer/SolveLastMileDelivery/submitJob HTTP/1.1
Content-Type: application/x-www-form-urlencoded
token=<ACCESS_TOKEN>
&f=json
&orders={
"features": [
{
"geometry": {
"x": -117,
"y": 34
},
"attributes": {
"Name": "Order 1",
"ServiceTime": 5,
"TimeWindowStart": null,
"TimeWindowEnd": 1706868000000,
"MaxViolationTime": 0,
"DeliveryQuantity_1": 2000,
"DeliveryQuantity_2": 100
Response (JSON)
{
"jobId": "jb1e9c0999ec047f4ac99750055041719",
"jobStatus": "esriJobSubmitted"
}
Required parameters
orders
type:featureRequired
Specifies one or more locations that the routes of the last mile delivery analysis will visit. These are the final customer locations where the routes deliver the packages, or the initial customer location where they are picking up packages for shipment.
When specifying the orders, you can set attributes for each as follows:
Show attributes for orders
Attributes for orders
-
Namestring (length: 500)
The name of the order.
The name must be unique. Order names are case sensitive and cannot be empty, even if the order is excluded from the solve operation. This attribute acts as a primary key and is used as a foreign key to refer to orders in the Orders Specialties table.
-
ServiceTimedouble (non-negative)nullable
The amount of time that will be spent at the order when the route visits it; that is, it stores the impedance value for the order location.
A zero or null value indicates that the order requires no service time. The unit for this attribute value is specified by the
time
parameter._units -
TimeWindowStartdatetimenullable
The beginning time of the time window for the order.
This attribute can contain a null value; a null value indicates no beginning time. A time window only states when a vehicle can arrive at an order; it doesn't state when the service time must be completed. To account for service time and departure before the time window ends, subtract the
Service
attribute value from theTime Time
attribute value.Window End -
TimeWindowEnddatetimenullable
The ending time of the time window for the order.
This attribute can contain a null value, which indicates no ending time.
-
MaxViolationTimedouble (non-negative)nullable
The maximum allowable violation time for the time window of the order.
A time window is considered violated if the arrival time occurs after the time window has ended. It can contain a zero value but can't contain negative values.
- A zero value indicates that a time window violation is unacceptable; that is, the time window is hard.
- A null value indicates that there is no limit on the allowable violation time.
- A non-zero value specifies the maximum amount of lateness; for example, a route can arrive at an order up to 30 minutes beyond the end of the time window.
The unit for this attribute value is specified by the
time
parameter._units -
InboundArriveTimedatetimenullable
The time when the item to be delivered to the order will be ready at the starting depot.
The order can be assigned to a route only if the inbound arrive time precedes the route's start time, as the route could not leave the depot before the item is ready to be loaded onto it. The assignment is invalid even if the route has a start-depot service time that lasts until after the inbound arrive time.
This attribute can help model scenarios involving inbound-wave transshipments. For example, a parcel or package being delivered is on an inbound flight that is scheduled to arrive and be sorted by 9:30 a.m. To ensure a route that leaves before the shipment arrives is not assigned this order, the order's inbound arrive time is set to 9:30 a.m.
-
OutboundDepartTimedatetimenullable
The time when the item to be picked up at the order must arrive at the ending depot.
The order can be assigned to a route only if the route can visit the order and reach its end depot before the specified outbound depart time. If a route reaches a depot but doesn't complete its end-depot service time before the order's outbound depart time, the order cannot be assigned to the route.
This attribute can help model scenarios involving outbound-wave transshipments. For instance, a shipping company sends out delivery trucks to pick up packages from orders and bring them into a depot where they are forwarded on to other facilities, en route to their final destination. At 3:00 p.m. every day, a semitrailer stops at the depot to pick up the high-priority packages and take them directly to a central processing station. To avoid delaying the high-priority packages until the next day's 3:00 p.m. trip, the shipping company plans to have delivery trucks pick up the high-priority packages from orders and bring them to the depot before 3:00 p.m.. This is done by setting the outbound depart time to 3:00 p.m.
-
DeliveryQuantity_1 -- DeliveryQuantity_9double (non-negative)nullable
The size of the delivery.
You can specify size in any dimension such as weight, volume, or quantity. If there are multiple delivery quantities, specify them using the
Delivery
throughQuantity _1 Delivery
fields as needed.Quantity _9 -
PickupQuantity_1 -- PickupQuantity_9double (non-negative)nullable
The size of the pickup.
You can specify size in any dimension such as weight, volume, or quantity. If there are multiple pickup quantities, specify them using the
Pickup
throughQuantity _1 Pickup
fields as needed.Quantity _9 -
AnchorRuleint enumnullabledefault:null
Allowed values:
null
,1
,2
The anchor rule for the order, which specifies whether it must be the first or last order on a route.
If it is additionally constrained to a specific route, use the
Assignment
attribute. The values are listed below:Rule null
: The order does not have an anchor constraint and can be sequenced first, last, or anywhere in between.1
: First. The order must be the first order on the route.2
: Last. The order must be the last order on the route.
-
AssignmentRuleint enumnullabledefault:null
Allowed values:
null
,1
,2
,3
This attribute specifies the rule for the order's route assignment options.
It is constrained by a domain of values, that are listed below:
null
: The solver ignores the route pre-assignment (if any) for the order during the solve operation. It assigns a route to the order so as to minimize the overall value of the objective function.1
: Preserve Route and Relative Sequence. The solver must always assign the order to the preassigned route and relative sequence during the solve operation. If this assignment rule cannot be followed, it results in an order violation. With this setting, only the relative sequence is maintained, not the absolute sequence.2
: Preserve Route. The solver must always assign the order to the preassigned route during the solve operation. If a sequence value is given it will be used for the initial construction of the route. If the order cannot be assigned to the specified route, it results in an order violation.3
: Unassign. The order will be removed from the assigned route.
-
RouteNamestring (length: 500)nullable
The name of the route to which the order is assigned.
As an input attribute, it is used to preassign an order to a specific route. It can contain a null value, indicating that the order is not preassigned to any route, and the solver determines the best possible route assignment for the order. If this is set to null, the
Sequence
attribute must also be null. TheRoute
attribute is a foreign key to theName Name
attribute in the Routes class. After a solve operation, if the order is routed, theRoute
attribute contains the name of the route that the order is assigned to.Name -
Sequenceint (non-negative)nullable
The sequence of the order on its assigned route.
As an input attribute, it is used to specify the relative sequence for an order on the route. This attribute can contain a null value indicating that the order can be placed anywhere along the route. The input sequence values must not be negative and must be unique for each route shared across depot visits and orders but do not need to start from 0 or be contiguous. After a solve operation, the Sequence attribute contains the sequence value of the order on its assigned route. Output sequence values for a route are shared across depot visits and orders. The sequences starts from 0 (at the starting depot) and are consecutive, except when sequence gaps are used. The smallest possible output sequence value for a routed order is 1, since a route always begins at a depot even if it is virtual depot.
-
CurbApproachint enumdefault:0
Allowed values:
0
,1
,2
,3
Specifies the direction a vehicle may arrive at and depart from the order. The options are as following:
0
: Either side of vehicle. The vehicle can approach and depart the order in either direction. U-turns are allowed. You should choose this setting if your vehicle can make a U-turn at the order or if it can pull into a driveway or parking lot and turn around.1
: Right side of vehicle. When the vehicle approaches and departs the order, the curb must be on the right side of the vehicle. A U-turn is prohibited.2
: Left side of vehicle. When the vehicle approaches and departs the order, the curb must be on the left side of the vehicle. A U-turn is prohibited.3
: No U-turn. When the vehicle approaches the order, the curb can be on either side of the vehicle; however, the vehicle must depart without turning around. Learn more about U-turn policies
Show illustration
Setting Coded value Description Either side of vehicle
0
The vehicle can approach and depart the order in either direction, so a U-turn is allowed at the order. This setting can be chosen if it is possible and desirable for a vehicle to turn around at the order. This decision may depend on the width of the road and the amount of traffic or whether the order has a parking lot where vehicles can pull in and turn around.
All arrival and departure combinations are allowed with the Either side of vehicle curb approach.
Right side of vehicle
1
When the vehicle approaches and departs the order, the order must be on the right side of the vehicle. A U-turn is prohibited.
The allowed arrival and departure combination is shown for the Right side of vehicle curb approach.
Left side of vehicle
2
When the vehicle approaches and departs the order, the order must be on the left side of the vehicle. A U-turn is prohibited.
The allowed arrival and departure combination is shown for the Left side of vehicle curb approach.
No U-Turn
3
When the vehicle approaches the order, the order can be on either side of the vehicle; however, when it departs, the vehicle must continue in the same direction it arrived. A U-turn is prohibited.
The allowed arrival and departure combinations are shown for the No U-Turn curb approach.
The
Curb
attribute is designed to work with both kinds of national driving standards: right-hand traffic (United States) and left-hand traffic (United Kingdom). First, consider an order on the left side of a vehicle. It is always on the left side regardless of whether the vehicle travels on the left or right half of the road. What may change with national driving standards is your decision to approach an order from one of two directions, that is, so it ends up on the right or left side of the vehicle. For example, if you want to arrive at an order and not have a lane of traffic between the vehicle and the order, choose 1 (Right side of vehicle) in the United States and 2 (Left side of vehicle) in the United Kingdom.Approach
-
Bearingint (non-negative)nullable
The direction in which a point is moving. The units are degrees and are measured clockwise from true north.
This attribute is used in conjunction with the
Bearing
attribute. Bearing data is usually sent automatically from a mobile device equipped with a GPS receiver. Try to include bearing data if you are loading an input location that is moving, such as a pedestrian or a vehicle. Using this attribute tends to prevent adding locations to the wrong edges, which can occur when a vehicle is near an intersection or an overpass, for example. Bearing also helps the solver determine the side of the street that the point is on.Tol -
BearingTolint (non-negative)default:30nullable
The bearing tolerance value creates a range of acceptable bearing values when locating moving points on an edge using the
Bearing
attribute.If the
Bearing
attribute value is within the range of acceptable values that are generated from the bearing tolerance on an edge, the point can be added as a network location there; otherwise, the closest point on the next-nearest edge is evaluated. The units are in degrees, and the default value is 30. Values must be greater than 0 and less than 180. A value of 30 means that when Network Analyst attempts to add a network location on an edge, a range of acceptable bearing values is generated 15 degrees to either side of the edge (left and right) and in both digitized directions of the edge. -
NavLatencyint (non-negative)nullable
Indicates how much cost is expected to elapse from the moment GPS information is sent from a moving vehicle to a server and the moment the processed route is received by the vehicle's navigation device.
This attribute is only used in the solve process if the
Bearing
andBearing
fields also have values; however, providing aTol Nav
attribute value is optional, even when values are present in theLatency Bearing
andBearing
.Tol
Example:
{
"features": [
{
"geometry": {
"x": -117,
"y": 34
},
"attributes": {
"Name": "Order 1",
"ServiceTime": 5,
"TimeWindowStart": null,
"TimeWindowEnd": 1706868000000,
"MaxViolationTime": 0,
"DeliveryQuantity_1": 2000,
"DeliveryQuantity_2": 100
}
},
{
"geometry": {
"x": -117.5,
depots
type:featureRequired
The depots
parameter stores the depots that are part of a given last mile delivery analysis layer. A depot is a location that a vehicle departs from at the beginning of its workday and returns to at the end of the workday. Depots are locations where the vehicles are loaded (for deliveries) or unloaded (for pickups). For the Last Mile Delivery solver, the routes must all start at the same depot location and must all end at the same depot location. However, the start and end depot locations can be different or can be modeled as virtual depot locations not explicitly specified in the problem.
When specifying the depots, you can set attributes as follows:
Show attributes for depots
Attributes for depots
-
Namestring (length: 500)
The name of the depot.
This attribute is a primary key and is used as a foreign key in the Routes feature layer and Depot Visits feature layer to refer to depots. Depot names are case sensitive and must be nonempty and unique.
-
CurbApproachint enumdefault:0
Allowed values:
0
,1
,2
,3
Specifies the direction a vehicle may arrive at and depart from the depot. The options are as following:
0
: Either side of vehicle. The vehicle can approach and depart the depot in either direction. U-turns are allowed. You should choose this setting if your vehicle can make a U-turn at the depot or if it can pull into a driveway or parking lot and turn around.1
: Right side of vehicle. When the vehicle approaches and departs the depot, the curb must be on the right side of the vehicle. A U-turn is prohibited.2
: Left side of vehicle. When the vehicle approaches and departs the depot, the curb must be on the left side of the vehicle. A U-turn is prohibited.
Show illustration
Setting Coded value Description Either side of vehicle
0
The vehicle can approach and depart the depot in either direction, so a U-turn is allowed at the depot. This setting can be chosen if it is possible and desirable for a vehicle to turn around at the depot. This decision may depend on the width of the road and the amount of traffic or whether the order has a parking lot where vehicles can pull in and turn around.
All arrival and departure combinations are allowed with the Either side of vehicle curb approach.
Right side of vehicle
1
When the vehicle approaches and departs the depot, the depot must be on the right side of the vehicle. A U-turn is prohibited.
The allowed arrival and departure combination is shown for the Right side of vehicle curb approach.
Left side of vehicle
2
When the vehicle approaches and departs the depot, the depot must be on the left side of the vehicle. A U-turn is prohibited.
The allowed arrival and departure combination is shown for the Left side of vehicle curb approach.
The
Curb
attribute is designed to work with both kinds of national driving standards: right-hand traffic (United States) and left-hand traffic (United Kingdom). First, consider an order on the left side of a vehicle. It is always on the left side regardless of whether the vehicle travels on the left or right half of the road. What may change with national driving standards is your decision to approach an order from one of two directions, that is, so it ends up on the right or left side of the vehicle. For example, if you want to arrive at an order and not have a lane of traffic between the vehicle and the order, choose 1 (Right side of vehicle) in the United States and 2 (Left side of vehicle) in the United Kingdom.Approach -
Bearingint (non-negative)nullable
The direction in which a point is moving. The units are degrees and are measured clockwise from true north.
This attribute is used in conjunction with the
Bearing
attribute. Bearing data is usually sent automatically from a mobile device equipped with a GPS receiver. Try to include bearing data if you are loading an input location that is moving, such as a pedestrian or a vehicle. Using this attribute tends to prevent adding locations to the wrong edges, which can occur when a vehicle is near an intersection or an overpass, for example. Bearing also helps the solver determine the side of the street that the point is on.Tol -
BearingTolint (non-negative)default:30nullable
The bearing tolerance value creates a range of acceptable bearing values when locating moving points on an edge using the
Bearing
attribute.If the
Bearing
attribute value is within the range of acceptable values that are generated from the bearing tolerance on an edge, the point can be added as a network location there; otherwise, the closest point on the next-nearest edge is evaluated. The units are in degrees, and the default value is 30. Values must be greater than 0 and less than 180. A value of 30 means that when Network Analyst attempts to add a network location on an edge, a range of acceptable bearing values is generated 15 degrees to either side of the edge (left and right) and in both digitized directions of the edge. -
NavLatencyint (non-negative)nullable
Indicates how much cost is expected to elapse from the moment GPS information is sent from a moving vehicle to a server and the moment the processed route is received by the vehicle's navigation device.
This attribute is only used in the solve process if the
Bearing
andBearing
fields also have values; however, providing aTol Nav
attribute value is optional, even when values are present in theLatency Bearing
andBearing
.Tol
Example:
{
"features": [
{
"geometry": {
"x": -117.2,
"y": 34.2
},
"attributes": {
"Name": "Depot 1"
}
}
]
}
routes
type:tableRequired
The routes
parameter identifies one or more routes that describe vehicle and driver characteristics. A route can have start and end depot service times, a fixed or flexible starting time, time-based operating costs, distance-based operating costs, multiple capacities, various constraints on a driver's workday, and so on.
When specifying the routes, you can set attributes for each as follows:
Show attributes for routes
Attributes for routes
-
Namestring
The name of the route.
This attribute is the primary key and is used as a foreign key in the Orders, Depot Visits feature layers; and RouteSpecialties tables. Route names are case sensitive and cannot be empty, even if the route is not part of the solve operation. The name must be unique.
-
StartDepotNamestringnullable
The name of the starting depot for the route.
This attribute is a foreign key to the
Name
attribute in thedepots
parameter. All routes must have the same starting depot. They can all be the same location specified in thedepots
parameter or all left null. The starting depot and the ending depot can be different. Omitting the start depot is useful when the vehicle's starting location is unknown or irrelevant to the problem. Virtual start depots are not allowed if orders or depots are in multiple time zones. If the route is making deliveries andStart
is null, it is assumed that the cargo is loaded on the vehicle at a virtual depot before the route begins.Depot Name -
EndDepotNamestringnullable
The name of the ending depot for the route.
This attribute is a foreign key to the
Name
attribute in thedepots
parameter. All routes must have the same ending depot. They can all be the same location specified in thedepots
parameter or all left null. The starting depot and the ending depot can be different. -
StartDepotServiceTimedouble (non-negative)nullable
The service time at the starting depot.
This can be used to model the time spent loading the vehicle. This attribute can contain a null value, which indicates zero service time. The unit for this attribute value is specified by the
time
parameter._units -
EndDepotServiceTimedouble (non-negative)nullable
The service time at the ending depot.
This can be used to model the time spent unloading the vehicle. This attribute can contain a null value, which indicates zero service time. The unit for this attribute value is specified by the
time
parameter._units -
EarliestStartDatedatenullable
The earliest allowable starting date for the route.
This is used by the solver in conjunction with the
earliest
parameter value to indicate the earliest date the route should start. Either this attribute or the_route _start _date earliest
parameter must be populated. If this attribute is left null, the_route _start _date earliest
value will be used for the route._route _start _date -
EarliestStartTimetimenullable
The earliest allowable starting time for the route.
This is used by the solver in conjunction with the
earliest
parameter value to indicate the earliest time the route should start. Either this attribute or the_route _start _time earliest
parameter must be populated. If this attribute is left null, the_route _start _time earliest
will be used for the route._route _start _time -
StartFlexibilitydouble (non-negative)nullable
Indicates how long after the earliest allowed route start time the route can start.
The value can be null or zero, which means that there is no flexibility in the starting time, or a positive number. The unit for this attribute value is specified by the
time
parameter of the analysis object._units -
ArriveDepartDelaydouble (non-negative)nullable
The amount of travel time needed to accelerate the vehicle to normal travel speeds, decelerate it to a stop, and move it off and on the network (for example, in and out of parking).
The unit for this attribute value is specified by the
time
parameter. By including an_units Arrive
value, the solver is deterred from sending many routes to service physically coincident orders. The cost for this attribute is incurred between visits to non-coincident orders and depots. For example, when a route starts from a depot and visits the first order, the total arrive/depart delay is added to the travel time. The same is true when traveling from the first order to the second order. If the second and third orders are coincident, theDepart Delay Arrive
value is not added between them, since the vehicle doesn't need to move.Depart Delay For example, there are five coincident orders in a high-rise building, and they are serviced by three different routes. This means three arrive/depart delays will be incurred; that is, three drivers will need to find parking places and enter the same building. However, if the orders can be serviced by one route instead, only one driver will need to park and enter the building, and only one arrive/depart delay will be incurred. Since the solver tries to minimize cost, it will attempt to limit the arrive/depart delays by specifying the single-route option. (Multiple routes may need to be sent when other constraints—such as specialties, time windows, or capacities—require it.)
-
Capacity_1 -- Capacity_9double (non-negative)nullable
The maximum amount (for example, volume, weight, or quantity) that can be carried by the vehicle. If there are multiple capacities, specify them using the Capacity_1 through Capacity_9 fields as needed.
-
FixedCostdouble (non-negative)nullable
A fixed monetary cost that is incurred when the route is used in a solution (that is, it has orders assigned to it).
This attribute can contain null values, which indicates zero fixed cost. This cost is part of the total route operating cost.
-
CostPerUnitTimedouble (non-negative)default:1.0
The monetary cost incurred per unit of work time for the total route duration, including travel times as well as service times and wait times at orders and depots.
This attribute cannot contain a null value and has a default value of 1.0. The unit for this attribute value is specified by the
time
parameter._units -
CostPerUnitDistancedouble (non-negative)nullable
The monetary cost incurred per unit of distance traveled for the route length (total travel distance). This attribute can contain null values, which indicates zero cost. The distance unit is specified by the
distance
parameter._units -
OvertimeStartTimedouble (non-negative)nullable
The duration of regular work time before overtime computation begins.
This attribute can contain null values, which indicates that overtime does not apply. If including an
Overtime
value, it should be greater than zero and less than theStart Time Max
value. The unit for this attribute value is specified by theTotal Time time
parameter._units For example, if the driver is to be paid overtime pay when the total route duration extends beyond eight hours,
Overtime
is specified as 8 if theStart Time time
property of the analysis layer is set to Hours._units -
CostPerUnitOverTimedouble (non-negative)nullable
The monetary cost incurred per time unit of overtime work. This can only contain a null value if
Overtime
is also null. Otherwise, it must be a positive value greater than theStart Time Cost
value.Per Unit Time -
MaxOrderCountlongnullable
The maximum allowable number of orders on the route.
This attribute can contain null values, which indicates that there is no constraint on the number of orders a route can visit.
-
MaxTotalTimedouble (non-negative)nullable
The maximum allowable route duration.
The route duration includes travel times as well as service and wait times at orders and depots. Either this attribute or the
max
parameter must be populated. If this attribute is left null, the_route _total _time max
value will be used for the route._route _total _time -
MaxTotalTravelTimedouble (non-negative)nullable
The maximum allowable travel time for the route.
The travel time includes only the time spent driving on the network and does not include service or wait times. The unit for this attribute value is specified by the
time
parameter. This attribute can contain null values, which indicates there is no constraint on the maximum allowable travel time. This attribute value can't be larger than the_units Max
attribute value.Total Time -
MaxTotalDistancedouble (non-negative)nullable
The maximum allowable travel distance for the route.
The unit for the total distance is specified by the
distance
parameter of the analysis layer. This attribute can contain null values, which indicates that there is no constraint on the maximum allowable travel distance._units -
ZoneNamestringnullable
The name of the zone that will be used for this route.
These are zones that specify a work territory for this route.
Zone
is a foreign key to theName Name
attribute in thezones
parameter. This attribute can contain null values, which indicates that there is no route zone for this route. -
IsHardZoneboolnullabledefault:null
A Boolean value indicating a hard or soft route zone.
- A value of
True
(1) indicates that the route zone is hard; that is, an order that falls outside the route zone polygon can't be assigned to the route. - A value of
False
(0) indicates that the order can still be assigned, but the cost of servicing the order is weighted by a function that is based on the Euclidean distance from the route zone. This means that as the straight-line distance from the soft zone to the order increases, the likelihood of the order being assigned to the route decreases.
- A value of
-
AssignmentRuleint enumnullabledefault:null
This specifies whether the route can be used when solving the problem.
This attribute is constrained by a domain of values. The possible values are as following:
Null
: The route is open to new orders.1
: Closed. The route will not accept new orders but it can be re-sequenced or have the outputs updated.2
: Exclude. The route is excluded from the solve operation. The output for this route will not be updated. The orders with the corresponding route will also be excluded from the route, and the output from those orders will not be updated.
Example:
{
"features": [
{
"attributes": {
"Name": "Truck 1",
"StartDepotName": "Depot 1",
"EndDepotName": "Depot 1",
"EarliestStartTime": "6:00:00",
"Capacity_1": 40000,
"Capacity_2": 2000,
"CostPerUnitTime": 0.5,
"CostPerUnitDistance": 1.5
}
},
{
"attributes": {
"Name": "Truck 2",
"StartDepotName": "Depot 1",
"EndDepotName": "Depot 1",
"EarliestStartTime": "6:00:00",
token
type:stringRequired
Use this parameter to specify a token that provides the identity of a user that has the permissions to access the service. The security and authentication page provides more information about how an access token can be obtained. In the example below, replace <your
with a valid token.
Example:
token=
f
type:enumRequired
Allowed values: json
, pjson
Use this parameter to specify the response format.
The pjson
value is used for printing the JSON response in a prettified format.
Optional parameters
order_specialties
type:feature
The order
parameter lists the specialties that can be required by orders and supported by routes. A route can service an order only if it supports all the specialties required for that order.
When specifying the order specialties, you can set properties using the following attributes:
Show attributes for order_specialties
Attributes for order_specialties
-
OrderNamestring
The name of the order. This attribute is a foreign key to the name attribute in the
orders
parameter. -
SpecialtyNamestring
The name of the specialty.
This indicates the required specialty for the order. Only a single specialty is listed per line. If an order requires more than one specialty, create a new entry. Specialty names cannot contain spaces. For example, a senior technician specialty should be entered as SeniorTechnician. Specialty names are case sensitive and cannot be empty.
Example:
{
"features": [
{
"attributes": {
"OrderName": "Order 1",
"SpecialtyName": "Refrigerated"
}
},
{
"attributes": {
"OrderName": "Order 2",
"SpecialtyName": "Hazmat"
}
}
]
}
route_specialties
type:feature
The route_specialties parameter lists the specialties that can be required by orders and supported by routes. A route can service an order only if it supports all the specialties required for that order.
When specifying the route specialties, you can set properties using the following attributes:
Show attributes for route_specialties
Attributes for route_specialties
-
RouteNamestring
The name of the route. This attribute is a foreign key to the
Name
attribute in theroutes
parameter. -
SpecialtyNamestring
The name of the specialty.
This indicates the specialty that the route supports. Only a single specialty is listed per line. If a route supports more than one specially, create a new entry. Specialty names cannot contain spaces. For example, a senior technician specialty should be entered as SeniorTechnician. Specialty names are case sensitive and cannot be empty.
Example:
{
"features": [
{
"attributes": {
"RouteName": "Truck 1",
"SpecialtyName": "Refrigerated"
}
},
{
"attributes": {
"RouteName": "Truck 2",
"SpecialtyName": "Hazmat"
}
}
]
}
zones
type:feature
Zones specify a work territory. It is a polygon feature and is used to constrain servicing only those orders that fall within or near an area.
Show attributes for zones
Attributes for zones
-
Namestring
The name of the zone.
The name attribute is useful for describing the zone since it can be used for multiple routes. The name must be unique. Names are case sensitive and cannot be empty. This attribute is the primary key and is used as a foreign key in the
routes
parameter.
Example:
{
"features": [
{
"geometry": {
"rings": [
[
[-97.0634, 32.8442],
[-97.0554, 32.84],
[-97.0558, 32.8327],
[-97.0638, 32.83],
[-97.0634, 32.8442]
]
]
},
"attributes": {
"Name": "Zone 1"
}
},
{
"geometry": {
point_barriers
type:feature
Use this parameter to specify one or more points that will act as temporary restrictions or represent additional time or distance that may be required to travel on the underlying streets. For example, a point barrier can be used to represent a fallen tree along a street or a time delay spent at a railroad crossing. The tool imposes a limit of 250 points that can be added as barriers.
When specifying point barriers, you can set properties for each, such as its name or barrier type.
Show attributes for point_barriers
Attributes for point_barriers
-
Namestringnullable
The name of the barrier.
-
CurbApproachint enumdefault:0
Allowed values:
0
,1
,2
Specifies the direction of traffic that is affected by the barrier. The field value is specified as one of the following integers:
0
: Either side of the vehicle. The barrier affects travel over the edge in both directions.1
: Right side of vehicle. Vehicles are only affected if the barrier is on their right side during the approach. Vehicles that traverse the same edge but approach the barrier on their left side are not affected by the barrier.2
: Left side of vehicle. Vehicles are only affected if the barrier is on their left side during the approach. Vehicles that traverse the same edge but approach the barrier on their right side are not affected by the barrier.
-
FullEdgelong (non-negative)default:False
This attribute is specific to restriction point barriers on edge elements.
False
: Permits travel on the edge up to the barrier but not through it.True
: Restricts travel anywhere on the associated edge.
-
BarrierTypeint enumdefault:0
Allowed values:
0
,2
,Specifies whether the point barrier restricts travel completely or adds time or distance when it is crossed.
The value for this attribute is specified as one of the following options:
0
:Restriction. Prohibits travel through the barrier.2
:Added Cost. Traveling through the barrier increases the travel time or distance by the amount specified in theAdditional
,_Time Additional
, or_Distance Additional
attribute. This barrier type is referred to as an added cost point barrier.Cost
-
Additional_Timedouble (non-negative)default:0
The added travel time when the barrier is traversed. This attribute is applicable only for added-cost barriers. The attribute value must be greater than or equal to zero, and its units are the same as those specified in the
time
parameter._units -
Additional_Distancedouble (non-negative)default:0
The added distance when the barrier is traversed. This attribute is applicable only for added-cost barriers. The attribute value must be greater than or equal to zero, and its units are the same as those specified in the
distance
parameter._units -
AdditionalCostdouble (non-negative)default:0
The added cost when the barrier is traversed. This attribute is applicable only for added-cost barriers. The attribute value must be greater than or equal to zero.
-
Bearingint (non-negative)nullable
The direction in which a point is moving. The units are degrees and are measured clockwise from true north.
This attribute is used in conjunction with the BearingTol attribute. Bearing data is usually sent automatically from a mobile device equipped with a GPS receiver. Try to include bearing data if you are loading an input location that is moving, such as a pedestrian or a vehicle. Using this attribute tends to prevent adding locations to the wrong edges, which can occur when a vehicle is near an intersection or an overpass, for example. Bearing also helps the solver determine the side of the street that the point is on.
-
BearingTolint (non-negative)default:30nullable
The bearing tolerance value creates a range of acceptable bearing values when locating moving points on an edge using the
Bearing
attribute.If the
Bearing
attribute value is within the range of acceptable values that are generated from the bearing tolerance on an edge, the point can be added as a network location there; otherwise, the closest point on the next-nearest edge is evaluated. The units are in degrees, and the default value is 30. Values must be greater than 0 and less than 180. A value of 30 means that when Network Analyst attempts to add a network location on an edge, a range of acceptable bearing values is generated 15 degrees to either side of the edge (left and right) and in both digitized directions of the edge. -
NavLatencyint (non-negative)nullable
Indicates how much cost is expected to elapse from the moment GPS information is sent from a moving vehicle to a server and the moment the processed route is received by the vehicle's navigation device.
This attribute is only used in the solve process if the
Bearing
andBearing
attribute also have values; however, providing aTol Nav
attribute value is optional, even when values are present in theLatency Bearing
andBearing
.Tol
Example:
{
"spatialReference": {
"wkid": 4326
},
"features": [
{
"geometry": {
"x": 37.541479,
"y": -122.053461
},
"attributes": {
"Name": "Haley St railroad crossing",
"BarrierType": 2,
"Additional_Time": 5
}
}
]
}
line_barriers
type:feature
Use this parameter to specify one or more lines that prohibit travel anywhere the lines intersect the streets. For example, a parade or protest that blocks traffic across several street segments can be modeled with a line barrier. A line barrier can also quickly fence off several roads from being traversed, thereby channeling possible routes away from undesirable parts of the street network.
When specifying line barriers, you can set the name of each barrier using the following attribute:
Show attributes for line_barriers
Attributes for line_barriers
-
Namestring (length: 500)
The name of the barrier.
Example:
{
"spatialReference": {
"wkid": 102100
},
"features": [
{
"geometry": {
"paths": [
[
[-10804823.397, 3873688.372],
[-10804811.152, 3873025.945]
]
]
},
"attributes": {
"Name": "Barrier 1"
}
},
{
"geometry": {
polygon_barriers
type:feature
Use this parameter to specify polygons that either completely restrict travel or proportionately scale the time or distance required to travel on the streets intersected by the polygons.
When specifying polygon barriers, you can set properties for each, such as its name or barrier type, using the following attributes:
Show attributes for polygon_barriers
Attributes for polygon_barriers
-
Namestringnullable
The name of the barrier.
-
BarrierTypeint enumdefault:0
Allowed values:
0
,1
Specifies whether the barrier restricts travel completely or scales the cost of traveling through it.
The value for this attribute can be specified as one of the following options:
0
: Restriction. Prohibits traversing through any part of the barrier. .1
: Scaled Cost. Scales the cost (such as travel time or distance) required to travel the underlying streets by a factor specified using theScaled
orTime Factor Scaled
attribute. If the streets are partially covered by the barrier, the travel time or distance is apportioned and then scaled. For example, a factor of 0.25 means that travel on underlying streets is expected to be four times faster than normal. A factor of 3.0 means it is expected to take three times longer than normal to travel on underlying streets. This barrier type is referred to as a scaled-cost polygon barrier. It can be used to model storms that reduce travel speeds in specific regions, for example.Distance Factor
-
ScaledTimeFactordouble (non-negative)default:1
The scaled travel time when the barrier is traversed.
This attribute is applicable only for scaled-cost barriers. The attribute value must be greater than or equal to zero, and its units are the same as those specified in the
time
parameter._units -
ScaledDistanceFactordouble (non-negative)default:1
The scaled distance when the barrier is traversed.
This attribute is applicable only for scaled-cost barriers. The attribute value must be greater than or equal to zero, and its units are the same as those specified in the
distance
parameter._units -
ScaledCostFactordouble (non-negative)default:1
The scaled cost when the barrier is traversed. This attribute is applicable only for scaled-cost barriers. The attribute value must be greater than or equal to zero.
Example:
{
"spatialReference": {
"wkid": 102100
},
"features": [
{
"geometry": {
"paths": [
[
[-10804823.397, 3873688.372],
[-10804811.152, 3873025.945]
]
]
},
"attributes": {
"Name": "Barrier 1"
}
},
{
"geometry": {
analysis_region
type:enum
Specify the region in which to perform the analysis. If a value is not specified for this parameter, the service will automatically calculate the region name based on the location of the input points. Setting the name of the region is recommended to speed up the analysis.
To specify a region, use one of the following values:
- Europe
- Japan
- Korea
- MiddleEastAndAfrica
- NorthAmerica
- SouthAmerica
- SouthAsia
- Thailand
The data coverage page lists the countries that are grouped into each of these regions.
travel_mode
type:travel_mode_object
Choose the mode of transportation for the analysis.
To learn more about travel modes, see Configure travel modes
In the example below, the following is a string representing the Walking Time travel mode as returned by the Get
service:
"{\"attributeParameterValues\": [{\"attributeName\": \"Avoid Private Roads\", \"parameterName\": \"Restriction Usage\", \"value\": \"AVOID_MEDIUM\"}, {\"attributeName\": \"Walking\", \"parameterName\": \"Restriction Usage\", \"value\": \"PROHIBITED\"}, {\"attributeName\": \"Preferred for Pedestrians\", \"parameterName\": \"Restriction Usage\", \"value\": \"PREFER_LOW\"}, {\"attributeName\": \"WalkTime\", \"parameterName\": \"Walking Speed (km/h)\", \"value\": 5}, {\"attributeName\": \"Avoid Roads Unsuitable for Pedestrians\", \"parameterName\": \"Restriction Usage\", \"value\": \"AVOID_HIGH\"}], \"description\": \"Follows paths and roads that allow pedestrian traffic and finds solutions that optimize travel time. The walking speed is set to 5 kilometers per hour.\", \"distanceAttributeName\": \"Kilometers\", \"id\": \"caFAgoThrvUpkFBW\", \"impedanceAttributeName\": \"WalkTime\", \"name\": \"Walking Time\", \"restrictionAttributeNames\": [\"Avoid Private Roads\", \"Avoid Roads Unsuitable for Pedestrians\", \"Preferred for Pedestrians\", \"Walking\"], \"simplificationTolerance\": 2, \"simplificationToleranceUnits\": \"esriMeters\", \"timeAttributeName\": \"WalkTime\", \"type\": \"WALK\", \"useHierarchy\": false, \"uturnAtJunctions\": \"esriNFSBAllowBacktrack\"}"
The value above should be converted to a valid JSON object and passed as the value for the travel
parameter as shown below.
{
"attributeParameterValues": [
{
"attributeName": "Avoid Private Roads",
"parameterName": "Restriction Usage",
"value": "AVOID_MEDIUM"
},
{
"attributeName": "Walking",
"parameterName": "Restriction Usage",
"value": "PROHIBITED"
},
{
"attributeName": "Preferred for Pedestrians",
"parameterName": "Restriction Usage",
"value": "PREFER_LOW"
},
{
"attributeName": "WalkTime",
"parameterName": "Walking Speed (km/h)",
locate_settings
Use this parameter to specify settings that affect how inputs are located, such as the maximum search distance to use when locating the inputs on the network or the network sources being used for locating.
The default value is as follows:
{
"default": {
"tolerance": 20000,
"toleranceUnits": "esriMeters",
"allowAutoRelocate": true,
"sources": [
{
"name": "main.Routing_Streets"
}
]
}
}
You can specify locate settings and can override locate settings for individual features such as, orders, depots, point_barriers, line_barriers, and polygon_barriers through locator JSON object.
Show examples
Example for locate_settings
Example 1: Specify locate settings using a JSON structure
This example shows how to specify locate settings so inputs are only located within 500 meters of the specified location. A small search tolerance like this can be helpful if you are solving using a walking travel mode and don't want inputs to be located farther than 500 meters from the original point location.
{
"default": {
"tolerance": 500,
"toleranceUnits": "esriMeters",
"allowAutoRelocate": true,
"sources": [
{
"name": "main.Routing_Streets"
}
]
}
}
ignore_invalid_order_locations
type:booldefault:false
Use this parameter to specify whether invalid orders will be ignored when solving the last mile delivery problem.
-
true—The solve operation will ignore any invalid orders and return a solution, given it didn't encounter any other errors. To generate routes and deliver them to drivers immediately, you may be able to ignore invalid orders, solve, and distribute the routes to your drivers. Then, resolve any invalid orders from the last solve and include them in the fleet routing analysis for the next workday or work shift.
-
false—The solve operation will fail when any invalid orders are encountered. An invalid order is an order that the fleet routing solver can't reach. An order may be unreachable for a variety of reasons, including when the order is located on a prohibited network element, isn't located on the network at all, or is located on a disconnected portion of the network.
earliest_route_start_date
type:string
Use this parameter to specify the default earliest start date for routes. This date is used for all routes for which the Earliest
attribute in the routes
parameter is null. When this property is not specified, all rows in the routes
parameter must specify a value in the Earliest
attribute.
The format to provide the start date is YYYY-MM-DD, for example, 2023-03-15.
earliest_route_start_time
type:string
Use this parameter to specify the default earliest start time for routes. This time of day is used for all routes for which the Earliest
attribute in the routes
parameter is null. When this property is not specified, all rows in the routes
parameter must specify a value in the Earliest
attribute.
The format to provide the start date is hh:mm:ss, for example, 14:30:30.
time_zone_usage_for_time_fields
type:enumdefault:GEO_LOCAL
Allowed values: GEO
, UTC
Use this parameter to specify the time zone for the input date-time fields.
GEO
: The date-time values associated with the orders or depots are in the time zone in which the orders and depots are located. For routes, the date-time values are based on the time zone in which the starting depot for the route is located. If a route does not have a starting depot, all orders and depots across all the routes must be in a single time zone. For example, if a depot is located in an area that follows eastern standard time and has the first time window values (specified as_LOCAL Time
andWindow Start Time
) of 8 AM and 5 PM, the time window values will be treated as 8:00 a.m. and 5:00 p.m. in eastern standard time.Window End UTC
: The date-time values associated with the orders or depots are in coordinated universal time (UTC) and are not based on the time zone in which the orders or depots are located. For example, if a depot is located in an area that follows eastern standard time and has the first time window values (specified asTime
andWindow Start Time
) of 8 AM and 5 PM, the time window values will be treated as 3:00 a.m. and 12:00 p.m. in eastern standard time.Window End
This parameter specifies the time zone for the following fields:
Time
,Window Start Time
,Window End Inbound
, andArrive Time Outbound
on orders.Depart Time Earliest
andStart Date Earliest
on routes.Start Time
max_route_total_time
type:double (positive)
Use this parameter to specify the maximum allowed total time for each route. The value can be any positive number.
The value is used for all routes when the Max
attribute in the routes
parameter is null. When no value is specified for max
, all rows in the routes
parameter must specify a value in the Max
attribute.
The value is interpreted in the units specified in the time
parameter.
sequence_gap
type:int (positive)default:1
Use this parameter to specify the gap in numerical values to leave in the Sequence
attribute in the orders
parameter between adjacent orders when the analysis is solved. The value acts as a multiplier for the actual sequence of orders on each route. For instance, if the gap is 5, the first order on the route would have a Sequence attribute value of 5, the second order on the route would have a Sequence attribute value of 10, the third 15, and so on. This parameter helps support inserting orders after the initial route plan has been created because the new orders can be inserted into the sequence gaps.
The first time the analysis is solved, the Sequence attribute values will be populated with sequential values using the designated sequence gap. On subsequent solves of the same analysis, the Sequence attribute values of existing orders with a Preserve
assignment rule will be maintained, and new orders will be inserted into the gaps using available integer values for the Sequence attribute that are not in use by other orders. If the sequence gap is set to 1, the sequence values will always be updated to contiguous values for every solve.
time_units
type:enumdefault:Minutes
Allowed values: Seconds
, Minutes
, Hours
, Days
Use this parameter to specify the time units for all time-based attribute values specified with different parameters.
The parameter is specified using one of the following values:
Seconds
Minutes
Hours
Days
Many parameters in a last mile delivery problem analysis have attributes for storing time values, such as Service
for the orders
parameter and Cost
for the routes
parameter. To minimize data entry requirements, these attribute values don't include units. Instead, all time-based attribute values must be entered in the same units, and this parameter is used to specify the units of those values.
distance_units
type:enumdefault:Miles
Allowed values: Miles
, Kilometers
, Meters
, Feet
, Yards
, Nautical
Use this parameter to specify the distance units for all distance-based attribute values specified with different parameters.
The parameter is specified using one of the following values:
Miles
Kilometers
Feet
Yards
Meters
Nautical
Miles
Many parameters in a last mile delivery problem analysis have attributes for storing distance values, such as Max
for the routes
parameter. To minimize data entry requirements, these attribute values don't include units. Instead, all distance-based attribute values must be entered in the same units, and this parameter is used to specify the units of those values.
route_shape
type:enumdefault:Straight Line
Allowed values: True Shape with Measures
, Straight Line
, None
Use this parameter to specify the type of route features that are output by the service.
The parameter can be specified using one of the following values:
-
True Shape with Measures
—The exact shape of the resulting route that is based on the underlying streets will be returned. Additionally, construct measures will be used so the shape can be used in linear referencing. The measurements increase from the first stop and record the cumulative travel time in the units specified by thetime
parameter. To get M value on the output features, request output with returnM set to_units True
. -
Straight Line
—A straight line between the depots and orders will be returned. -
None
—No shape for any route will be returned. This value can be useful when you want to optimize performance and are only interested in determining the route's total travel time or travel distance, not the route paths.
populate_directions
type:booldefault:false
Use this parameter to specify whether the service will generate driving directions for each route.
true
—Directions will be generated and configured based on the value of thedirections
parameter._language false
—Directions will not be generated, and the service returns an empty value for theoutput
and_direction _points output
output parameter._direction _lines
directions_language
type:enumdefault:en
Use this parameter to specify the language that will be used when generating travel directions.
This parameter applies only when the populate
parameter is set to true. The service supports generating directions in the following languages:
Show all supported languages
ar
: Arabicbg
: Bulgarianbs
: Bosnianca
: Catalancs
: Czechda
: Danishde
: Germanel
: Greeken
: Englishes
: Spanishet
: Estonianfi
: Finnishfr
: Frenchhe
: Hebrewhr
: Croatianhu
: Hungarianid
: Indonesianit
: Italianja
: Japaneseko
: Koreanlt
: Lithuanianlv
: Latviannb
: Norwegiannl
: Dutchpl
: Polishpt-
: Portuguese (Brazil)BR pt-
: Portuguese (Portugal)PT ro
: Romanianru
: Russiansk
: Slovaksl
: Sloveniansr
: Serbiansv
: Swedishth
: Thaitr
: Turkishuk
: Ukrainianvi
: Vietnamesezh-
: Chinese (China)CN zh-
: Chinese (Hong Kong)HK zh-
: Chinese (Taiwan)TW
The service searches for an exact match for the specified language including any language localization. If no exact match is found, it tries to match the language family. If a match is still not found, the service returns the directions using the default language of the server's operating system. For example, if the directions language is specified as es-
(Mexican Spanish), the service will return the directions in Spanish, as it supports the es language code, not es-
.
save_route_data
type:booldefault:false
Use this parameter to specify whether the service will create a .zip file that contains a file geodatabase with the inputs and outputs of the analysis in a format that can be used to share route layers with your portal.
-
true
—The route data will be saved as a .zip file. This file can be downloaded from the URL provided as part of theoutput
parameter._route _data -
false
—The route data will not be saved.
save_output_network_analysis_layer
type:booldefault:false
Use this parameter to specify whether the service will save the analysis settings as a network analysis layer file.
You cannot work directly with this file even when you open the file in an ArcGIS Desktop application such as ArcGIS Pro. It is meant to be sent to Esri Technical Support to diagnose the quality of results returned from the service.
-
true—The network analysis layer file will be saved. The file can be downloaded from the URL provided as part of the
output
parameter._network _analysis _layer _package -
false—The network analysis layer file will not be saved.
output_format
type:enumdefault:Feature Set
Allowed values: Feature Set
,JSO
,Geo
Use this parameter to specify the format in which the output features will be returned.
-
Feature Set
—The output features will be returned as feature classes and tables. This is the default. -
JSO
—The output features will be returned as a compressed file containing the JSON representation of the outputs. When this option is specified, the output is a single file (with a .zip extension) that contains one or more JSON files (with a .json extension) for each of the outputs created by the service.N File -
Geo
—The output features will be returned as a compressed file containing the GeoJSON representation of the outputs. When this option is specified, the output is a single file (with a .zip extension) that contains one or more GeoJSON files (with a .geojson extension) for each of the outputs created by the service.JSO N File
context
type:context_object
This parameter contains additional settings that affect task operation, for example, the spatial reference of the output features.
overrides
Response objects
output_orders
type:feature
Output orders contains all the attributes from input orders
parameter, this includes the attributes defined on the service, and also attributes that are pass-through (you can pass additional attributes on input orders and those attributes will be carried over to the output). The output also contains following attributes that are either generated or altered by the service.
Show attributes for output orders
-
ObjectIDint
The object ID of the feature.
-
RouteNamestring (length: 500)nullable
The name of the route to which the order is assigned.
The
Route
attribute is a foreign key to theName Name
attribute in theroutes
parameter. After a solve operation, if the order is routed, theRoute
attribute contains the name of the route that the order is assigned to.Name -
Sequenceint (non-negative)nullable
The sequence of the order on its assigned route.
Output sequence values for a route are shared across depot visits and orders. The sequences starts from 0 (at the starting depot) and are consecutive except when sequence gaps are used. The smallest possible output sequence value for a routed order is 1, since a route always begins at a depot even if it is virtual depot.
-
ViolatedConstraint_1 -- ViolatedConstraint_4int enumnullable
These attributes contain a summary of violated constraints and are set after a solve operation. Each attribute will contain one violation. If an order has more than one violation the next
Violated
attribute will be used.Constraint _# The following are the possible values for the
Violated
attributes:Constraint _# null
: The order does not have any violated constraints.0
: MaxOrderCount exceeded. The preassigned orders cannot be assigned to the route since assigning the orders would exceed the maximum number of orders that can be assigned to the route as specified by the route'sMax
attribute value.Order Count 1
: Capacities exceeded. The preassigned orders cannot be assigned to the route since assigning the orders would exceed the total route capacity as specified by the route'sCapacities
attribute value._# 2
: MaxTotalTime exceeded. The travel time from the start depot to the end depot plus the service and wait times at the depot exceeds the total time for the route as specified by the route'sMax
attribute value.Total Time 3
: MaxTotalTravelTime exceeded. The travel time from the start depot to the end depot exceeds the total travel time for the route as specified by the route'sMax
attribute value.Total Travel Time 4
: MaxTotalDistance exceeded. The travel distance from the start depot to the end depot exceeds the total travel distance for the route as specified by the route'sMax
attribute value.Total Distance 5
: Hard time window. There is a hard time window violation on the start depot or end depot associated with the route.6
: Unmatched specialty. The specialties required by an order are not found on the target route.7
: Hard route zone. An order that was preassigned to the route does not fall within a hard route zone.9
: Unreachable. A preassigned order is located on a network element that cannot be reached by the route.14
: InboundArriveTime or OutboundDepartTime order violation . The order couldn't be serviced within the inbound arrive time or outbound depart time constraints. This violation occurs when all the routes must depart the starting depot before theInbound
value or none of the routes can reach a depot before the order'sArrive Time Outbound
value.Depart Time 15
: Cannot anchor first/last. The order has an Anchor first or Anchor last assignment rule, but the solver was not able to honor this constraint. This violation occurs when the number of anchor First orders or the number of anchor Last orders is greater than the number of available routes.
-
FromPrevTravelTimedouble (non-negative)nullable
The travel time from the preceding visit on the route to the depot. The unit for this attribute value is specified by the
time
parameter._units -
FromPrevDistancedouble (non-negative)nullable
The travel distance from the preceding visit on the route to the depot. The unit for this attribute value is specified by the
distance
parameter of the analysis layer._units -
ArriveCurbApproachlongnullable
The side of the vehicle the curb is on when the vehicle approaches the network location. If the network location's
Curb
value is set to Right side of vehicle, theApproach Arrive
value after solving is Right side of vehicle. However, if theCurb Approach Curb
is set to Either side of vehicle or No U-Turn, theApproach value Arrive
value can be the right or left side depending on which produces the overall shortest path.Curb Approach -
DepartCurbApproachlongnullable
The side of the vehicle the curb is on when the vehicle departs the network location. If the network location's
Curb
value is set to Right side of vehicle, theApproach Depart
value after solving is Right side of vehicle. However, if theCurb Approach Curb
value is set to Either side of vehicle or No U-Turn, theApproach Depart
value can be the right or left side depending on which produces the overall shortest path.Curb Approach -
ArriveTimetimestamp offsetnullable
The date and time value indicating the arrival time at the order. The route may arrive at the order before the beginning of one of the order's time windows, in which case there is a wait time at the order. For an order with soft time windows, the route may also arrive at the order after the end of the time window, in which case there is a violation time at the order. This arrival time reflects the travel times that were used during the optimization by the solver. If the network includes traffic data, it will use an average travel times across the whole day. When using traffic data that covers multiple time zones, the time zone for this time-of-day value is taken from the network element on which the order is located.
-
DepartTimetimestamp offsetnullable
The date and time value indicating the departure time for the order. The route departs from the order upon completion of service. This departure time reflects the travel times that were used during the optimization by the solver. If the network includes traffic data, it will use an average travel times across the whole day. When using traffic data that covers multiple time zones, the time zone for this time-of day value is taken from the network element on which the order is located.
-
WaitTimedouble (non-negative)nullable
The wait time or layover at the order. For example, a wait time occurs when a route must wait at the order for a time window to open. The unit for this attribute value is specified by the
time
parameter._units -
ViolationTimedouble (non-negative)nullable
The amount of time elapsed between the end of the order's time window and the arrival of the route vehicle. The unit for this attribute value is specified by the
time
parameter._units -
Statusint enum
Specifies the status of the point with respect to its location on the network and the outcome of the analysis. The possible values are as following:
0
: OK.The point was located on the network.1
: Not Located. The point was not located on the network and was not included in the analysis.2
: Network element not located. The network element identified by the point's network location fields cannot be found. This can occur when a network element where the point should be was deleted, and the network location was not recalculated.3
: Element not traversable. The network element that the point is located on is not traversable. This can occur when the element is restricted by a restriction attribute.4
: Invalid Field Values. Field values fall outside a range or coded-value domain. For example, a negative number exists where positive numbers are required.5
: Not reached. The point cannot be reached by the solver. The point may be on a separate, disconnected area of the network from the other inputs, or barriers or restrictions prevent travel to or from the point.6
: Time window violation. The point could not be reached within the designated time windows. This status only applies to network analysis types that support time windows.7
: Not located on closest. The closest network location to the point is not traversable because of a restriction or barrier, so the point has been located on the closest traversable network feature instead. If time windows are used and the route arrives early or late, the value changes to 6 (Time window violation)
-
SnapXdouble (non-negative)
The x-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset.
-
SnapYdouble (non-negative)
The y-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset.
-
SnapZdouble (non-negative)
The z-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset. The
Snap
attribute is 0 if the network is two-dimensional.Z -
DistanceToNetworkInMetersdouble (non-negative)
The distance in meters between the point's geographic location and the position where it was located on the network.
Example:
The following shows an example of the output
parameter.
{
"paramName": "output_orders",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
output_routes
type:feature
This parameter contains all the fields from the input routes
parameter, as well as the following fields that are either generated or altered by the service:
Show attributes for output routes
-
ObjectIDint
The object ID of the feature.
-
Namestring
The name of the route. The values for this attribute are copied from the
Name
attribute on the input routes. -
Shapegeometry
The line shape of the route.
If the Output Shape Type property of the analysis layer is set to None, no shape is returned. Setting the Output Shape Type property to Straight Line returns straight route lines that connect each pair of consecutive visits. Along Network returns lines that trace their corresponding routes on the network.
-
ViolatedConstraint_1 -- ViolatedConstraint_4int enumnullable
These attributes contain a summary of violated constraints and are set after a solve operation. Each attribute will contain one violation. If an order has more than one violation the next
Violated
attribute will be used.Constraint _# The following are the possible values for the
Violated
attributes:Constraint _# null
: The order does not have any violated constraints.0
: MaxOrderCount exceeded. The preassigned orders cannot be assigned to the route since assigning the orders would exceed the maximum number of orders that can be assigned to the route as specified by the route'sMax
attribute value.Order Count 1
: Capacities exceeded. The preassigned orders cannot be assigned to the route since assigning the orders would exceed the total route capacity as specified by the route'sCapacities
attribute value._# 2
: MaxTotalTime exceeded. The travel time from the start depot to the end depot plus the service and wait times at the depot exceeds the total time for the route as specified by the route'sMax
attribute value.Total Time 3
: MaxTotalTravelTime exceeded. The travel time from the start depot to the end depot exceeds the total travel time for the route as specified by the route'sMax
attribute value.Total Travel Time 4
: MaxTotalDistance exceeded. The travel distance from the start depot to the end depot exceeds the total travel distance for the route as specified by the route'sMax
attribute value.Total Distance 5
: Hard time window. There is a hard time window violation on the start depot or end depot associated with the route.6
: Unmatched specialty. The specialties required by an order are not found on the target route.7
: Hard route zone. An order that was preassigned to the route does not fall within a hard route zone.9
: Unreachable. A preassigned order is located on a network element that cannot be reached by the route.14
: InboundArriveTime or OutboundDepartTime order violation . The order couldn't be serviced within the inbound arrive time or outbound depart time constraints. This violation occurs when all the routes must depart the starting depot before theInbound
value or none of the routes can reach a depot before the order'sArrive Time Outbound
value.Depart Time 15
: Cannot anchor first/last. The order has an Anchor first or Anchor last assignment rule, but the solver was not able to honor this constraint. This violation occurs when the number of Anchor first orders or the number of Anchor last orders is greater than the number of available routes.
-
OrderCountlongnullable
The number of orders assigned to the route.
-
TotalCostdouble (non-negative)nullable
The total operating cost of the route, which is the sum of the following attribute values:
Fixed
,Cost Regular
,Time Cost Overtime
, andCost Distance
.Cost -
RegularTimeCostdouble (non-negative)nullable
The cost of regular work time.
-
OvertimeCostdouble (non-negative)nullable
The cost of overtime work.
-
DistanceCostdouble (non-negative)nullable
The distance cost component obtained by multiplying the
Total
andDistance Cost
attribute values.Per Unit Distance -
TotalTimedouble (non-negative)nullable
The total route duration.
This includes travel times as well as service and wait times at orders and depots. The TotalTime value is the sum of the following attribute values:
Start
,Depot Service Time End
,Depot Service Time Total
,Order Service Time Total
, andWait Time Total
. The unit for this attribute value is specified by theTravel Time time
parameter._units -
TotalOrderServicetimedouble (non-negative)nullable
The total service time spent at all orders on the route.
The unit for this attribute value is specified by the
time
parameter._units -
TotalTravelTimedouble (non-negative)nullable
The total travel time for the route.
The unit for this attribute value is specified by the
time
parameter._units -
TotalDistancedouble (non-negative)nullable
The total travel distance for the route.
The unit for this attribute value is specified by the
distance
parameter._units -
StartTimetimestamp offsetnullable
The starting time of the route, where the time zone is taken from the network element that the starting depot is located on.
-
EndTimetimestamp offsetnullable
The ending time of the route, where the time zone is taken from the network element that the ending depot is located on.
The route ends upon completion of service at the ending depot. This end time reflects the travel times that were used during the optimization by the solver. If the network includes traffic data, it will use average travel times across the whole day.
-
TotalWaitTimedouble (non-negative)nullable
The total wait time at all orders on the route. The unit for this attribute value is specified by the
time
parameter._units -
TotalViolationTimedouble (non-negative)nullable
The total violation time at all orders on the route. The unit for this attribute value is specified by the
time
parameter._units
Example:
The following shows an example of the output
parameter.
{
"paramName": "output_routes",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPolyline",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
output_depots
type:feature
This parameter contains all the fields from the input depots
parameter, as well as the following fields that are either generated or altered by the service:
Show attributes for output depots
-
ObjectIDint
The object ID of the feature.
-
Statusint enum
Specifies the status of the point with respect to its location on the network and the outcome of the analysis. The possible values are as following:
0
: OK.The point was located on the network.1
: Not Located. The point was not located on the network and was not included in the analysis.2
: Network element not located. The network element identified by the point's network location fields cannot be found. This can occur when a network element where the point should be was deleted, and the network location was not recalculated.3
: Element not traversable. The network element that the point is located on is not traversable. This can occur when the element is restricted by a restriction attribute.4
: Invalid Field Values. Field values fall outside a range or coded-value domain. For example, a negative number exists where positive numbers are required.5
: Not reached. The point cannot be reached by the solver. The point may be on a separate, disconnected area of the network from the other inputs, or barriers or restrictions prevent travel to or from the point.6
: Time window violation. The point could not be reached within the designated time windows. This status only applies to network analysis types that support time windows.7
: Not located on closest. The closest network location to the point is not traversable because of a restriction or barrier, so the point has been located on the closest traversable network feature instead. If time windows are used and the route arrives early or late, the value changes to 6 (Time window violation)
-
SnapXdouble (non-negative)
The x-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset.
-
SnapYdouble (non-negative)
The y-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset.
-
SnapZdouble (non-negative)
The z-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset. The
Snap
attribute is 0 if the network is two-dimensional.Z -
DistanceToNetworkInMetersdouble (non-negative)
The distance in meters between the point's geographic location and the position where it was located on the network.
Example:
The following shows an example of the output
parameter.
{
"paramName": "output_depots",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
output_depot_visits
type:feature
This output parameter provides information regarding why a route visited a depot and what happened there. The following fields are supported:
Show attributes for output depot visits
-
ObjectIDint
The object ID of the feature.
-
DepotNamestringnullable
The name of the visited depot. This attribute is a foreign key to the
Name
attribute in the Depots network analysis parameter.If the route uses a virtual depot, which means the route starts or ends at an order instead of a depot,
Depot
is null.Name -
VisitTypeint enumnullable
The reason the depot was visited.
This attribute is constrained by a domain of values:
1—
Start depot 2—
End depot -
RouteNamestringnullable
The name of the route containing this visit. This attribute is a foreign key to the
Name
attribute in the Routes feature layer. -
Sequencelongnullable
The sequence of the visited depot on the route.
The output sequence values for a route are shared across depot visits or orders, start from 0 (at the starting depot), and are consecutive except when sequence gaps are used.
-
ServiceTimedouble (non-negative)nullable
The service time (such as loading or unloading) at the depot.
The unit for this attribute value is specified by the
time
parameter._units -
FromPrevTravelTimedouble (non-negative)nullable
The travel time from the preceding visit on the route to the depot.
The unit for this attribute value is specified by the
time
parameter._units -
FromPrevDistancedouble (non-negative)nullable
The travel distance from the preceding visit on the route to the depot.
The unit for this attribute value is specified by the
distance
parameter._units -
ArriveTimetimestamp offsetnullable
The arrival time at the depot, where the time zone is taken from the network element on which the depot is located.
The arrival time reflects the travel times that were used during the optimization by the solver. If the network includes traffic data, it will use average travel times across the whole day."
-
DepartTimetimestamp offsetnullable
The departure time at the depot, where the time zone is taken from the network element on which the depot is located.
-
LoadedQuantity_1 -- LoadedQuantity_9double (non-negative)nullable
The amount (for example, volume, weight, or quantity) being loaded at the depot.
If there are multiple capacities, the amount in the
Loaded
throughQuantity _1 Loaded
fields correspond to the matchingQuantity _9 Capacity
through_1 Capacity
fields in the_9 Routes
input table. -
UnloadedQuantity_1 -- UnloadedQuantity_9double (non-negative)nullable
The amount (for example, volume, weight, or quantity) being unloaded at the depot.
If there are multiple capacities, the amounts in the
Unloaded
throughQuantity _1 Unloaded
fields correspond to the matchingQuantity _9 Capacity
through_1 Capacity
fields in the Routes input table._9
Example:
The following shows an example of the output
parameter.
{
"paramName": "output_depot_visits",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "DepotName",
"type": "esriFieldTypeString",
"alias": "DepotName",
output_direction_points
type:feature
This output parameter specifies the output turn-by-turn directions for the routes calculated in the analysis, represented as point locations along the routes where specific direction events or maneuvers occur.
Show attributes for output direction points
-
ObjectIDint
The object ID of the feature.
-
RouteIDlong
The route ID from the
ID
attribute that is associated with this direction information. -
Sequencelongnullable
The sequence of the direction items, starting at 1.
-
DirectionPointTypeint enumnullable
The type of direction event or maneuver described by the point, designated by one of the following values:
Show values
0
: Unknown1
: Header50
: Arrival51
: Departure52
: Straight100
: On Ferry101
: Off Ferry102
: Central Fork103
: Roundabout104
: U-Turn150
: Door151
: Stairs152
: Elevator153
: Escalator154
: Pedestrian Ramp200
: Left Fork201
: Left Ramp202
: Clockwise Roundabout203
: Left-handed U-turn204
: Bear left205
: Left Turn206
: Sharp Left207
: Left Turn and immediate Left Turn208
: Left Turn and immediate Right Turn300
: Right Fork301
: Right Ramp302
: Counter-Clockwise Roundabout303
: Right-handed U-turn304
: Bear right305
: Right Turn306
: Sharp Right307
: Right Turn and immediate Left Turn308
: Right Turn and immediate Right Turn400
: Up Elevator401
: Up Escalator402
: Up Stairs500
: Down Elevator501
: Down Escalator502
: Down stairs1000
: General Event1001
: Landmark1002
: Time Zone change1003
: Traffic Event1004
: Scaled Cost Barrier Event1005
: Boundary Crossing1006
: Restriction Violation
-
OrderIDlongnullable
If this direction information is associated with an order, its ID attribute is indicated here
-
DepotVisitIDlongnullable
If this direction information is associated with a depot, the associated depot visit ID attribute is indicated here.
-
BreakIDlongnullable
If this direction information is associated with a break, its ID attribute is indicated here.
-
DisplayTextstringnullable
The directions text that will be displayed.
-
ArrivalTimedouble (non-negative)nullable
The time the route arrives at this point in the directions. This is always in UTC.
-
ArrivalUTCOffsetdouble (non-negative)nullable
The difference in minutes between the local time at the maneuver location and UTC time.
This is positive for the eastern hemisphere, negative for the western hemisphere.
-
PrimaryNamestringnullable
The primary name for a direction.
This can come from many sources, for example, order name, depot name, break name if it is a depart or arrive instruction, source names for turn instructions, or landmark names for event instructions.
-
HighwayExitNamestringnullable
The highway exit name that appears in the direction instructions.
-
AlternateNamestringnullable
The alternative name for the directions text instructions, such as street names or road names.
-
IntersectingNamestringnullable
The intersection or cross street names that appear in the direction instructions.
-
SignpostBranchNamestringnullable
The signpost branch names that appear in the direction instructions.
-
SignpostTowardNamestringnullable
The signpost toward names that appear in the direction instructions.
-
Levellongnullable
The logical level of a directions item occurrence. This is relevant for 3D routing.
-
ShortVoiceInstructionstringnullable
The shortened direction information that will be used for voice instructions. It provides turn actions or alerts.
-
VoiceInstructionstringnullable
The direction information that will be used for voice instructions. It provides the expanded abbreviations or plurals along with turn actions or alerts.
-
Azimuthdouble (non-negative)nullable
The bearing in degrees of the vehicle departing this point. Zero indicates north. Null indicates that it is not applicable to this feature.
Example:
The following shows an example of the output
parameter.
{
"paramName": "output_direction_points",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "RouteID",
"type": "esriFieldTypeInteger",
"alias": "Route ID"
output_direction_lines
type:feature
These are the output route lines calculated in the analysis sliced to represent each route segment between Direction
events or maneuver locations. The following fields are supported:
Show attributes for output direction lines
-
ObjectIDlong
The object ID of the feature.
-
DirectionPointIDlongnullable
The object ID of the output_routes feature with which this direction line is associated.
-
RouteIDlongnullable
The object ID of the output_routes feature with which this direction line is associated.
-
DirectionLineTypeint enumnullable
The type of direction of this line, designated by one of the following values:
0
: Unknown1
: Segment2
: Maneuver Segment3
: Restriction Violation4
: Scaled Cost Barrier Event5
: Heavy Traffic6
: Slow Traffic7
: Moderate Traffic
-
Metersdouble (non-negative)nullable
The length of the line measured in meters.
-
Minutesdouble (non-negative)nullable
The travel time along the line measured in minutes.
-
FromLevellongnullable
The level of the line at the beginning of the line. This is relevant for 3D routing.
-
ToLevellongnullable
The level of the line at the end of the line. This is relevant for 3D routing.
-
ShapeLengthdouble (non-negative)nullable
The geometric length of the shape.
Example:
The following shows an example of the output
parameter.
{
"paramName": "output_direction_lines",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPolyline",
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "DirectionPointID",
"type": "esriFieldTypeInteger",
"alias": "Direction Point ID"
output_route_data
type:file
Use this parameter to access a .zip
file that contains a file geodatabase containing the inputs and outputs of the analysis in a format that can be used to share route layers with ArcGIS Online or Portal for ArcGIS.
This parameter is populated only when the save
parameter is set to true
.
output_result_file
type:file
Use this parameter to access the results from the analysis as a .zip
file containing one or more files for each output.
The format of the individual file is specified by the output
parameter. This parameter is not populated when the output
parameter is set to Feature Set
.
output_network_analysis_layer_package
type:file
Use this parameter to access the network analysis layer file that stores the analysis settings and the inputs and outputs used for the analysis.
This parameter is populated only when the save
parameter is set to true
.
usage_cost
type:usage_cost_object
This parameter returns the credits used by the analysis.
Usage limits
The table below list the limits that apply to this service.
Limit description | Limit value |
---|---|
Force hierarchy beyond a straight-line distance (If the straight-line distance between any two orders is greater than the limit shown here, the analysis uses hierarchy, even if hierarchy is not being used for the analysis.) | 50 miles (80.46 kilometers) |
Maximum number of street features intersected by line barriers | 500 |
Maximum number of point barriers | 250 |
Maximum number of street features intersected by polygon barriers | 2,000 |
Maximum number of orders | 10,000 |
Maximum number of routes | 100 |
Maximum route duration | 24 hours |
Maximum geodesic distance | 100 miles (160.93 kilometers) |
Maximum straight-line distance for the walking travel mode (If the straight-line distance between any orders is greater than this limit, the analysis fails when the walking restriction is used.) | 27 miles (43.45 kilometers) |
The maximum snap tolerance If the distance between an input point and its nearest traversable street is greater than the distance specified here, the point is excluded from the analysis. | 12.42 miles (20 kilometers) |
The maximum number of direction features that can be returned when using the job request type | 10,000,000 |
The maximum time a client can use the Last mile delivery service | 4 hours for job request type |