- URL:
- https://<root>/<serviceName>/GPServer/SolveVehicleRoutingProblem/submitJob
- Methods:
GET
POST
Description
Various organizations service orders with a fleet of vehicles. For example, a large furniture store might use several trucks to deliver furniture to homes. A specialized grease recycling company might route trucks from a facility to pick up used grease from restaurants. A health department might schedule daily inspection visits for each of its health inspectors. The problem that is common to these examples is the fleet routing. Each organization needs to determine which orders (homes, restaurants, or inspection sites) should be serviced by each route (truck or inspector) and in what sequence the orders should be visited. The primary goal is to best service the orders and minimize the overall operating cost for the fleet of vehicles. The fleet routing service can be used to determine solutions for such complex fleet management tasks. In addition, the service can solve more specific problems because numerous options are available, such as matching vehicle capacities with order quantities, providing a high level of customer service by honoring any time windows on orders, giving breaks to drivers, and pairing orders so they are serviced by the same route.
Consider an example of delivering goods to grocery stores from a central warehouse location. A fleet of three trucks is available at the warehouse. The warehouse operates only within a certain time window—from 8:00 a.m. to 5:00 p.m.—during which all trucks must return back to the warehouse. Each truck has a capacity of 15,000 pounds, which limits the amount of goods it can carry. Each store has a demand for a specific amount of goods (in pounds) that needs to be delivered, and each store has time windows that confine when deliveries should be made. Furthermore, the driver can work only eight hours per day, requires a break for lunch, and is paid for the amount of time spent on driving and servicing the stores. The service can be used to determine an itinerary for each route such that the deliveries can be made while honoring all the vehicle and order requirements and minimizing the total time spent on a particular route by the driver.
See the developer documentation to learn more about how to solve the multiple vehicle routing problem (VRP).
Request parameters
Parameter | Description |
---|---|
(Required) | Specify the orders the routes will visit. Syntax: |
(Required) | Specify a location that a vehicle departs from at the beginning of its workday and returns to at the end of the workday. Syntax: |
(Required) | Specify the routes that are available for the given vehicle routing problem. Syntax: |
(Required) | Provide the identity of a user that has the permissions to access the service. |
(Required) | Specify the response format. The default value is Values: |
(Optional) | Specify the date on which the routes start as a numeric value representing the milliseconds since midnight, January 1, 1970. |
(Optional) | Choose the mode of transportation for the analysis. The default value is Value: JSON object |
time_zone_usage_for_time_fields (Optional) | Specify the time zone for the input date-time fields. Values: |
(Optional) | Specify the impedance, which is a value that represents the effort or cost of traveling along road segments or on other parts of the transportation network. Values: |
(Optional) | Specify the rest periods, or breaks, for the routes in a given vehicle routing problem. Syntax: |
(Optional) | Specify the time units for all time-based attribute values specified with different parameters. The default value is Values: |
(Optional) | Specify the distance units for all distance-based attribute values specified with different parameters. The default value is Values: |
(Optional) | Specify the region in which the analysis will be performed. |
(Optional) | Restrict or permit U-turns at junctions. The default value is Values: |
(Optional) | Rate the importance of honoring time windows without causing violations. The default value is Values: |
(Optional) | Specify whether orders that are assigned to an individual route will be spatially clustered. The default value is Values: |
(Optional) | Specify areas that delineate work territories for given routes. Syntax: |
(Optional) | Specify the intermediate depots that routes can visit to reload or unload the cargo they are delivering or picking up. Syntax: |
(Optional) | Pair pickup and delivery orders so they are serviced by the same route. Syntax: |
(Optional) | Rate the importance of reducing excess transit time of order pairs. The default value is Values: |
(Optional) | Specify one or more points that will be used as temporary restrictions or represent additional time or distance that may be required to travel on the underlying streets. Syntax: |
(Optional) | Specify one or more lines that prohibit travel anywhere the lines intersect the streets. Syntax: |
(Optional) | Specify polygons that either completely restrict travel or proportionately scale the time or distance required to travel on the streets intersected by the polygons. Syntax: |
(Optional) | Specify whether hierarchy will be used when finding the best routes for the fleet of vehicles. The default value is Values: |
(Optional) | Specify the restrictions that will be honored. You can specify the value of this parameter as follows:
To view all accepted values for this parameter, see the restrictions parameter below. |
(Optional) | Specify additional values required by an attribute or restriction, such as whether the restriction prohibits, avoids, or prefers travel on restricted roads. To view all accepted values for this parameter, see the attribute_parameter_values parameter below. |
(Optional) | Specify the shape of the output routes. The default value is Values: |
route_line_simplification_tolerance (Optional) | Specify the amount by which the returned route geometry will be simplified. The default value is
|
(Optional) | Specify whether driving directions will be generated for the routes that are included as part of the vehicle routing problem solution. The default value is Values: |
(Optional) | Specify the language that will be used when generating driving directions. This parameter only applies when the The default value is To view all accepted values, see the |
(Optional) | Specify the name of the formatting style for the directions. This parameter only applies when the The default value is Values: |
(Optional) | Specify whether a The default value is Values: |
(Optional) | Specify whether the analysis settings will be saved as a network analysis layer file. The default value is Values: |
(Optional) | |
(Optional) | Specify the time-based impedance. The default value is Values: |
(Optional) | Specify the distance-based impedance. The default value is Values: |
(Optional) | Specify whether shapes will be created for the output assigned and unassigned stops. The default value is Values: |
(Optional) | Specify the format in which the output features will be created. The default value is Values: |
ignore_invalid_order_locations (Optional) | Specify whether invalid orders will be ignored when solving the vehicle routing problem. The default value is Values: |
ignore_network_location_fields (Optional) | Specifies whether the network location fields will be considered when locating inputs such as stops or facilities on the network. The default value is Values: |
(Optional) | Specify the spatial reference of the geometries. |
(Optional) | Specify settings that affect how inputs are located. Value: JSON object |
Required parameters
orders
Specifies one or more locations that the routes of the VRP analysis will visit. An order can represent a delivery (for example, furniture delivery), a pickup (such as an airport shuttle bus picking up a passenger), or some type of service or inspection (a tree trimming job or building inspection, for instance).
The orders
parameter can be specified using a JSON structure that represents a set of point features. The parameter is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in the
features
array represents an order and contains the following properties:-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for orders
When specifying the orders, you can set properties for each—such as its name or service time—using the following attributes:
-
Object
ID The system-managed ID field.
-
Name
The name of the order. The name must be unique. If the name is left null, a name is automatically generated at solve time.
-
Description
The descriptive information about the order. This can contain any textual information for the order and has no restrictions for uniqueness. You may want to store a client's ID number in the
Name
field and the client's actual name or address in theDescription
field. -
Service
Time This property specifies the amount of time that will be spent at the network location when the route visits it; that is, it stores the impedance value for the network location. A zero or null value indicates that the network location requires no service time.
The unit for this field value is specified by the
time
parameter._units -
Time
Window Start1 The beginning time of the first time window for the network location. This field 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
Service
from theTime Time
field.Window End1 The time window fields (
Time
,Window Start1 Time
,Window End1 Time
, andWindow Start2 Time
) must be specified in a date field as an integer that represents the number of milliseconds since epoch (January 1, 1970) and not as date-time values. The time zone for time window fields is specified using theWindow End2 time
parameter. For example, if the orders are located in the Pacific standard time zone and you want the time window to start at 8:00 a.m. (local time) on November 18, 2019, specify the value for the_zone _usage _for _time _fields Time
field as milliseconds since epoch for this date and time, which is 1574064000000. Specify theWindow Start1 time
parameter value as_zone _usage _for _time _fields GEO
._LOCAL When solving a problem that spans multiple time zones, each order's time-window values refer to the time zone in which the order is located.
-
Time
Window End1 The ending time of the first window for the network location. This field can contain a null value; a null value indicates no ending time.
-
Time
Window Start2 The beginning time of the second time window for the network location. This field can contain a null value; a null value indicates that there is no second time window.
If the first time window is null as specified by the
Time
andWindow Start1 Time
fields, the second time window must also be null.Window End1 If both time windows are non null, they can't overlap. Also, the second time window must occur after the first.
-
Time
Window End2 The ending time of the second time window for the network location. This field can contain a null value.
When
Time
andWindow Start2 Time
are both null, there is no second time window.Window End2 When
Time
is not null butWindow Start2 Time
is null, there is a second time window that has a starting time but no ending time. This is valid.Window End2 -
Max
Violation Time1 A time window is considered violated if the arrival time occurs after the time window has ended. This field specifies the maximum allowable violation time for the first time window of the order. It can contain a zero value but can't contain negative values. A zero value indicates that a time window violation at the first time window of the order is unacceptable; that is, the first time window is hard. Conversely, a null value indicates that there is no limit on the allowable violation time. A nonzero value specifies the maximum amount of lateness; for example, a route can arrive at an order up to 30 minutes beyond the end of its first time window.
The unit for this field value is specified by the
time
parameter_units Time window violations can be tracked and weighted by the solver. Consequently, you can direct the VRP solver to do one of the following:
- Minimize the overall violation time regardless of the increase in travel cost for the fleet.
- Find a solution that balances overall violation time and travel cost.
- Ignore the overall violation time and minimize the travel cost for the fleet.
By assigning an importance level for the
time
parameter, you are essentially choosing one of these options. In any case, the solver will return an error if the value set for_window _factor Max
is surpassed.Violation Time1 -
Max
Violation Time2 The maximum allowable violation time for the second time window of the order. This field is analogous to the
Max
field.Violation Time1 -
Inbound
Arrive Time Defines 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 latest start time value; this way, the route cannot leave the depot before the item is ready to be loaded onto it.
This field can help model scenarios involving inbound-wave transshipments. For example, a job at an order requires special materials that are not currently available at the depot. The materials are being shipped from another location and will arrive at the depot at 11:00 a.m. To ensure a route that leaves before the shipment arrives isn't assigned to the order, the order's inbound arrive time is set to 11:00 a.m. The special materials arrive at 11:00 a.m., they are loaded onto the vehicle, and the vehicle departs from the depot to visit its assigned orders.
-
Outbound
Depart Time Defines 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.
-
Delivery
Quantities The size of the delivery. You can specify size in any dimension, such as weight, volume, or quantity. You can also specify multiple dimensions, for example, weight and volume.
Enter delivery quantities without indicating units. For example, if a 300-pound object needs to be delivered to an order, enter 300. You will need to remember that the value is in pounds.
If you are tracking multiple dimensions, separate the numeric values with a space. For example, if you are recording the weight and volume of a delivery that weighs 2,000 pounds and has a volume of 100 cubic feet, enter 2000 100. Again, you need to remember the units—in this case, pounds and cubic feet. You also need to remember the sequence in which the values and their corresponding units are entered.
Make sure that
Capacities
for Routes andDelivery
andQuantities Pickup
for Orders are specified in the same manner; that is, the values must be in the same units. If you are using multiple dimensions, the dimensions must be listed in the same sequence for all parameters. For example, if you specify weight in pounds, followed by volume in cubic feet forQuantities Delivery
, the capacity of your routes and the pickup quantities of your orders must be specified the same way: weight in pounds, then volume in cubic feet. If you combine units or change the sequence, you will get unwanted results with no warning messages.Quantities An empty string or null value is equivalent to all dimensions being infinity. If the string has an insufficient number of values in relation to the capacity count or dimensions being tracked, the remaining values are treated as infinity. Delivery quantities can't be negative.
-
Pickup
Quantities The size of the pickup. You can specify size in any dimension, such as weight, volume, or quantity. You can also specify multiple dimensions, for example, weight and volume. You cannot, however, use negative values. This field is analogous to the
Delivery
field of Orders.Quantities In the case of an exchange visit, an order can have both delivery and pickup quantities.
-
Revenue
The income generated if the order is included in a solution. This field can contain a null value—a null value indicates zero revenue—but it can't have a negative value.
Revenue is included in optimizing the objective function value but is not part of the solution's operating cost; that is, the
Total
field in the routes never includes revenue in its output. However, revenue weights the relative importance of servicing orders.Cost -
Specialty
Names A space-separated string containing the names of the specialties required by the order. A null value indicates that the order doesn't require specialties.
The spelling of any specialties listed in the Orders and Routes classes must match exactly so that the VRP solver can link them together.
To illustrate what specialties are and how they work, assume a lawn care and tree trimming company has a portion of its orders that requires a bucket truck to trim tall trees. The company enters BucketTruck in the
Specialty
field for these orders to indicate their special need.Names Specialty
is left null for the other orders. Similarly, the company also enters BucketTruck in theNames Specialty
field of routes that are driven by trucks with hydraulic booms. It leaves the field null for the other routes. At solve time, the VRP solver assigns orders without special needs to any route, but it only assigns orders that need bucket trucks to routes that have them.Names -
Assignment
Rule Specifies the rule for assigning the order to a route. The field value is specified as one of the following integers (use the numeric code, not the name in parentheses):
- 0 (Exclude)—The order will be excluded from the subsequent solve operation.
- 1 (Preserve route and relative sequence)—The solver must always assign the order to the preassigned route at the preassigned relative sequence during the solve operation. If this assignment rule can't be followed, it results in an order violation. With this setting, only the relative sequence is maintained, not the absolute sequence. To illustrate what this means, imagine there are two orders: A and B. They have sequence values of 2 and 3, respectively. If you set their
Assignment
field values to Preserve route and relative sequence, the sequence values for A and B may change after solving because other orders, breaks, and depot visits can be sequenced before, between, or after A and B. However, B cannot be sequenced before A.Rule - 2 (Preserve route)—The solver must always assign the order to the preassigned route during the solve operation. A valid sequence must also be set even though the sequence may or may not be preserved. If the order can't be assigned to the specified route, it results in an order violation.
- 3 (Override)—The solver tries to preserve the route and sequence preassignment for the order during the solve operation. However, a new route or sequence for the order may be assigned if it helps minimize the overall value of the objective function. This is the default value.
- 4 (Anchor first)—The solver ignores the route and sequence preassignment (if any) for the order during the solve operation. It assigns a route to the order and makes it the first order on that route to minimize the overall value of the objective function.
- 5 (Anchor last)—The solver ignores the route and sequence preassignment (if any) for the order during the solve operation. It assigns a route to the order and makes it the last order on that route to minimize the overall value of the objective function.
This field can't contain a null value.
-
Curb
Approach Specifies the direction a vehicle can arrive at and depart from the order. One of the integers listed in the Coded value column in the following table must be specified as a value of this attribute. The values in the Setting column are the descriptive names for the
Curb
attribute values that you may have come across when using ArcGIS Network Analyst extension software.Approach 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. This is typically used for vehicles such as buses that must arrive with the bus stop on the right side.
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. This is typically used for vehicles such as buses that must arrive with the bus stop on the left side.
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 -
Route
Name The name of the route to which the order is assigned.
This field 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 identifies the best possible route assignment for the order. If this is set to null, the
Sequence
field must also be set to null.After a solve operation, if the order is routed, the
Route
field contains the name of the route to which the order is assigned.Name -
Sequence
This indicates the sequence of the order on its assigned route.
This field is used to specify the relative sequence of an order on the route. This field can contain a null value specifying that the order can be placed anywhere along the route. A null value can only occur together with a null
Route
value.Name The input sequence values are positive and unique for each route (shared across renewal depot visits, orders, and breaks) but do not need to start from 1 or be contiguous.
After a solve operation, the
Sequence
field contains the sequence value of the order on its assigned route. Output sequence values for a route are shared across depot visits, orders, and breaks; start from 1 (at the starting depot); and are consecutive. The smallest possible output sequence value for a routed order is 2, since a route always begins at a depot. -
Bearing
The direction in which a point is moving. The units are degrees and are measured clockwise from true north. This field is used in conjunction with the
Bearing
field.Tol 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 field 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 tool determine on which side of the street the point is.
-
Bearing
Tol The bearing tolerance value creates a range of acceptable bearing values when locating moving points on an edge using the
Bearing
field. If theBearing
field 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.
-
Nav
Latency This field is only used in the solve process if the
Bearing
andBearing
fields also have values; however, entering aTol Nav
field value is optional, even when values are present inLatency Bearing
andBearing
.Tol Nav
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.Latency The units of
Nav
are the same as the units of the impedance attribute.Latency
Syntax examples for orders
Syntax for specifying orders using JSON structure for features:
{
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>
},
"features": [
{
"geometry": {
"x": <x1>,
"y": <y1>
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"x": <x2>,
"y": <y2>
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying orders using a URL returning a JSON response:
{
"url": "<url>"
}
Examples for orders
Example 1: Specify orders in the spatial reference of the network dataset using JSON structure. This example also shows how to specify attributes for the orders.
{
"features": [
{
"geometry": {
"x": -0.1891,
"y": 51.5254
},
"attributes": {
"Name": "Order 1",
"TimeWindowStart1": null,
"TimeWindowEnd1": 1562061600000,
"MaxViolationTime1": 0,
"DeliveryQuantities": "2000 100"
}
},
{
"geometry": {
"x": -0.1744,
"y": 51.5353
},
"attributes": {
"Name": "Order 2",
"TimeWindowStart1": 1562054400000,
"TimeWindowEnd1": 1562061600000,
"MaxViolationTime1": 30,
"DeliveryQuantities": "1500 75"
}
}
]
}
Example 2: Specify orders in the Web Mercator spatial reference using JSON structure.
{
"spatialReference": {
"wkid": 102100
},
"features": [
{
"geometry": {
"x": 2698533.989,
"y": 5192521.476
},
"attributes": {
"Name": "200156",
"SpecialtyNames": "Forklift",
"PickupQuantities": 1,
"ServiceTime": 60,
"CurbApproach": 3
}
},
{
"geometry": {
"x": 2697821.094,
"y": 5191915.261
},
"attributes": {
"Name": "300242",
"DeliveryQuantities": 1,
"ServiceTime": 30
}
}
]
}
Example 3: Specify orders using a URL.
The URL makes a query for features from a map service. A URL querying features from a feature service can also be specified.
{
"url": "https://machine.domain.com/webadaptor/rest/services/NetworkAnalysis/SanDiego/MapServer/21/query?where=1%3D1&outFields=Name&f=json"
}
depots
Specifies one or more depots for the given vehicle routing problem. 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. Vehicles are loaded (for deliveries) or unloaded (for pickups) at depots. In some cases, a depot can also act as a renewal location whereby the vehicle can unload or reload and continue performing deliveries and pickups. A depot has open and close times, as specified by a hard time window. Vehicles can't arrive at a depot outside of this time window.
The depots
parameter can be specified using a JSON structure that represents a set of point features. The property is optional; however, the JSON structure must specify either the url
or the features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in the
features
array represents a depot and contains the following properties:-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for depots
When specifying the depots, you can set properties for each—such as its name or service time—using the following attributes:
-
Object
ID The system-managed ID field.
-
Name
The name of the depot. The
Start
andDepot Name End
fields on routes reference the names you specify here. It is also referenced by the route renewals, when used.Depot Name Depot names are not case sensitive but must be nonempty and unique.
-
Description
The descriptive information about the depot location. This can contain any textual information and has no restrictions for uniqueness.
For example, if you want to note which region a depot is in or the depot's address and telephone number, you can enter the information here rather than in the
Name
field. -
Time
Window Start1 The beginning time of the first time window for the network location. This field can contain a null value; a null value indicates no beginning time.
The time window fields (
Time
,Window Start1 Time
,Window End1 Time
, andWindow Start2 Time
) must be specified in a date field as an integer that represents the number of milliseconds since epoch (January 1, 1970), not as date-time values. The time zone for time window fields is specified using theWindow End2 time
parameter. For example, if the orders are located in the Pacific standard time zone and you want to specify that the time window start at 8:00 a.m. local time on November 18, 2019, the value for the_zone _usage _for _time _fields Time
field should be specified as milliseconds since epoch for this date and time, which is 1574064000000. You also should specify theWindow Start1 time
parameter value as GEO_LOCAL._zone _usage _for _time _fields When solving a problem that spans multiple time zones, each depot's time-window values refer to the time zone in which the depot is located.
-
Time
Window End1 The ending time of the first window for the network location. This field can contain a null value; a null value indicates no ending time.
-
Time
Window Start2 The beginning time of the second time window for the network location. This field can contain a null value; a null value indicates that there is no second time window.
If the first time window is null, as specified by the
Time
andWindow Start1 Time
fields, the second time window must also be null.Window End1 If both time windows are not null, they can't overlap. Also, the second time window must occur after the first.
-
Time
Window End2 The ending time of the second time window for the network location. This field can contain a null value.
When
Time
andWindow Start2 Time
are both null, there is no second time window.Window End2 When
Time
is not null butWindow Start2 Time
is null, there is a second time window that has a starting time but no ending time. This is valid.Window End2 -
Curb
Approach Specifies the direction a vehicle can arrive at and depart from the depot. One of the integers listed in the Coded value column in the following table must be specified as a value of this attribute. The values in the Setting column are the descriptive names for
Curb
attribute values that you may have come across when using the ArcGIS Network Analyst extension.Approach 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 depot 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. This is typically used for vehicles such as buses that must arrive with the bus stop on the right side.
The allowed arrival and departure combination 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. This is typically used for vehicles such as buses that must arrive with the bus stop on the left side.
The allowed arrival and departure combination for the Left side of vehicle curb approach
No U-Turn
3
When the vehicle approaches the depot, the depot can be on either side of the vehicle; however, when it departs, the vehicle must continue in the same direction in which it arrived. A U-turn is prohibited.
The allowed arrival and departure combinations 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 a depot 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 a depot 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 a depot and not have a lane of traffic between the vehicle and the depot, choose 1 (Right side of vehicle) in the United States and 2 (Left side of vehicle) in the United Kingdom.Approach -
Bearing
The direction in which a point is moving. The units are degrees and are measured clockwise from true north. This field is used in conjunction with the
Bearing
field.Tol 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 field 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 tool determine on which side of the street the point is.
-
Bearing
Tol The bearing tolerance value creates a range of acceptable bearing values when locating moving points on an edge using the
Bearing
field. If theBearing
field 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.
-
Nav
Latency This field is only used in the solve process if the
Bearing
andBearing
fields also have values; however, entering aTol Nav
field value is optional, even when values are present inLatency Bearing
andBearing
.Tol Nav
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.Latency The units of
Nav
are the same as the units of the impedance attribute.Latency
Syntax examples for depots
Syntax for specifying depots using JSON structure for features
{
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>
},
"features": [
{
"geometry": {
"x": <x1>,
"y": <y1>
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"x": <x2>,
"y": <y2>
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying depots using a URL returning a JSON response
{
"url": "<url>"
}
Examples for depots
Example 1: Specify depots in the spatial reference of the network dataset using JSON structure. The example also shows how to specify attributes for the depots.
{
"features": [
{
"geometry": {
"x": -0.1891,
"y": 51.5254
},
"attributes": {
"Name": "Depot1",
"TimeWindowStart1": null,
"TimeWindowEnd1": "1358362800000"
}
},
{
"geometry": {
"x": -0.1744,
"y": 51.5353
},
"attributes": {
"Name": "Depot2",
"TimeWindowStart1": "1358359200000",
"TimeWindowEnd1": "1358362800000"
}
}
]
}
Example 2: Specify depots in the Web Mercator spatial reference using JSON structure.
{
"spatialReference": {
"wkid": 102100
},
"features": [
{
"geometry": {
"x": 2698533.989,
"y": 5192521.476
},
"attributes": {
"Name": "400181",
"CurbApproach": 3
}
},
{
"geometry": {
"x": 2697821.094,
"y": 5191915.261
},
"attributes": {
"Name": "400161",
"CurbApproach": 1
}
}
]
}
Example 3: Specify depots using a URL.
The URL makes a query for a few features from a map service. A URL querying features from a feature service can also be specified.
{
"url": "https://machine.domain.com/webadaptor/rest/services/NetworkAnalysis/SanDiego/MapServer/21/query?where=1%3D1&outFields=Name&f=json"
}
routes
Specifies 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.
The routes
parameter can be specified using a JSON structure that represents a set of point features. The property is optional; however, the JSON structure must specify either the url
or the features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in the
features
array represents a route and contains the following properties:-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for routes
When specifying the routes, you can specify additional properties, such as their names or capacities, using attributes. The routes
parameter can be specified with the following attributes:
-
Name
The name of the route. The name must be unique.
The service generates a unique name if the attribute value is null. Therefore, specifying a value is optional in most cases. However, you must specify a name if the analysis includes breaks, route renewals, route zones, or orders that are preassigned to a route because the route name is used as a foreign key in these cases. Route names are not case sensitive.
-
Start
Depot Name The name of the starting depot for the route. This attribute is a foreign key to the
Name
attribute in thedepots
parameter, so the values must match.If the
Start
value is null, the route will begin from the first order assigned. Omitting the start depot is useful when the vehicle's starting location is unknown or irrelevant to the routing problem. However, whenDepot Name Start
is null,Depot Name End
cannot also be null.Depot Name Virtual start depots are not allowed if orders or depots are in multiple time zones.
If the route is making deliveries and
Start
is null, it is assumed the cargo is loaded on the vehicle at a virtual depot before the route begins. For a route that has no renewal visits, its delivery orders (those with nonzeroDepot Name Delivery
values in theQuantities orders
parameter) are loaded at the start depot or virtual depot. For a route that has renewal visits, only the delivery orders before the first renewal visit are loaded at the start depot or virtual depot. -
End
Depot Name The name of the ending depot for the route. This attribute is a foreign key to the
Name
attribute in thedepots
parameter, so the values must match. -
Start
Depot Service Time 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; a null value indicates zero service time. The unit for this attribute value is specified by the
time
parameter._units -
End
Depot Service Time 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; a null value indicates zero service time. The unit for this attribute value is specified by the
time
parameter._units The service times at the start and end depots are fixed values (given by the
Start
andDepot Service Time End
attribute values) and do not take into account the actual load for a route. For example, the time taken to load a vehicle at the starting depot may depend on the size of the orders. The depot service times can be given values corresponding to a full truckload or an average truckload, or you can make your own time estimate.Depot Service Time -
Earliest
Start Time The earliest allowable starting time for the route. This is used by the service in conjunction with the time window of the starting depot for determining feasible route start times.
This attribute can't contain null values and has a default time-only value of 8:00 AM on the date specified by the
default
parameter or the current date if unspecified._date -
Latest
Start Time The latest allowable starting time for the route. This attribute can't contain null values and has a default time-only value of 10:00 AM; the default value is interpreted as 10:00 a.m. on the date specified by the
default
parameter._date The value for the
Earliest
andStart Time Latest
attributes is specified in a date field as an integer that represents the number of milliseconds since epoch (January 1, 1970).Start Time The time zone is specified using the
time
parameter. If set to_zone _usage _for _time _fields GEO
, the time is in the time zone where the route's depot is located. This is useful if the routes span multiple time zones but they all start at a consistent time (for example, 8:00 a.m. in the depot's time zone). If the parameter is set to_LOCAL UTC
, the time is based on UTC. This is useful if you don't know the time zone of an individual route's depot but know its absolute time (for example, the time window starts an hour from now). -
Arrive
Depart Delay This stores 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). By including an
Arrive
value, the service is deterred from sending many routes to service physically coincident orders.Depart Delay The cost for this attribute is incurred between visits to noncoincident orders, depots, and route renewals. 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, the
Arrive
value is not added between them because the vehicle doesn't need to move. If the route travels to a route renewal, the value is added to the travel time again.Depart Delay Although a vehicle needs to slow down and stop for a break and accelerate afterward, the service cannot add the
Arrive
value for breaks. This means that if a route leaves an order, stops for a break, and continues to the next order, the arrive/depart delay is added only once, not twice.Depart Delay For example, there are five coincident orders in a high-rise building, and they are serviced by three routes. This means three arrive/depart delays would be incurred; that is, three drivers would need to separately find parking places and enter the same building. However, if the orders could be serviced by just one route, only one driver would need to park and enter the building—only one arrive/depart delay would be incurred. Since the service tries to minimize cost, it will try to limit the arrive/depart delays and use the single-route option. (Multiple routes may need to be sent when other constraints—such as specialties, time windows, or capacities—require it.)
The unit for this attribute value is specified by the
time
parameter._units -
Capacities
The maximum capacity of the vehicle. You can specify capacity in any dimension, such as weight, volume, or quantity. You can also specify multiple dimensions, for example, weight and volume.
Specify capacities without indicating units. For example, if a vehicle can carry a maximum of 40,000 pounds, specify 40000 as the value for the
Capacities
attribute. You need to remember for future reference that the value is in pounds.If you are tracking multiple dimensions, separate the numeric values with a space. For example, if you are recording both weight and volume and your vehicle can carry a maximum weight of 40,000 pounds and a maximum volume of 2,000 cubic feet, specify
40000 2000
forCapacities
. Again, you need to remember the units. You also need to remember the sequence in which the values and their corresponding units are specified (pounds followed by cubic feet in this case).Remembering the units and the unit sequence is important for a couple of reasons: first, so you can reinterpret the information later, and second, so you can properly enter values for the
Delivery
andQuantities Pickup
attributes in theQuantities orders
parameter. The service simultaneously checks theCapacities
,Delivery
, andQuantities Pickup
attributes to make sure that a route doesn't become overloaded. Since units can't be entered in the field, the service can't make unit conversions, so you need to specify the values for the three attributes using the same units and the same unit sequence to ensure the values are correctly interpreted. If you combine units or change the sequence in any of the three attributes, you will get unwanted results without receiving any warning messages. It is recommended that you set up a unit and unit-sequence standard before you start and refer to it when specifying values for these three attributes.Quantities An empty string or null value is equivalent to all values being zero. Capacity values can't be negative.
If the
Capacities
string has an insufficient number of values in relation to theDelivery
orQuantities Pickup
attributes in theQuantities orders
parameter, the remaining values are treated as zero. -
Fixed
Cost A fixed monetary cost that is incurred only if the route is used in a solution (that is, it has orders assigned to it). This attribute can contain null values; a null value indicates zero fixed cost. This cost is part of the total route operating cost.
-
Cost
Per Unit Time 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, depots, and breaks. This attribute can't 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 -
Cost
Per Unit Distance The monetary cost incurred per unit of distance traveled for the route length (total travel distance). This attribute can contain null values; a null value indicates zero cost. The unit for this attribute value is specified by the
distance
parameter._units -
Over
Time Start Time The duration of regular work time before overtime computation begins. This attribute can contain null values; a null value indicates that overtime does not apply. The unit for this attribute value is specified by the
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 asStart Time 480
(8 hours * 60 minutes/hour), given thetime
parameter is set to_units Minutes
. -
Cost
Per Unit Overtime The monetary cost incurred per time unit of overtime work. This attribute can contain null values; a null value indicates that the
Cost
value is the same as thePer Unit Overtime Cost
value. The unit for this attribute value is specified by thePer Unit Time time
parameter._units -
Max
Order Count The maximum allowable number of orders on the route. This attribute can't contain null values and has a default value of 30.
-
Max
Total Time The maximum allowable route duration. The route duration includes travel times as well as service and wait times at orders, depots, and breaks. This attribute can contain null values; a null value indicates that there is no constraint on the route duration. The unit for this attribute value is specified by the
time
parameter._units -
Max
Total Travel Time The maximum allowable travel time for the route. The travel time includes only the time spent driving on the streets and does not include service or wait times. This attribute can contain null values; a null value indicates there is no constraint on the maximum allowable travel time. This attribute value can't be larger than the
Max
attribute value. The unit for this attribute value is specified by theTotal Time time
parameter._units -
Max
Total Distance The maximum allowable travel distance for the route. This attribute can contain null values; a null value indicates that there is no constraint on the maximum allowable travel distance. The unit for this attribute value is specified by the
distance
parameter._units -
Specialty
Names A space-separated string containing the names of the specialties supported by the route. A null value indicates that the route does not support any specialties. This attribute is a foreign key to the
Specialty
attribute in theNames orders
parameter, so the values must match.For example, a lawn care and tree trimming company has a portion of its orders that requires a bucket truck to trim tall trees. The company specifies
Bucket
as the value for theTruck Specialty
attribute for these orders to indicate their special need.Names Specialty
is left as null for the other orders. Similarly, the company also specifiesNames Bucket
as the value for theTruck Specialty
attribute for the routes that are driven by trucks with hydraulic booms. It leaves the attribute value as null for the other routes. When finding the solution, the service assigns orders without special needs to any route, but it only assigns orders that need bucket trucks to routes that have them.Names -
Assignment
Rule Specifies whether the route can be used when solving the problem. The attribute value should be specified as one of the following integer values:
0
—The route is excluded from the solution.1
—The route is included when finding the solution. This is the default value.
Syntax examples for routes
Syntax for specifying routes using JSON structure for features
{
"features": [
{
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying routes using a URL returning a JSON response
{
"url": "<url>"
}
Example for routes
Example: Specify routes using JSON structure.
Unlike the depots
and orders
parameters, the spatial
and geometry
properties are not required when specifying the routes
parameter. This example also shows how to specify attributes for the depots.
{
"features": [
{
"attributes": {
"Name": "Truck1",
"Capacities": "40000 2000",
"StartDepotName": "Depot1",
"EndDepotName": "Depot1",
"SpecialtyNames": "BucketTruck"
}
},
{
"attributes": {
"Name": "Truck2",
"Capacities": "30000 2500",
"StartDepotName": "Depot2",
"EndDepotName": "Depot2",
"SpecialtyNames": null
}
}
]
}
token
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.
token=<yourToken>
f
Use this parameter to specify the response format. The parameter can have html
, json
or pjson
as arguments, for example, f=json
. The pjson
value is used for printing the JSON response in a prettified format.
Optional parameters
default_date
Use this parameter to specify the date all of the routes start.
Specify the parameter value should as a numeric value representing the milliseconds since midnight, January 1, 1970.
Only the date portion of this value will be used; the time-specific portion of the value will be ignored.
You can use the same value that you have specified for the Earliest
attribute for each route feature in the routes
parameter. If the routes start on different dates, you can use any date from one of them.
travel_mode
Choose the mode of transportation for the analysis.
Travel modes are managed in ArcGIS Enterprise and can be configured by the administrator of your organization to better reflect the organization's workflows.
To learn more about travel modes, see Configure travel modes.
You must specify the JSON object containing the settings for a travel mode supported by your organization. To get a list of supported travel modes, execute the Get
tool from the Utilities service.
The value for the travel
parameter should be a JSON object representing travel mode settings. When you use the Get
tool from the Utilities service, you get a string representing the travel mode JSON. You need to convert this string to a valid JSON object using your API and then pass the JSON object as the value for the travel
parameter.
For example, below is a string representing the Walking Time travel mode as returned by the Get
tool.
"{\"attributeParameterValues\": [{\"parameterName\": \"Restriction Usage\", \"attributeName\": \"Walking\", \"value\": \"PROHIBITED\"}, {\"parameterName\": \"Restriction Usage\", \"attributeName\": \"Preferred for Pedestrians\", \"value\": \"PREFER_LOW\"}, {\"parameterName\": \"Walking Speed (km/h)\", \"attributeName\": \"WalkTime\", \"value\": 5}], \"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.\", \"impedanceAttributeName\": \"WalkTime\", \"simplificationToleranceUnits\": \"esriMeters\", \"uturnAtJunctions\": \"esriNFSBAllowBacktrack\", \"restrictionAttributeNames\": [\"Preferred for Pedestrians\", \"Walking\"], \"useHierarchy\": false, \"simplificationTolerance\": 2, \"timeAttributeName\": \"WalkTime\", \"distanceAttributeName\": \"Miles\", \"type\": \"WALK\", \"id\": \"caFAgoThrvUpkFBW\", \"name\": \"Walking Time\"}"
The above value should be converted to a valid JSON object and passed as the value for the travel
parameter.
travel_mode={"attributeParameterValues":[{"parameterName":"Restriction Usage","attributeName":"Walking","value":"PROHIBITED"},{"parameterName":"Restriction Usage","attributeName":"Preferred for Pedestrians","value":"PREFER_LOW"},{"parameterName":"Walking Speed (km/h)","attributeName":"WalkTime","value":5}],"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.","impedanceAttributeName":"WalkTime","simplificationToleranceUnits":"esriMeters","uturnAtJunctions":"esriNFSBAllowBacktrack","restrictionAttributeNames":["Preferred for Pedestrians","Walking"],"useHierarchy":false,"simplificationTolerance":2,"timeAttributeName":"WalkTime","distanceAttributeName":"Miles","type":"WALK","id":"caFAgoThrvUpkFBW","name":"Walking Time"}
The default value,Custom
, allows you to configure your own travel mode. When you pass in Custom
, you can set values for the following parameters: impedance
, time
, distance
, uturn
, use
, route
, restrictions
, and attribute
. You can choose Custom
and set the custom travel mode parameters listed above, for example, to model a pedestrian with a fast walking speed or a truck with a given height, weight, and cargo of certain hazardous materials. You can try out different settings to get desired analysis results. Once you have identified the analysis settings, you should work with your organization's administrator and save these settings as part of new or existing travel mode so that everyone in your organization can rerun the analysis with the same settings.
The default values of the custom travel mode parameters model traveling by car. If you specify the travel mode as Custom
or do not provide a value for the travel
parameter, the analysis will be similar to using the default Driving Time
travel mode.
time_zone_usage_for_time_fields
Use this parameter to specify the time zone for the input date-time fields. This parameter specifies the time zone for the following fields: Time
, Time
, Time
, Time
, Inbound
, and Outbound
on orders
; Time
, Time
, Time
, and Time
on depots
; Earliest
and Latest
on routes
; and Time
and Time
on breaks
.
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 breaks, the date-time values are based on the time zone of the routes. 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 Start1 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 End1 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 Start1 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 End1
impedance
Specify the impedance.
Impedance is a value that quantifies travel along the transportation network. Travel distance is an example of impedance; it quantifies the length of walkways and road segments. Similarly, drive time—the typical time it takes to drive a car along a road segment—is an example of impedance. Drive times may vary by type of vehicle—for instance, the time it takes for a truck to travel along a path tends to be longer than a car—so there can be many impedance values representing travel times for different vehicle types. Impedance values may also vary with time; live and typical traffic reference dynamic impedance values. Each walkway and road segment stores at least one impedance value. When performing a network analysis, the impedance values are used to calculate the best results, such as finding the shortest route—the route that minimizes impedance—between two points.
The impedance
parameter can be specified using the following values:
- TravelTime—Historical and live traffic data is used. This option is good for modeling the time it takes automobiles to travel along roads at a specific time of day using live traffic speed data where available. When using TravelTime, you can optionally set the TravelTime::Vehicle Maximum Speed (km/h) attribute parameter to specify the physical limitation of the speed the vehicle is capable of traveling.
- Minutes—Live traffic data is not used, but historical average speeds for automobiles data is used.
- TruckTravelTime—Historical and live traffic data is used, but the speed is capped at the posted truck speed limit. This is good for modeling the time it takes for the trucks to travel along roads at a specific time. When using TruckTravelTime, you can optionally set the TruckTravelTime::Vehicle Maximum Speed (km/h) attribute parameter to specify the physical limitation of the speed the truck is capable of traveling.
- TruckMinutes—Live traffic data is not used, but the smaller of the historical average speeds for automobiles and the posted speed limits for trucks are used.
- WalkTime—The default is a speed of 5 km/hr on all roads and paths, but this can be configured through the WalkTime::Walking Speed (km/h) attribute parameter.
- Miles—Length measurements along roads are stored in miles and can be used for performing analysis based on shortest distance.
- Kilometers—Length measurements along roads are stored in kilometers and can be used for performing analysis based on shortest distance.
If you choose a time-based impedance, such as Travel
, Truck
, Minutes
, Truck
, or Walk
, the measurement
parameter must be set to a time-based value; if you choose a distance-based impedance such as Miles
, Kilometers
, the measurement
must be distance-based.
breaks
These are the rest periods, or breaks, for the routes in a given vehicle routing problem. A break is associated with exactly one route and can be taken after completing an order, while en route to an order, or prior to servicing an order. It has a start time and a duration for which the driver may or may not be paid. There are three options for establishing when a break begins: a time window, a maximum travel time, or a maximum work time.
Use this parameter to specify the rest periods, or breaks, for the routes in a given vehicle routing problem. A break is associated with exactly one route, and it can be taken after completing an order, while en route to an order, or prior to servicing an order. It has a start time and a duration, for which the driver may or may not be paid. There are three options for establishing when a break begins: using a time window, a maximum travel time, or a maximum work time.
- Time window break—To set up a time window break, enter two time-of-day values to delimit a time range in which the break should begin. The
Time
andWindow Start Time
attributes contain the bounding time-of-day values. The duration, or service time, of the break is independent of the time window and can extend beyond the end of the time window. For instance, if the time window for an hour-long break spans from 10:00 a.m. to 10:15 a.m., the break should start after 10:00 a.m. but before 10:15 a.m. If it starts at 10:10 a.m., the break will end at 11:10 a.m.Window End - Maximum travel time break—With this break option, you specify how long a person can drive before the break is required. (Only travel time is limited; other times such as wait and service times are not.) If you enter four hours into the first break's
Max
property, for example, the driver will receive a break before the accumulated travel time from the start of the route exceeds four hours. For any subsequent breaks, the travel time is accumulated from the previous break. So if you have a second break with aTravel Time Between Breaks Max
value of two hours, the second break will be taken before two hours of travel time have been accumulated from the previous break, not from the start depot. A route's final maximum travel time break not only limits the amount of accumulated travel time from the previous break or start of the route but also limits the travel time from the final break to the end depot. This is true even if there is only one break. The VRP service is designed this way to prevent a route from taking all its breaks and then traveling for an extended period without taking another break. In the last example,Travel Time Between Breaks Max
was set to two hours. If this is the route's final break, the route must be able to reach the end depot within two hours of travel time from the final break; otherwise, the service will return an error.Travel Time Between Breaks - Maximum work time break—This break option specifies how long a person can work before a break is required. Unlike maximum travel time breaks, which can accumulate travel time from the end of the last break, maximum work time breaks always accumulate work time from the beginning of the route, including any service time at the start depot. This break limits the accumulated work time, which includes travel time and all service times; it excludes wait time, however.
The breaks
parameter can be specified using a JSON structure that represents a set of features. The property is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in the
features
array represents a break and contains the following properties:-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for breaks
When specifying the breaks, you can specify additional properties for breaks, such as their time windows or duration, using attributes. The breaks
parameter can be specified with the following attributes:
-
Route
Name The name of the route that the break applies to. Although a break is assigned to exactly one route, many breaks can be assigned to the same route. This attribute is a foreign key to the
Name
attribute in theroutes
parameter, so the values must match. The attribute cannot have a null value. -
Precedence
Specifies the values to sequence the breaks of a given route. Breaks with a precedence value of 1 occur before those with a value of 2, and so on. All breaks must have a precedence value, regardless of whether they are time window, maximum travel time, or maximum work time breaks. The default value for this attribute is 1.
-
Service
Time The duration of the break. The units for this attribute value are specified by the
time
parameter. This attribute can't contain a null value. The default value for this attribute is 60._units -
Time
Window Start The starting time of the break's time window. Specifying this attribute indicates that the service will consider the breaks as time window breaks. The attribute value is specified as a numeric value representing the milliseconds since midnight, January 1, 1970.
If this attribute is null and the
Time
attribute has a valid time-of-day value, the break is allowed to start anytime before theWindow End Time
value.Window End The default value for this attribute is
null
. -
Time
Window End The ending time of the break's time window. Specifying this attribute indicates that the service will consider the breaks as time window breaks. The attribute value is specified as a numeric value representing the milliseconds since midnight, January 1, 1970.
If this attribute is null and the
Time
attribute has a valid time-of-day value, the break is allowed to start anytime after theWindow Start Time
value.Window Start The default value for this attribute is
null
.For both the
Time
andWindow Start Time
attributes, the time zone is specified by theWindow End time
parameter. If the parameter is set to_zone _usage _for _time _fields GEO
, the time is in the time zone where the route's depot is located. This is useful if the routes span multiple time zones but they all break at a consistent time (for example, 12:00 p.m. in the depot's time zone). If the parameter is set to_LOCAL UTC
, the time is based on UTC time. This is useful if you don't know the time zone of an individual route's depot but know the absolute time for each break (for example, the break starts an hour from now). -
Max
Violation Time Specifies the maximum allowable violation time for a time window break. A time window is considered violated if the arrival time falls outside of the time range. The units for this attribute value are specified by the
time
parameter._units A zero value indicates that the time window cannot be violated; that is, the time window is hard. A nonzero value specifies the maximum amount of lateness; for example, the break can begin up to 30 minutes beyond the end of its time window, but the lateness is penalized pursuant to the
time
parameter. A null value indicates that there is no limit on the allowable violation time._window _factor The default value for this attribute is
null
. -
Max
Travel Time Between Breaks The maximum amount of travel time that can be accumulated before the break is taken. Specifying this attribute indicates that the service will consider the breaks as travel time breaks. The travel time is accumulated either from the end of the previous break or, if a break has not yet been taken, from the start of the route. If this is the route's final break, this attribute also indicates the maximum travel time that can be accumulated from the final break to the end depot.
The
Max
attribute is designed to limit how long a person can drive until a break is required. For instance, if theTravel Time Between Breaks time
parameter is set to_units Minutes
, andMax
has a value of 120, the driver will get a break after two hours of driving. To assign a second break after two more hours of driving, the second break'sTravel Time Between Breaks Max
attribute value must be 120.Travel Time Between Breaks The units for this attribute value are specified by the
time
parameter. The default value for this attribute is_units null
. -
Max
Cumul Work Time The maximum amount of work time that can be accumulated before the break is taken. Specifying this attribute indicates that the service will consider the breaks as work time breaks. Work time is always accumulated from the beginning of the route. Work time is the sum of travel time and service times at orders, depots, and breaks. However, this excludes wait time, which is the time a route (or driver) spends waiting at an order or depot for a time window to begin.
The
Max
attribute limits how long a person can work until a break is required. For instance, if theCumul Work Time time
parameter is set to_units Minutes
, theMax
attribute has a value ofCumul Work Time 120
, and theService
attribute has a value ofTime 15
, the driver will get a 15-minute break after two hours of work. If a second break is needed after three more hours of work, specify315
(five hours and 15 minutes) as the second break'sMax
value. This number includes theCumul Work Time Max
andCumul Work Time Service
values of the preceding break, along with the three additional hours of work time before granting the second break. To avoid taking maximum work time breaks prematurely, remember that they accumulate work time from the beginning of the route and that work time includes the service time at previously visited depots, orders, and breaks.Time The units for this attribute value are specified by the
time
parameter. The default value for this attribute is_units null
. -
Is
Paid Specifies whether the break is paid or unpaid. The attribute value is specified as an integer with possible values of 0 or 1. A value of 1 indicates that the time spent at the break is included in the route cost computation and overtime determination. A value of 0 indicates otherwise. The default value for this attribute is 1.
-
Sequence
Indicates the relative sequence of the break on its route. The attribute values must be positive and unique for each route but do not need to start from 1 or be contiguous. In the service output, the
Sequence
attribute of theout
parameter contains the sequence value of the break on its route. This attribute can have_stops null
values specifying that the break can be placed anywhere along the route. The default value for this attribute isnull
.
Syntax examples for breaks
Syntax for specifying breaks using JSON structure for features
{
"features": [
{
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying breaks using a URL returning a JSON response
{
"url": "<url>"
}
Examples for breaks
Example 1: Specify time-window-based breaks using JSON structure.
This example shows how to specify time-window-based breaks by specifying the values for the Time
and the Time
attributes. The input vehicle routing problem requires that each of three routes have one 30-minute paid break between 12:30 p.m. and 1:30 p.m. The break time window is hard, so the break must start between 12:30 p.m. and 1:30 p.m. and cannot start after 1:30 p.m.
You must specify one break for each route, so you have a total of three features. Specify the appropriate milliseconds since January 1, 1970, for 12:30 p.m. Pacific time on April 23, 2013, as the value for the Time
attribute and the appropriate milliseconds since January 1, 1970, for 1:30 p.m. on April 23, 2013, as the value for the Time
attribute. Because the break time window is hard, specify a value of 0 for the Max
attribute. Because the break duration is 30 minutes, specify a value of 30 for the Service
attribute assuming the time
parameter is set to Minutes
. For each break, only specify the attribute values required to model the input scenario. The other attribute values are not specified because their default values are adequate in this scenario.
{
"features": [
{
"attributes": {
"RouteName": "Truck1",
"TimeWindowStart": 1366745400000,
"TimeWindowEnd": 1366749000000,
"ServiceTime": 30,
"MaxViolationTime": 0
}
},
{
"attributes": {
"RouteName": "Truck2",
"TimeWindowStart": 1366745400000,
"TimeWindowEnd": 1366749000000,
"ServiceTime": 30,
"MaxViolationTime": 0
}
},
{
"attributes": {
"RouteName": "Truck3",
"TimeWindowStart": 1366745400000,
"TimeWindowEnd": 1366749000000,
"ServiceTime": 30,
"MaxViolationTime": 0
}
}
]
}
Example 2: Specify travel-time-based breaks using JSON structure.
This example shows how to specify travel-time-based breaks by specifying the value for the Max
attribute. The input vehicle routing problem requires that the driver for each of the two routes have one 15-minute unpaid break after two hours of driving and another unpaid break after an additional two hours of driving.
You must specify two breaks for each route, so you have a total of four features. The first break for each route has a precedence value of 1 and the second break has a precedence value of 2. As each break on the route must occur after two hours of travel time, specify the Max
attribute value as 120 for both breaks on a route assuming that the time
parameter is set to Minutes
. Because the break duration is 15 minutes, specify a value of 15 for the Service
attribute. Because the break is unpaid, specify a value of 0 for the Is
attribute. The other attribute values are not specified because their default values are adequate in this scenario.
{
"features": [
{
"attributes": {
"RouteName": "Truck1",
"Precedence": 1,
"ServiceTime": 15,
"MaxTravelTimeBetweenBreaks": 120,
"IsPaid": 0
}
},
{
"attributes": {
"RouteName": "Truck1",
"Precedence": 2,
"ServiceTime": 15,
"MaxTravelTimeBetweenBreaks": 120,
"IsPaid": 0
}
},
{
"attributes": {
"RouteName": "Truck2",
"Precedence": 1,
"ServiceTime": 15,
"MaxTravelTimeBetweenBreaks": 120,
"IsPaid": 0
}
},
{
"attributes": {
"RouteName": "Truck2",
"Precedence": 2,
"ServiceTime": 15,
"MaxTravelTimeBetweenBreaks": 120,
"IsPaid": 0
}
}
]
}
Example 3: Specify work-time-based breaks using JSON structure.
This example shows how to specify work-time-based breaks by specifying the value for the Max
attribute. The input vehicle routing problem requires that the driver for each of the two routes have one 15-minute paid break after two hours of work time and a second 15-minute paid break after three hours of work time since the first break.
You must specify two breaks for each route, so you have a total of four features. The first break for each route has a precedence value of 1 and the second break has a precedence value of 2. Because the first break on each route must occur after two hours of work, specify the Max
attribute value as 120 for the first break on a route assuming that the time
parameter is set to Minutes
. Because the second break is needed after three more hours of work, specify 315 (five hours and 15 minutes) as the second break's Max
value. This number includes the Max
and Service
values of the preceding break, along with the three additional hours of work time before granting the second break (120+15+180=315). Because the break duration is 15 minutes, specify a value of 15 for the Service
attribute. The other attribute values are not specified because their default values are adequate in this scenario.
{
"features": [
{
"attributes": {
"RouteName": "Truck1",
"Precedence": 1,
"ServiceTime": 15,
"MaxCumulWorkTime": 120
}
},
{
"attributes": {
"RouteName": "Truck1",
"Precedence": 2,
"ServiceTime": 15,
"MaxCumulWorkTime": 315
}
},
{
"attributes": {
"RouteName": "Truck2",
"Precedence": 1,
"ServiceTime": 15,
"MaxCumulWorkTime": 120
}
},
{
"attributes": {
"RouteName": "Truck2",
"Precedence": 2,
"ServiceTime": 15,
"MaxCumulWorkTime": 315
}
}
]
}
time_units
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
The default value is Minutes
Many parameters in the vehicle routing problem request 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 the time
parameter is used to specify the units of those values.
distance_units
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
The default value is Miles
Many parameters in the vehicle routing problem request have attributes for storing distance values, such as Max
and Cost
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 the distance
parameter is used to specify the units of those values.
analysis_region
This parameter is ignored by the service and specifying a value does not have any effect on the analysis.
uturn_policy
Use this parameter to restrict or permit the route from making U-turns at junctions.
To understand the available parameter values, a junction is a point where only two streets intersect each other. If three or more streets intersect at a point, it is called as an intersection. A cul-de-sac is a dead-end. This parameter can have the following values:
Parameter Value | Description |
---|---|
| U-turns are permitted everywhere. Permitting U-turns implies that the vehicle can turn around at a junction and double back on the same street. U-turns are permitted at junctions with any number of adjacent streets. |
| U-turns are prohibited at junctions where exactly two adjacent streets meet. U-turns are permitted only at intersections or dead ends. |
| U-turns are prohibited at all junctions and intersections and are permitted only at dead ends. U-turns are permitted only at dead ends. |
| U-turns are prohibited at all junctions, intersections, and dead-ends. Even when this parameter value is chosen, a route can still make U-turns at stops. To prohibit U-turns at a stop, you can set its |
The default value for this parameter is ALLOW
.
time_window_factor
Use this parameter to rate the importance of honoring time windows without causing violations. A time window violation occurs when a route arrives at an order, depot, or break after a time window has closed. The parameter is specified using one of the following values:
Low
—Places more importance on minimizing drive times and less on arriving at stops on time. You may want to use this value if you have a growing backlog of service requests. For the purpose of servicing more orders in a day and reducing the backlog, you can chooseLow
even though customers might be inconvenienced with your late arrivals.Medium
—Balances the importance of minimizing drive times and arriving within time windows.High
—Places more importance on arriving at stops on time than on minimizing drive times. Organizations that make time-critical deliveries or that are very concerned with customer service would choose a value ofHigh
.
The default value is Medium
The vehicle routing problem solution can change according to the value you choose for the time
parameter. The next two images show the same set of orders and depots; however, the routes are not the same because different time
values were used. The image on the left shows the route that resulted from the time
parameter set to Low
. The route is short, but it has a time window violation. If time
is set to High
, the route meets all the time windows, but it is longer because it services the order with a time window first.
spatially_cluster_routes
Use this parameter to specify if orders assigned to an individual route are spatially clustered.
true
—Indicates that the orders assigned to an individual route are spatially clustered by automatically creating dynamic seed points for all the routes. Clustering orders usually results in routes that cover a smaller area and don't intersect other routes as much, but the overall cost of the solution could be more. You might want to cluster orders to keep drivers in general neighborhoods or regions that they are familiar with, or you might want to have compartmentalized routes if they are easier for your organization to manage.false
—Indicates that the orders assigned to an individual route are not spatially clustered. Use this value if you have predefined work territories for the routes that are specified using theroute
parameter._zones
The default value for this parameter is true
.
route_zones
Delineates work territories for given routes. A route zone is a polygon feature used to constrain routes to servicing only those orders that fall within or near the specified area. The following are examples of when route zones may be useful:
- Some of your employees don't have the required permits to perform work in certain states or communities. You can create a hard route zone so they only visit orders in areas where they meet the requirements.
- One of your vehicles breaks down frequently and you want to minimize response time by having it only visit orders that are close to your maintenance garage. You can create a soft or hard route zone to keep the vehicle nearby.
The route
parameter can be specified using a JSON structure that represents a set of point features. The property is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in the
features
array represents a route zone and contains the following properties:-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for route_zones
When specifying the route
parameter, you can specify additional information about route zones, such as the name of the route to which the route zone applies, using attributes. The route
parameter can be specified with the following attributes:
-
Route
Name The name of the route to which this zone applies. A route zone can have a maximum of one associated route. This attribute is a foreign key to the
Name
attribute in theroutes
parameter, so the values must match. The attribute cannot have anull
value. -
Is
Hard Zone Specifies whether the route zone is hard or soft. The attribute value is specified as an integer with possible values of 0 or 1. A value of 1 indicates that the route zone is hard; that is, an order that falls outside of the route zone area can't be assigned to the route. A value of 0 indicates that such orders 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.
Syntax examples for route_zones
Syntax for specifying route zones using JSON structure for features
{
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>
},
"features": [
{
"geometry": {
"rings": [
[
[<x11>,<y11>],
[<x12>,<y12>],
[<x11>,<y11>]
],
[
[<x21>,<y21>],
[<x22>,<y22>],
[<x21>,<y21>]
]
]
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"rings": [
[
[<x11>,<y11>],
[<x12>,<y12>],
[<x11>,<y11>]
],
[
[<x21>,<y21>],
[<x22>,<y22>],
[<x21>,<y21>]
]
]
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying route zones using a URL returning a JSON response
{
"url": "<url>"
}
Examples for route_zones
Example 1: Specify route zones using JSON structure.
The example shows how to add route zones associated with the routes in a vehicle routing problem. The two routes in the input vehicle routing problem are operated by vans that are only licensed to service orders in a predetermined area and cannot service orders that are outside of the route zone. The Is
attribute value is set to 1 to ensure that the vans are only assigned orders that are within the route zones.
The first zone is a single-part polygon feature composed of four points. The second zone is a two-part polygon feature in which both parts are composed of four points. The barrier geometries are in the spatial reference of the network dataset. The spatial
property is not required.
{
"features": [
{
"geometry": {
"rings": [
[
[-97.0634,32.8442],
[-97.0554,32.84],
[-97.0558,32.8327],
[-97.0638,32.83],
[-97.0634,32.8442]
]
]
},
"attributes": {
"RouteName": "East Bay Route",
"IsHardZone": 1
}
},
{
"geometry": {
"rings": [
[
[-97.0803,32.8235],
[-97.0776,32.8277],
[-97.074,32.8254],
[-97.0767,32.8227],
[-97.0803,32.8235]
],
[
[-97.0871,32.8311],
[-97.0831,32.8292],
[-97.0853,32.8259],
[-97.0892,32.8279],
[-97.0871,32.8311]
]
]
},
"attributes": {
"Name": "North Bay Route",
"IsHardZone": 1
}
}
]
}
Example 2: Specify route zones using a URL.
The URL makes a query for a few features from a map service. A URL querying features from a feature service can also be specified.
{
"url": "https://machine.domain.com/webadaptor/rest/services/Network/USA/MapServer/7/query?where=1%3D1&returnGeometry=true&f=json"
}
route_renewals
Specifies the intermediate depots that routes can visit to reload or unload the cargo they are delivering or picking up. Specifically, a route renewal links a route to a depot. The relationship indicates the route can renew (reload or unload while en route) at the associated depot.
Route renewals can be used to model scenarios in which a vehicle picks up a full load of deliveries at the starting depot, services the orders, returns to the depot to renew its load of deliveries, and continues servicing more orders. For example, in propane gas delivery, the vehicle may make several deliveries until its tank is nearly or completely depleted, visit a refueling point, and make more deliveries.
Here are a few rules and options to consider:
- The reload/unload point, or renewal location, can be different from the start or end depot.
- Each route can have one or many predetermined renewal locations.
- A renewal location can be used more than once by a single route.
- In cases where there may be several potential renewal locations for a route, the closest available renewal location is identified by the solver.
The route
parameter can be specified using a JSON structure that represents a set of point features. The property is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in the
features
array represents a route renewal and contains the following property:attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
Attributes for route_renewals
When specifying the route renewals, you can specify additional properties for route renewals, such as the route name or service time, using attributes. The route
parameter can be specified with the following attributes:
-
Depot
Name The name of the depot where this renewal takes place. This attribute is a foreign key to the
Name
attribute in thedepots
parameter, so the values must match. The attribute cannot have a null value. -
Route
Name The name of the route that this renewal applies to. This attribute is a foreign key to the
Name
attribute in theroutes
parameter, so the values must match. The attribute cannot have a null value. -
Service
Time The service time for the renewal. This attribute can contain a null value; a null value indicates zero service time. The units for this attribute value are specified by the
time
parameter._units -
Sequences
Specifies one or more sequences of visits to the renewal depot. This attribute can be used to preassign visits to the renewal depot. The attribute value is specified as a space-separated string of sequence values. The attribute can contain a null value; a null value indicates that the service will determine the best sequence to visit the renewal depot.
Syntax examples for route_renewals
Syntax for specifying route renewals using JSON structure for features
{
"features": [
{
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying route renewals using a URL returning a JSON response
{
"url": "<url>"
}
Example for route_renewals
Example: Specify route renewals using a JSON structure
In this example, a distribution company makes deliveries from a central depot using two trucks. Over time, the distribution company also acquired two additional satellite distribution centers. These centers can be used by the trucks to renew their truckload while making their deliveries instead of returning to the main distribution center for renewal. The new distribution centers are specified as route renewals when solving the vehicle routing problem, and the service determines the best renewal locations that minimize the total cost.
You must specify two route renewal locations for each route, so you have a total of four route renewal features. Identify the depot location that can be used for renewal using the Depot
attribute. Specify the name of the route the renewal applies to using the Route
attribute. Because it takes 15 minutes to load the truck at the renewal location, specify 15 as the value for the Service
attribute assuming the time
parameter is set to Minutes
. The other attribute values are not specified because their default values are adequate in this scenario.
{
"features": [
{
"attributes": {
"RouteName": "Truck1",
"DepotName": "800 Brush St",
"ServiceTime": 15
}
},
{
"attributes": {
"RouteName": "Truck1",
"DepotName": "100 Old County Rd",
"ServiceTime": 15
}
},
{
"attributes": {
"RouteName": "Truck2",
"DepotName": "800 Brush St",
"ServiceTime": 15
}
},
{
"attributes": {
"RouteName": "Truck2",
"DepotName": "100 Old County Rd",
"ServiceTime": 15
}
}
]
}
order_pairs
Use this parameter to pair pickup and delivery orders so they are serviced by the same route.
Sometimes it is necessary for the pick up and delivery of orders to be paired. For example, a courier company may need to have a route pick up a high-priority package from one order and deliver it to another without returning to a depot, or sorting station, to minimize delivery time. These related orders can be assigned to the same route with the appropriate sequence using order pairs. Restrictions on how long the package can stay in the vehicle can also be assigned; for example, the package might be a blood sample that must be transported from the doctor's office to the lab within two hours.
Some situations may require two pairs of orders. For example, suppose you want to transport a senior citizen from her home to the doctor and then back home. The ride from her home to the doctor is one pair of orders with a desired arrival time at the doctor, while the ride from the doctor to her home is another pair with a desired pickup time.
The order
parameter can be specified using a JSON structure that represents a set of point features. The property is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in the
features
array represents an order pairs stop and contains the following properties:attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
Attributes for order_pairs
When specifying the order pairs, you can specify additional properties for order pairs, such as the orders that should be paired together or the maximum transit time using attributes. The order
parameter can be specified with the following attributes:
-
First
—The name of the first order of the pair. This attribute is a foreign key to theOrder Name Name
attribute in theorders
parameter, so the values must match. The attribute cannot have a null value. -
Second
—The name of the second order of the pair. This attribute is a foreign key to theOrder Name Name
attribute in theorders
parameter, so the values must match. The attribute cannot have a null value. -
Max
Transit Time The maximum transit time for the pair. The transit time is the duration from the departure time of the first order to the arrival time at the second order. This constraint limits the time-on-vehicle, or ride time, between the two orders. When a vehicle is carrying people or perishable goods, the ride time is typically shorter than that of a vehicle carrying packages or nonperishable goods.
Excess transit time (measured with respect to the direct travel time between order pairs) can be tracked and weighted by the service. Because of this, you can direct the service to take one of three approaches: minimize the overall excess transit time regardless of the increase in travel cost for the fleet. find a solution that balances overall violation time and travel cost, or ignore the overall excess transit time and, instead, minimize the travel cost for the fleet. By assigning an importance level for the
excess
parameter, you are in effect choosing one of these three approaches. Regardless of the importance level, the service will always return an error if the_transit _factor Max
attribute value is surpassed.Transit Time This attribute can contain null values; a null value indicates that there is no constraint on the ride time. The default value for this attribute is
null
.
Syntax examples for order_pairs
Syntax for specifying order pairs using JSON structure for features
{
"features": [
{
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying order pairs using a URL returning a JSON response
{
"url": "<url>"
}
Example for order_pairs
Example: Specify order pairs using JSON structure
In this example, a paratransit company needs to find the best routes for a fleet of vans to transport people who would otherwise not have access to transportation from their homes to various hospitals for medical appointments.
The hospital and patient locations are specified as the orders
parameter. The passengers must be taken to a predetermined hospital. For each patient-to-hospital pair, add a feature to the order
parameter using the patient name as the value for the First
attribute and the hospital name as the value for the Second
attribute. The maximum time in minutes that the patients can sit in the van during a one-way trip is specified using the Max
attribute.
{
"features": [
{
"attributes": {
"FirstOrderName": "Mark (Home)",
"SecondOrderName": "Mark (Doctor)",
"MaxTransitTime": 30
}
},
{
"attributes": {
"FirstOrderName": "Tom (Home)",
"SecondOrderName": "Tom (Doctor)",
"MaxTransitTime": 20
}
},
{
"attributes": {
"FirstOrderName": "Bob (Home)",
"SecondOrderName": "Bob (Doctor)",
"MaxTransitTime": 25
}
},
{
"attributes": {
"FirstOrderName": "Tony (Home)",
"SecondOrderName": "Tony (Doctor)",
"MaxTransitTime": 15
}
}
]
}
excess_transit_factor
Use this parameter to rate the importance of reducing excess transit time of order pairs. Excess transit time is the amount of time exceeding the time required to travel directly between the paired orders. Excess time can be caused by driver breaks or travel to intermediate orders and depots.
Calculating excess transit time
The parameter is specified using one of the following values:
Low
—The service tries to find a solution that minimizes overall solution cost, regardless of excess transit time. This value is commonly used with courier services. Since couriers transport packages as opposed to people, they don't need to worry about ride time. UsingLow
allows the couriers to service paired orders in the proper sequence and minimize the overall solution cost.Medium
—The service looks for a balance between reducing excess transit time and reducing the overall solution cost.High
—The service tries to find a solution with the least excess transit time between paired orders at the expense of increasing the overall travel costs. It makes sense to use this value if you are transporting people between paired orders and you want to shorten their ride time. This is characteristic of taxi services.
The default value is Medium
.
The vehicle routing problem solution can change according to the value you choose for the excess
parameter. The next two images show the same set of orders and depots; however, the routes are not the same because different excess
values were used. The image on the left shows the route that resulted when the excess
parameter was set to Low
. The overall route is short, but the travel time from the first order to its paired order, the airport, is long. If the excess
is set to High
, the route reduces the time between the first order and the airport while maintaining the same ride time to the airport for the order on the right; however, the overall cost of the route increases.
point_barriers
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.
You can specify barrier geometries as well as attributes using a more comprehensive JSON structure that references a set of features. The property is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in this array represents a point barrier and contains the following fields:
-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for point_barriers
When specifying point barriers, you can set properties for each, such as its name or barrier type, using the following attributes:
Name
The name of the barrier.
Barrier
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 integers (use the numeric code, not the name in parentheses):
-
0 (Restriction)—Prohibits travel through the barrier. The barrier is referred to as a restriction point barrier since it acts as a restriction.
The first map shows the shortest path between two stops without any restriction point barriers. The second map has a road that is blocked by a fallen tree, so the shortest path between the same points is longer.
-
2 (Added Cost)—Traveling through the barrier increases the travel time or distance by the amount specified in the
Additional
attributes. This barrier type is referred to as an added cost point barrier._[ Cost] The map on the left shows the shortest path between two stops without any added cost point barrier. For the map on the right, the travel time from stop one to stop two would be the same whether going around the north end of the block or the south end; however, since crossing railroad tracks incurs a time penalty (modeled with added cost point barriers), the route with only one railroad crossing is chosen. The cost of crossing the barrier is added to the accumulated travel time of the resulting route.
Additional
The added travel time when the barrier is traversed. This field is applicable only for added-cost barriers and when the measurement
parameter is time-based
This field value must be greater than or equal to zero, and its units are the same as those specified in the measurement
parameter.
Additional
The added distance when the barrier is traversed. This field is applicable only for added-cost barriers and when the measurement
parameter is distance-based
The field value must be greater than or equal to zero, and its units are the same as those specified in the measurement
parameter.
Additional
The added cost when the barrier is traversed. This field is applicable only for added-cost barriers when the impedance attribute is neither time-based nor distance-based.
Full
Specifies how the restriction point barriers are applied to the edge elements during the analysis. The field value is specified as one of the following integers (use the numeric code, not the name in parentheses):
- 0 (False)—Permits travel on the edge up to the barrier but not through it. This is the default value.
- 1 (True)—Restricts travel anywhere on the associated edge.
Curb
Specifies the direction of traffic that is affected by the barrier. The field value is specified as one of the following integers (use the numeric code, not the name in parentheses):
- 0 (Either side of 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.
Because junctions are points and don't have a side, barriers on junctions affect all vehicles regardless of the curb approach.
The Curb
attribute works with both types of national driving standards: right-hand traffic (United States) and left-hand traffic (United Kingdom). First, consider a facility 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 a facility from one of two directions, that is, so it ends up on the right or left side of the vehicle. For example, to arrive at a facility and not have a lane of traffic between the vehicle and the facility, choose 1 (Right side of vehicle) in the United States and 2 (Left side of vehicle) in the United Kingdom.
Bearing
The direction in which a point is moving. The units are degrees and are measured clockwise from true north. This field is used in conjunction with the Bearing
field.
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 field 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 tool determine on which side of the street the point is.
Learn more about bearing and bearing tolerance
Bearing
The bearing tolerance value creates a range of acceptable bearing values when locating moving points on an edge using the Bearing
field. If the Bearing
field 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.
Learn more about bearing and bearing tolerance
Nav
This field is only used in the solve process if the Bearing
and Bearing
fields also have values; however, entering a Nav
field value is optional, even when values are present in Bearing
and Bearing
. Nav
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.
The units of Nav
are the same as the units of the impedance attribute.
Syntax examples for point_barriers
Syntax for specifying point
using a JSON structure for features
{
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>
},
"features": [
{
"geometry": {
"x": <x1>,
"y": <y1>
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"x": <x2>,
"y": <y2>
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying point
using a URL returning a JSON response
{
"url": "<url>"
}
Examples for point_barriers
Example 1: Specifying an added-cost point barrier using JSON structure
This example shows how to use an added-cost point barrier to model a five-minute delay at a railroad crossing. The Barrier
attribute is used to specify the point barrier is added-cost, and the Additional
attribute is used to specify the added delay in minutes.
{
"spatialReference": {
"wkid": 4326
},
"features": [
{
"geometry": {
"x": 37.541479,
"y": -122.053461
},
"attributes": {
"Name": "Haley St railroad crossing",
"BarrierType": 2,
"Additional_Time": 5
}
}
]
}
Example 2: Specifying restriction point barriers in the Web Mercator spatial reference using a JSON structure
This example shows how to use a restriction point barrier to model a road that's blocked by a fallen tree. The barrier's geometry is in the Web Mercator spatial reference and not in the spatial reference of the network dataset.
{
"spatialReference": {
"wkid": 102100
},
"features": [
{
"geometry": {
"y": -13635398.9398,
"x": 4544699.034400001
},
"attributes": {
"Name": "Fallen tree at 123 Main St",
"BarrierType": 0
}
}
]
}
Example 3: Specifying point barriers using a URL
The URL makes a query for a few features from a map service. A URL querying features from a feature service can also be specified.
{
"url": "https://machine.domain.com/webadaptor/rest/services/NetworkAnalysis/SanDiego/MapServer/21/query?where=1%3D1&outFields=Name&f=json"
}
line_barriers
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.
The first map displays the shortest path between two stops. The second map shows the shortest path when several streets are blocked by a polyline barrier.
You can specify polyline barrier geometries as well as attributes using a JSON structure that references a set of features. The property is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in this array represents a polyline barrier and contains the following fields:
-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for line_barriers
When specifying the line barriers, you can set name and barrier type properties for each using the following attributes:
-
Name
The name of the barrier.
Syntax examples for line_barriers
Syntax for specifying line barriers using a JSON structure for features
{
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>,
},
"features": [
{
"geometry": {
"paths": [
[
[<x11>,<y11>],
[<x12>,<y12>]
],
[
[<x21>,<y21>],
[<x22>,<y22>]
]
]
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"paths": [
[
[<x11>,<y11>],
[<x12>,<y12>]
],
[
[<x21>,<y21>],
[<x22>,<y22>]
]
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying line barriers using a URL returning a JSON response
{
"url": "<url>"
}
Examples for line_barriers
Example 1: Specifying line barriers using a JSON structure
The example shows how to add two lines as line barriers to restrict travel on the streets intersected by the lines. Barrier 1 is a single-part line feature made up of two points. Barrier 2 is a two-part line feature whose first part is made up of three points and whose second part is made up of two points.
{
"spatialReference": {
"wkid": 102100
},
"features": [
{
"geometry": {
"paths": [
[
[-10804823.397,3873688.372],
[-10804811.152,3873025.945]
]
]
},
"attributes": {
"Name": "Barrier 1"
}
},
{
"geometry": {
"paths": [
[
[-10804823.397,3873688.372],
[-10804807.813 3873290.911],
[-10804811.152,3873025.945]
],
[
[-10805032.678,3863358.76],
[-10805001.508,3862829.281]
]
]
},
"attributes": {
"Name": "Barrier 2"
}
}
]
}
Example 2: Specifying line barriers using URL
The URL makes a query for a few features from a map service. A URL querying features from a feature service can also be specified.
{
"url": "https://machine.domain.com/webadaptor/rest/services/Network/USA/MapServer/6/query?where=1%3D1&returnGeometry=true&f=json"
}
polygon_barriers
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.
You can specify polygon barrier geometries as well as attributes using a JSON structure that references a set of features. The property is optional; however, the JSON structure must specify either the url
or features
property:
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set. -
features
—Specify an array of features.Each feature in this array represents a polygon barrier and contains the following fields:
-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
Attributes for polygon_barriers
When specifying the polygon barriers, you can set properties for each, such as its name or barrier type, using the following attributes:
-
Name
The name of the barrier.
-
Barrier
Type Specifies whether the barrier restricts travel completely or scales the cost (such as time or distance) for traveling through it. The field value is specified as one of the following integers (use the numeric code, not the name in parentheses):
-
0 (Restriction)—Prohibits traveling through any part of the barrier. The barrier is referred to as a restriction polygon barrier since it prohibits traveling on streets intersected by the barrier. One use of this type of barrier is to model floods covering areas of the street that make traveling on those streets impossible.
This is the default value.
The first map depicts the shortest path between two stops. The second map shows a polygon barrier blocking flooded streets, so the shortest path between the same two stops is different.
-
1 (Scaled Cost)—Scales the cost (such as travel time or distance) required to travel the underlying streets by a factor specified using the
Scaled
orTime Factor Scaled
field. 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 The first map shows a route that goes through inclement weather without regard for the effect that poor road conditions have on travel time. The second map shows a scaled polygon barrier that doubles the travel time of the roads covered by the storm. The route still passes through the southern tip of the storm since it is quicker to spend more time driving slowly through a small part of the storm rather than driving completely around it. The service uses the modified travel time in calculating the best route, and the modified travel time is reported as the total travel time in the response.
-
-
Scaled
Time Factor This is the factor by which the travel time of the streets intersected by the barrier is multiplied. The field value must be greater than zero.
This field is applicable only for scaled-cost barriers and when the
measurement
parameter is time-based._units -
Scaled
Distance Factor This is the factor by which the distance of the streets intersected by the barrier is multiplied. The field value must be greater than zero.
This field is applicable only for scaled-cost barriers and when the
measurement
parameter is distance-based._units -
Scaled
Cost Factor This is the factor by which the cost of the streets intersected by the barrier is multiplied. The field value must be greater than zero.
This field is applicable only for scaled-cost barriers when the impedance is neither time-based nor distance-based .
Syntax examples for polygon_barriers
Syntax for specifying polygon barriers using a JSON structure for features
{
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>
}
"features": [
{
"geometry": {
"rings": [
[
[<x11>,<y11>],
[<x12>,<y12>],
[<x11>,<y11>]
],
[
[<x21>,<y21>],
[<x22>,<y22>]
[<x21>,<y21>]
]
]
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"rings": [
[
[<x11>,<y11>],
[<x12>,<y12>],
[<x11>,<y11>]
],
[
[<x21>,<y21>],
[<x22>,<y22>],
[<x21>,<y21>]
]
]
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
]
}
Syntax for specifying polygon barriers using a URL returning a JSON response
{
"url": "<url>"
}
Examples for polygon_barriers
Example 1: Specifying polygon barriers using a JSON structure.
The example shows how to add two polygons as barriers. The first polygon named Flood zone
is a restriction polygon barrier that prohibits travel on the underlying streets. The polygon is a single-part polygon feature made up of four points. The second polygon named Severe weather zone
is a scaled-cost polygon barrier that increases the travel time on underlying streets to one third of the original value. The polygon is a two-part polygon feature. Both parts are made up of four points.
{
"spatialReference": {
"wkid": 4326
},
"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": "Flood zone",
"BarrierType": 0
}
},
{
"geometry": {
"rings": [
[
[-97.0803,32.8235],
[-97.0776,32.8277],
[-97.074,32.8254],
[-97.0767,32.8227],
[-97.0803,32.8235]
],
[
[-97.0871,32.8311],
[-97.0831,32.8292],
[-97.0853,32.8259],
[-97.0892,32.8279],
[-97.0871,32.8311]
]
]
},
"attributes": {
"Name": "Severe weather zone",
"BarrierType": 1,
"ScaledTimeFactor": 3
}
}
]
}
Example 2: Specifying a polygon barrier using a URL
The URL makes a query for a few features from a map service. A URL querying features from a feature service can also be specified.
{
"url": "https://machine.domain.com/webadaptor/rest/services/Network/USA/MapServer/7/query?where=1%3D1&returnGeometry=true&f=json"
}
use _hierarchy _in _analysis
Specify whether hierarchy will be used when finding the shortest paths.
true
—Use hierarchy when travelling between stops. When hierarchy is used, the service prefers higher-order streets (such as freeways) to lower-order streets (such as local roads) and can be used to simulate the driver preference of traveling on freeways instead of local roads even if that means a longer trip. This is especially true when finding routes to faraway locations, because drivers on long-distance trips tend to prefer traveling on freeways where stops, intersections, and turns can be avoided. Using hierarchy is computationally faster, especially for long-distance routes, since the service can determine the best route from a relatively smaller subset of streets.false
—Do not use hierarchy when travelling between stops. When hierarchy is not used, the service considers all the streets and doesn't prefer higher-order streets when finding the route. This is often used when finding short-distance routes within a city.
The default value for this parameter is true
.
restrictions
Use this parameter to specify the restrictions that will be honored by the service. A restriction represents a driving preference or requirement. In most cases, restrictions cause roads or pathways to be prohibited, but they can also cause them to be avoided or preferred. For instance, using the Avoid Toll Roads
restriction will result in a route that will include toll roads only when it is required to travel on toll roads to visit a stop. Use Height Restriction
to route around clearances that are lower than the height of the vehicle. If the vehicle is carrying corrosive materials, you can use the Any Hazmat Prohibited
restriction to prevent hauling the materials along roads where it is marked as illegal to do so.
This parameter value is specified as a comma-separated list of restriction names. A value of none indicates that no restrictions will be used when finding the shortest paths.
The service supports the following restriction names:
- Any Hazmat Prohibited—The results will not include roads where transporting any kind of hazardous material is prohibited.
- Avoid Carpool Roads—The results will avoid roads that are designated exclusively for car pool (high-occupancy) vehicles.
- Avoid Express Lanes—The results will avoid roads designated as express lanes.
- Avoid Ferries—The results will avoid ferries.
- Avoid Gates—The results will avoid roads where there are gates, such as keyed access or guard-controlled entryways.
- Avoid Limited Access Roads—The results will avoid roads that are limited-access highways.
- Avoid Private Roads—The results will avoid roads that are not publicly owned and maintained.
- Avoid Roads Unsuitable for Pedestrians—The results will avoid roads that are unsuitable for pedestrians.
- Avoid Stairways—The results will avoid all stairways on a pedestrian-suitable route.
- Avoid Toll Roads—The results will avoid all toll roads for automobiles.
- Avoid Toll Roads for Trucks—The results will avoid all toll roads for trucks.
- Avoid Truck Restricted Roads—The results will avoid roads where trucks are not allowed, except when making deliveries.
- Avoid Unpaved Roads—The results will avoid roads that are not paved (for example, dirt, gravel, and so on).
- Axle Count Restriction—The results will not include roads where trucks with the specified number of axles are prohibited. The number of axles can be specified using the Number of Axles restriction parameter.
- Driving a Bus—The results will not include roads where buses are prohibited. Using this restriction will also ensure that the results will honor one-way streets.
- Driving a Taxi—The results will not include roads where taxis are prohibited. Using this restriction will also ensure that the results will honor one-way streets.
- Driving a Truck—The results will not include roads where trucks are prohibited. Using this restriction will also ensure that the results will honor one-way streets.
- Driving an Automobile—The results will not include roads where automobiles are prohibited. Using this restriction will also ensure that the results will honor one-way streets.
- Driving an Emergency Vehicle—The results will not include roads where emergency vehicles are prohibited. Using this restriction will also ensure that the results will honor one-way streets.
- Height Restriction—The results will not include roads where the vehicle height exceeds the maximum allowed height for the road. The vehicle height can be specified using the Vehicle Height (meters) restriction parameter.
- Kingpin to Rear Axle Length Restriction—The results will not include roads where the vehicle length exceeds the maximum allowed kingpin to rear axle for all trucks on the road. The length between the vehicle kingpin and the rear axle can be specified using the Vehicle Kingpin to Rear Axle Length (meters) restriction parameter.
- Length Restriction—The results will not include roads where the vehicle length exceeds the maximum allowed length for the road. The vehicle length can be specified using the Vehicle Length (meters) restriction parameter.
- Preferred for Pedestrians—The results will use preferred routes suitable for pedestrian navigation.
- Riding a Motorcycle—The results will not include roads where motorcycles are prohibited. Using this restriction will also ensure that the results will honor one-way streets.
- Roads Under Construction Prohibited—The results will not include roads that are under construction.
- Semi or Tractor with One or More Trailers Prohibited—The results will not include roads where semis or tractors with one or more trailers are prohibited.
- Single Axle Vehicles Prohibited—The results will not include roads where vehicles with single axles are prohibited.
- Tandem Axle Vehicles Prohibited—The results will not include roads where vehicles with tandem axles are prohibited.
- Through Traffic Prohibited—The results will not include roads where through traffic (nonlocal traffic) is prohibited.
- Truck with Trailers Restriction—The results will not include roads where trucks with the specified number of trailers on the truck are prohibited. The number of trailers on the truck can be specified using the Number of Trailers on Truck restriction parameter.
- Use Preferred Hazmat Routes—The results will prefer roads that are designated for transporting hazardous materials.
- Use Preferred Truck Routes—The results will prefer roads that are designated as truck routes, such as roads that are part of the national network as specified by the National Surface Transportation Assistance Act in the United States, or roads that are designated as truck routes by the state or province, or roads that are preferred by truckers when driving in an area.
- Walking—The results will not include roads where pedestrians are prohibited.
- Weight Restriction—The results will not include roads where the vehicle weight exceeds the maximum allowed weight for the road. The vehicle weight can be specified using the Vehicle Weight (kilograms) restriction parameter.
- Weight per Axle Restriction—The results will not include roads where the vehicle weight per axle exceeds the maximum allowed weight per axle for the road. The vehicle weight per axle can be specified using the Vehicle Weight per Axle (kilograms) restriction parameter.
- Width Restriction—The results will not include roads where the vehicle width exceeds the maximum allowed width for the road. The vehicle width can be specified using the Vehicle Width (meters) restriction parameter.
The restrictions parameter value is specified as a list of restriction names. A value of null
indicates that no restrictions should be used when finding the best route, but only when travel
is set to Custom
.
Example for restrictions
restrictions=[Driving a Truck, Height Restriction, Length Restriction]
attribute_parameter_values
Use this parameter to specify additional values required by an attribute or restriction, such as to specify whether the restriction prohibits, avoids, or prefers travel on restricted roads. If the restriction is meant to avoid or prefer roads, you can further specify the degree to which they are avoided or preferred using this parameter. For example, you can choose to never use toll roads, avoid them as much as possible, or prefer them.
You can specify attribute
parameter using JSON structure that represents a set of features. The JSON structure can include the following properties:
-
features
—Specify an array of features.-
geometry
—Specify the input point geometry containingx
andy
properties along with thespatial
property. If theReference spatial
property is defined for the entire JSON, you don't need to define this property for each geometry. Doing so reduces the size of the input JSON if the input has many features and improves performance. This property is not required if the coordinates are in the default spatial reference, WGS84. If the coordinates are in a different spatial reference, you must specify the spatial reference's well-known ID (WKID). See Using spatial references to look up WKID values.Reference -
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
-
-
url
—Specify a REST query request to any ArcGIS Server feature, map, or geoprocessing service that returns a JSON feature set.
Each feature in the features array represents an attribute parameter and contains the following fields:
attributes
—Specify each attribute as a key-value pair in which the key is the name of a given field, and the value is the attribute value for the corresponding field.
Attributes for attribute_parameter_values
The attribute
parameter can be specified with the following attributes:
Attribute
—The name of the restriction.Name Parameter
—The name of the parameter associated with the restriction. A restriction can have one or moreName Parameter
values based on its intended use, which implies you may need multipleName attribute
parameters for a single attribute name._parameter _values Parameter
—The value for theValue Parameter
that is used by the service when evaluating the restriction.Name
When specifying the attribute
parameter, each restriction (listed as Attribute
) has a Parameter
value, Restriction Usage
, that specifies whether the restriction prohibits, avoids, or prefers travel on the roads associated with the restriction and the degree to which the roads are avoided or preferred.
The Restriction Usage
value for Parameter
can be any of the following string values or their equivalent numeric values listed within the parentheses:
Prohibited
(-1
)—Travel on the roads that have the restriction is prohibited.Avoid
(_High 5
)—It is very unlikely the service will include in the route the roads that are associated with the restriction.Avoid
(_Medium 2
)—It is unlikely the service will include in the route the roads that are associated with the restriction.Avoid
(_Low 1.3
)—It is somewhat unlikely the service will include in the route the roads that are associated with the restriction.Prefer
(_Low 0.8
)—It is somewhat likely the service will include in the route the roads that are associated with the restriction.Prefer
(_Medium 0.5
)—It is likely the service will include in the route the roads that are associated with the restriction.Prefer
(_High 0.2
)—It is very likely the service will include in the route the roads that are associated with the restriction.
The following table lists the restriction names and the default restriction parameter values for all the restrictions. The default value for the attribute
parameter is the JSON structure containing all the rows from the below table.
Restriction name | Restriction parameter name | Restriction parameter default value |
---|---|---|
Any Hazmat Prohibited | Restriction Usage | Prohibited |
Avoid Carpool Roads | Restriction Usage | Prohibited |
Avoid Express Lanes | Restriction Usage | Prohibited |
Avoid Ferries | Restriction Usage | Avoid_Medium |
Avoid Gates | Restriction Usage | Avoid_Medium |
Avoid Limited Access Roads | Restriction Usage | Avoid_Medium |
Avoid Private Roads | Restriction Usage | Avoid_Medium |
Avoid Roads Unsuitable for Pedestrians | Restriction Usage | Avoid_High |
Avoid Stairways | Restriction Usage | Avoid_High |
Avoid Toll Roads | Restriction Usage | Avoid_Medium |
Avoid Toll Roads for Trucks | Restriction Usage | Avoid_Medium |
Avoid Truck Restricted Roads | Restriction Usage | Avoid_High |
Avoid Unpaved Roads | Restriction Usage | Avoid_High |
Axle Count Restriction | Number of Axles | 0 |
Restriction Usage | Prohibited | |
Driving a Bus | Restriction Usage | Prohibited |
Driving a Taxi | Restriction Usage | Prohibited |
Driving a Truck | Restriction Usage | Prohibited |
Driving an Automobile | Restriction Usage | Prohibited |
Driving an Emergency Vehicle | Restriction Usage | Prohibited |
Height Restriction | Restriction Usage | Prohibited |
Vehicle Height (meters) | 0 | |
Kingpin to Rear Axle Length Restriction | Restriction Usage | Prohibited |
Vehicle Kingpin to Rear Axle Length (meters) | 0 | |
Length Restriction | Restriction Usage | Prohibited |
Vehicle Length (meters) | 0 | |
Preferred for Pedestrians | Restriction Usage | Prefer_Low |
Riding a Motorcycle | Restriction Usage | Prohibited |
Roads Under Construction Prohibited | Restriction Usage | Prohibited |
Semi or Tractor with One or More Trailers Prohibited | Restriction Usage | Prohibited |
Single Axle Vehicles Prohibited | Restriction Usage | Prohibited |
Tandem Axle Vehicles Prohibited | Restriction Usage | Prohibited |
Through Traffic Prohibited | Restriction Usage | Avoid_High |
Truck with Trailers Restriction | Restriction Usage | Prohibited |
Number of Trailers on Truck | 0 | |
Use Preferred Hazmat Routes | Restriction Usage | Prefer_Medium |
Use Preferred Truck Routes | Restriction Usage | Prefer_High |
Walking | Restriction Usage | Prohibited |
WalkTime | Walking Speed (km/h) | 5 |
Weight Restriction | Restriction Usage | Prohibited |
Vehicle Weight (kilograms) | 0 | |
Weight per Axle Restriction | Restriction Usage | Prohibited |
Vehicle Weight per Axle (kilograms) | 0 | |
Width Restriction | Restriction Usage | Prohibited |
Vehicle Width (meters) | 0 |
Syntax example for attribute_parameter_values
{
"features": [
{
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>,
"<field3>": <value13>
}
},
{
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>,
"<field3>": <value13>
}
}
]
}
Examples for attribute_parameter_values
This example shows how to specify the height and weight of the vehicle for use with the height and weight restrictions respectively along with a high preference to include designated truck routes. This results in a route that does not include any roads where the clearance under overpasses or through tunnels is less than the vehicle height. The results will also not include any roads with load limited bridges or local roads that prohibit heavy vehicles if the vehicle weight exceeds the maximum permissible weight. However, the route will include as many roads as possible that are designated as preferred truck routes.
Note that the Restriction Usage
Parameter
for the Height Restriction
and the Weight Restriction
restrictions are not specified since we want to use the default value of PROHIBITED
for these restriction parameters.
attribute_parameter_values=
{
"features": [
{
"attributes": {
"AttributeName": "Height Restriction",
"ParameterName": "Vehicle Height (meters)",
"ParameterValue": 4.12
}
},
{
"attributes": {
"AttributeName": "Weight Restriction",
"ParameterName": "Vehicle Weight (kilograms)",
"ParameterValue": 36287
}
},
{
"attributes": {
"AttributeName": "Use Preferred Truck Routes",
"ParameterName": "Restriction Usage",
"ParameterValue": "PREFER_HIGH"
}
}
]
}
populate_route_lines
Use this parameter to specify the shape of the output routes.
True
—The output routes will have the exact shape of the underlying streets that are included in the routes.False
—No shape is generated for the output routes. You won't be able to generate driving directions if thepopulate
parameter is set to_route _lines false
. Use this option if you are only interested in determining the assignment and sequence of orders to the routes and do not want route shapes that follow streets or generate driving directions. Use this option to reduce the time taken by the service to solve the vehicle routing problem, as the service has to perform relatively fewer computations.
The default value is true
.
route_line_simplification_tolerance
Use this parameter to specify by how much you want to simplify the route geometry returned by the service.
Simplification maintains critical points on a route, such as turns at intersections, to define the essential shape of the route and removes other points. The simplification distance you specify is the maximum allowable offset that the simplified line can deviate from the original line. Simplifying a line reduces the number of vertices that are part of the route geometry. This reduces the overall response size and also improves the performance for drawing the route shapes in applications.
The parameter is specified as a JSON structure that includes the following properties:
distance
—The simplification distance value.units
—The units for the simplification distance value. The property value should be specified as one of the following values:esri
, andCentimeters, esri Decimal Degrees, esri Decimeters, esri Feet, esri Inches, esri Kilometers, esri Meters, esri Miles, esri Millimeters, esri Nautical Miles, esri Points esri
.Yards
The default value for the route
parameter is 10 meters.
Syntax example for route_line_simplification_tolerance
{
"distance": <value>,
"units": "<unit>"
}
Examples for route_line_simplification_tolerance
{
"distance": 10,
"units": "esriMeters"
}
populate_directions
Use this parameter to specify whether the service should generate driving directions for each route.
true
—Generate directions. The directions are configured based on the values for thedirections
,_language directions
, and_style _name directions
parameters._distance _units false
—Don't generate directions. The service returns an empty value for thefeatures
property within theoutput
output parameter._directions
directions_language
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:
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 tries to find an exact match for the specified language including any language localization. If an exact match is not 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-
.
directions_style_name
Specify the name of the formatting style for the directions. This parameter can be specified using the following values:
N
—Generates turn-by-turn directions suitable for printing.A Desktop N
—Generates turn-by-turn directions designed for an in-vehicle navigation device.A Navigation N
—Generates turn-by-turn walking directions designed for pedestrian routes.A Campus
The default value is N
.
This parameter applies only when the populate
parameter is set to true
.
save_route_data
Use this parameter to specify whether the service should create a zip file that contains a file geodatabase holding the inputs and outputs of the analysis in a format that can be used to share route layers with your portal.
true
—Saves route data. The route data zip file can be downloaded from the URL provided as part of theoutput
parameter._route _data false
—Don't save route data.
The default value is false
.
save_output_layer
Use this parameter to specify if the service should save the analysis settings as a network analysis layer file. You cannot directly work with this file even when you open the file in an ArcGIS Desktop application like ArcGIS Pro. It is meant to be sent to Esri Technical Support in order to diagnose the quality of results returned from the service.
true
—Saves network analysis layer file. The file can be downloaded from the URL provided as part of theoutput
parameter._network _analysis _layer false
—Don't save network analysis layer file.
The default value is false
.
time_impedance
The time-based impedance value represents the travel time along road segments or on other parts of the transportation network.
Minutes
Travel
Time Walk
Time Truck
Minutes Truck
Travel Time
distance_impedance
The distance-based impedance value represents the travel distance along road segments or on other parts of the transportation network.
Miles
Kilometers
populate_stop_shapes
Specifies whether the tool will create the shapes for the output assigned and unassigned stops.
True
—The output assigned and unassigned stops are created as point features. This can be useful to visualize which stops are assigned to routes and which stops could not be assigned to any routes.False
—The output assigned and unassigned stops are created as tables and will not have shapes. Use this option only if your application does not have a need to visualize the output stops and can work with just the attributes of the stops.
The default value is False
.
output_format
Specifies 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.
- JSON File—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. - GeoJSON File—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.
ignore_invalid_order_locations
Specifies whether invalid orders will be ignored when solving the vehicle routing problem.
true
—The solve operation will ignore any invalid orders and return a solution, given it didn't encounter any other errors. If you need 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. Next, 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 if it's located on a prohibited network element, it isn't located on the network at all, or it's located on a disconnected portion of the network.
The default value is false
.
ignore_network_location_fields
Specifies whether the network location fields will be considered when locating inputs such as stops or facilities on the network.
true
—Network location fields will not be considered when locating the inputs on the network. Instead, the inputs will always be located by performing a spatial search.false
—Network location fields will be considered when locating the inputs on the network.
The default value is false
.
overrides
env:outSR
Use this parameter to specify the spatial reference of the geometries, such as line or point features, returned by the service.
The parameter value can be specified as a well-known ID (WKID) for the spatial reference. See Using spatial references to look up WKID values.
Many of the basemaps provided by ArcGIS Online are in the Web Mercator spatial reference (WKID 102100). Specifying env
returns the geometries in the Web Mercator spatial reference, which can be drawn on top of the basemaps.
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. To restrict locating on a portion of the source, you can specify a where clause for a source.
Learn more about locating inputs
The parameter value is specified as a JSON object. The JSON object allows you to specify a locator JSON for all input feature in the analysis, or you can specify an override for a particular input. The override allows you to have different settings for each analysis input. For example, you can disallow stops to locate on highway ramps and allow point barriers to locate on highway ramps.
The locator JSON object has the following properties:
-
tolerance
andtolerance
—Allows you to control the maximum search distance when locating inputs. If no valid network location is found within this distance, the input features will be considered unlocated. A small search tolerance decreases the likelihood of locating on the wrong street but increases the likelihood of not finding any valid network location. TheUnits tolerance
parameter value can be specified as one of the following values:Units esri
Centimeters esri
Decimal Degrees esri
Decimeters esri
Feet esri
Inches esri
Int Feet esri
Int Inches esri
Int Miles esri
Int Nautical Miles esri
Int Yards esri
Kilometers esri
Meters esri
Miles esri
Millimeters esri
Nautical Miles esri
Yards
-
sources
—Allows you to control which network source can be used for locating. For example, you can configure the analysis to locate inputs on streets but not on sidewalks. The list of possible sources on which to locate is specific to the network dataset this service references. Only the sources that are present in the sources array are used for locating. You can specify awhere
clause on each source you specified in the sources array to further restrict locating on that source matching certain characteristics using an SQL expression. For example, you can configure the analysis to locate inputs only on street features matching certain road classes such as avoiding highway ramps. Sources is specified as an array of objects, each having the following properties:name
—Name of the network source feature class that can be used for locating inputs.where
—An SQL expression on the network source feature class.
-
allow
—Allows you to control whether inputs with existing network location fields can be automatically relocated when solving to ensure valid, routable location fields for the analysis. If the value isAuto Relocate true
, points located on restricted network elements and points affected by barriers will be relocated to the closest routable location. If the value isfalse
, network location fields will be used as is even if the points are unreachable, and this may cause the solve to fail. Even if the value isfalse
, inputs with no location fields or incomplete location fields will be located during the solve operation.
Syntax for locate_settings
Syntax for specifying locate
using JSON structure.
{
"default": {
"tolerance": <value>,
"toleranceUnits": "<unit>",
"allowAutoRelocate": true | false,
"sources": [{
"name": "<sourceName>",
"where": "<whereClause>"
}]
},
"overrides": {
"orders": {
"tolerance": <value>,
"toleranceUnits": "<unit>",
"allowAutoRelocate": true | false,
"sources": [{
"name": "<sourceName>",
"where": "<whereClause>"
}]
},
"depots": {
"tolerance": <value>,
"toleranceUnits": "<unit>",
"allowAutoRelocate": true | false,
"sources": [{
"name": "<sourceName>",
"where": "<whereClause>"
}]
},
"point_barriers": {
"tolerance": <value>,
"toleranceUnits": "<unit>",
"allowAutoRelocate": true | false,
"sources": [{
"name": "<sourceName>",
"where": "<whereClause>"
}]
},
"line_barriers": {
"allowAutoRelocate": true | false,
"sources": [{
"name": "<sourceName>",
"where": "<whereClause>"
}]
},
"polygon_barriers": {
"allowAutoRelocate": true | false,
"sources": [{
"name": "<sourceName>",
"where": "<whereClause>"
}]
}
}
}
Examples for locate_settings
Example 1: Specify default locate settings using 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 valuable 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": "Routing_Streets"
}
]
}
}
Example 2: Specify default locate settings and locate settings overrides for some inputs using JSON structure
This example shows how to specify locate settings to prevent orders and depots from locating on highway ramps. The default locate settings allow locating on the Routing_Streets source. For orders and depots, the overrides
option is used to specify a where clause for the Routing_Streets source to prevent locating on highway ramps (a ROAD_CLASS field value of 3). With this locate
json, orders and depots cannot locate on highway ramps, but barriers can because they use the default locate settings, which do not include a where
clause.
{
"default": {
"tolerance": 20,
"toleranceUnits": "esriKilometers",
"allowAutoRelocate": true,
"sources": [{
"name": "Routing_Streets"
}]
},
"overrides": {
"orders": {
"sources": [{
"name": "Routing_Streets",
"where": "ROAD_CLASS <> 3"
}]
},
"depots": {
"sources": [{
"name": "Routing_Streets",
"where": "ROAD_CLASS <> 3"
}]
}
}
}
Example three: Specify default locate settings and locate settings overrides using JSON structure so different inputs are located using different sources.
This example shows how to specify default locate settings to locate inputs on Routing_Streets source feature class while allowing point barriers to only locate on the system junctions feature class (Routing_ND_Junctions).
{
"default": {
"tolerance": 20,
"toleranceUnits": "esriKilometers",
"allowAutoRelocate": true,
"sources": [{
"name": "Routing_Streets"
}]
},
"overrides": {
"point_barriers": {
"sources": [{
"name": "Routing_ND_Junctions"
}]
}
}
}
Output parameters
Upon successful operation, the service returns the solution to the specified vehicle routing problem. The solution is composed of the following output parameters:
out_stops
This provides information about stops made at depots, orders, and breaks. The information includes which routes make the stops, the arrival and departure times, and the stop sequence.
The parameter supports the following fields:
Field | Description |
---|---|
| The name of the stop. The value of this field is the same as the |
| Indicates whether the stop represents a depot, an order, or a break. The field value is an integer that can be interpreted in the following ways:
|
| The amount of cargo or number of people to be picked up from a stop. If multiple dimensions are delivered to a stop, each quantity is separated by a space. The units for the value of this field aren't stored. Interpret the units according to the way you specified the |
| The amount of cargo or number of people to be delivered to a stop. If multiple dimensions are delivered to a stop, each quantity is separated by a space. The units for the value of this field aren't stored. Interpret the units according to the way you specified the |
| The name of the route to which the stop is assigned. |
| The relative sequence in which the assigned route visits the stops. |
| The elapsed travel time from the route's previous stop to the current stop. The value is in the units specified by the |
| The distance along the route from the previous stop to the current stop. The value is in the units specified by the |
| Indicates the side of the vehicle the curb is on when arriving at the stop. A value of 1 means the right side of the vehicle; a value of 2 means the left side. |
| Indicates the side of the vehicle the curb is on when departing from the stop. A value of 1 means the right side of the vehicle; a value of 2 means the left side. |
| The time of day the route arrives at the stop. The time of day value for this field is in the time zone in which the stop is located. |
| The time of day the route departs from the stop. The time of day value for this field is in the time zone in which the stop is located. |
| The time of day the route arrives at the stop. This value is in coordinated universal time (UTC). |
| The time of day the route departs from the stop. This value is in coordinated universal time (UTC). |
| The wait time or layover at the stop. For example, a wait time is incurred when a route must wait at an order for a time window to open. The value is in the units specified by the |
| The amount of time elapsed from the end of the stop's time window to the arrival of the route vehicle. The value is in the units specified by the |
| The ObjectID of the input order, depot, or break. This field can be used to join attributes from input features. |
Syntax example for out_stops
The out
parameter is returned as a JSON feature set with the syntax shown below. Unlike the out
parameter, the out
parameter does not contain spatial
or geometry
properties because this parameter does not return any geometry information about the stops.
{
"paramName": "out_stops",
"dataType": "GPRecordSet",
"value": {
"displayFieldName": "",
"fields": [
{
"name": "<field1Name>",
"type": "<field1Type>",
"alias": "<field1Alias>",
"length": "<field1Length>" //length is included only for esriFieldTypeString
},
{
"name": "<field2Name>",
"type": "<field2Type>",
"alias": "<field2Alias>",
"length": "<field2Length>"
}
],
"features": [
{
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
],
"exceededTransferLimit": <true|false>
}
}
Example for out_stops
The following is an example of the out
parameter.
{
"paramName": "out_stops",
"dataType": "GPRecordSet",
"value": {
"displayFieldName": "",
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
"length": 128
},
{
"name": "PickupQuantities",
"type": "esriFieldTypeString",
"alias": "PickupQuantities",
"length": 128
},
{
"name": "DeliveryQuantities",
"type": "esriFieldTypeString",
"alias": "DeliveryQuantities",
"length": 128
},
{
"name": "StopType",
"type": "esriFieldTypeSmallInteger",
"alias": "StopType"
},
{
"name": "RouteName",
"type": "esriFieldTypeString",
"alias": "RouteName",
"length": 128
},
{
"name": "Sequence",
"type": "esriFieldTypeInteger",
"alias": "Sequence"
},
{
"name": "FromPrevTravelTime",
"type": "esriFieldTypeDouble",
"alias": "FromPrevTravelTime"
},
{
"name": "FromPrevDistance",
"type": "esriFieldTypeDouble",
"alias": "FromPrevDistance"
},
{
"name": "ArriveCurbApproach",
"type": "esriFieldTypeInteger",
"alias": "ArriveCurbApproach"
},
{
"name": "DepartCurbApproach",
"type": "esriFieldTypeInteger",
"alias": "DepartCurbApproach"
},
{
"name": "ArriveTime",
"type": "esriFieldTypeDate",
"alias": "ArriveTime",
"length": 16
},
{
"name": "DepartTime",
"type": "esriFieldTypeDate",
"alias": "DepartTime",
"length": 16
},
{
"name": "WaitTime",
"type": "esriFieldTypeDouble",
"alias": "WaitTime"
},
{
"name": "ViolationTime",
"type": "esriFieldTypeDouble",
"alias": "ViolationTime"
},
{
"name": "ArriveTimeUTC",
"type": "esriFieldTypeDate",
"alias": "ArriveTimeUTC",
"length": 16
},
{
"name": "DepartTimeUTC",
"type": "esriFieldTypeDate",
"alias": "DepartTimeUTC",
"length": 16
}
],
"features": [
{
"attributes": {
"ObjectID": 1,
"Name": "Store_1",
"PickupQuantities": "",
"DeliveryQuantities": "1706",
"StopType": 0,
"RouteName": "Truck_1",
"Sequence": 3,
"FromPrevTravelTime": 7.952569246292114,
"FromPrevDistance": 2.6272945531949463,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1355248198164,
"DepartTime": 1355249698164,
"WaitTime": 0,
"ViolationTime": 0,
"ArriveTimeUTC": 1355276998164,
"DepartTimeUTC": 1355278498164
}
},
{
"attributes": {
"ObjectID": 2,
"Name": "Store_2",
"PickupQuantities": "",
"DeliveryQuantities": "1533",
"StopType": 0,
"RouteName": "Truck_2",
"Sequence": 3,
"FromPrevTravelTime": 5.654368394985795,
"FromPrevDistance": 1.5515339440650768,
"ArriveCurbApproach": 0,
"DepartCurbApproach": 0,
"ArriveTime": 1355248059340,
"DepartTime": 1355249439341,
"WaitTime": 0,
"ViolationTime": 0,
"ArriveTimeUTC": 1355276859340,
"DepartTimeUTC": 1355278239341
}
}
],
"exceededTransferLimit": false
}
}
out_routes
This provides access to the drivers, vehicles, and route paths of a vehicle routing problem analysis.
The populate
and route
parameters influence the shape of the output routes.
The parameter supports the following fields:
Field | Description |
---|---|
| The name of the route. The values for this field are copied from the |
| |
| These fields contain a summary of violated constraints and are set after a solve operation. Each field will contain one violation. If an order has more than one violation, the next A single violated constraint is shown per field.
|
| The number of orders assigned to the route. |
| The total operating cost of the route, which is the sum of the following field values: |
| The cost of regular work time, excluding any unpaid breaks. |
| The cost of overtime work, excluding any unpaid breaks. |
| The distance cost component obtained by multiplying the |
| The total route duration. This includes travel times as well as service and wait times at orders, depots, and breaks. The
The value is in the units specified by the |
| The total service time spent at all orders on the route. The value is in the units specified by the |
| The total service time spent at all breaks on the route. The value is in the units specified by the |
| The total travel time for the route. The value is in the units specified by the |
| The total travel distance for the route. The value is in the units specified by the |
| The starting time of the route. The route may start before the beginning of its start depot's time window, in which case there is a wait time at the starting depot. The time of day value for this attribute is in the time zone in which the starting depot is located. |
| The ending time of the route. The route ends upon completion of service at the ending depot. The time of day value for this attribute is in the time zone in which the ending depot is located. |
| The start time of the route in coordinated universal time (UTC). |
| The end time of the route in coordinated universal time (UTC). |
| The total wait time at all orders, depots, and breaks on the route. The value is in the units specified by the |
| The total violation time at all orders and breaks on the route. The value is in the units specified by the |
| For a route with renewals, this is equal to the number of visits to depots for the purpose of renewing a vehicle, that is, loading or unloading a vehicle. |
| For a route with renewals, this is the total service time spent at all renewal visits on the route. The value is in the units specified by the |
Syntax example for out_routes
The out
parameter is returned as a JSON feature set with following syntax:
{
"paramName": "out_Routes",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPolyline",
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>
},
"fields": [
{
"name": "<field1Name>",
"type": "<field1Type>",
"alias": "<field1Alias>",
"length": "<field1Length>" //length is included only for esriFieldTypeString
},
{
"name": "<field2Name>",
"type": "<field2Type>",
"alias": "<field2Alias>",
"length": "<field2Length>"
}
],
"features": [
{
"geometry": {
"paths": [
[
[<x11>,<y11>],
[<x12>,<y12>]
],
[
[<x21>,<y21>],
[<x22>,<y22>]
]
]
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"paths": [
[
[<x11>,<y11>],
[<x12>,<y12>]
],
[
[<x21>,<y21>],
[<x22>,<y22>]
]
]
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
],
"exceededTransferLimit": <true|false>
}
}
Example for out_routes
The following is an example of the out
parameter.
{
"paramName": "out_routes",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPolyline",
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
"length": 128
},
{
"name": "ViolatedConstraints",
"type": "esriFieldTypeInteger",
"alias": "ViolatedConstraints"
},
{
"name": "OrderCount",
"type": "esriFieldTypeInteger",
"alias": "OrderCount"
},
{
"name": "TotalCost",
"type": "esriFieldTypeDouble",
"alias": "TotalCost"
},
{
"name": "RegularTimeCost",
"type": "esriFieldTypeDouble",
"alias": "RegularTimeCost"
},
{
"name": "OvertimeCost",
"type": "esriFieldTypeDouble",
"alias": "OvertimeCost"
},
{
"name": "DistanceCost",
"type": "esriFieldTypeDouble",
"alias": "DistanceCost"
},
{
"name": "TotalTime",
"type": "esriFieldTypeDouble",
"alias": "TotalTime"
},
{
"name": "TotalOrderServiceTime",
"type": "esriFieldTypeDouble",
"alias": "TotalOrderServiceTime"
},
{
"name": "TotalBreakServiceTime",
"type": "esriFieldTypeDouble",
"alias": "TotalBreakServiceTime"
},
{
"name": "TotalTravelTime",
"type": "esriFieldTypeDouble",
"alias": "TotalTravelTime"
},
{
"name": "TotalDistance",
"type": "esriFieldTypeDouble",
"alias": "TotalDistance"
},
{
"name": "StartTime",
"type": "esriFieldTypeDate",
"alias": "StartTime",
"length": 16
},
{
"name": "EndTime",
"type": "esriFieldTypeDate",
"alias": "EndTime",
"length": 16
},
{
"name": "TotalWaitTime",
"type": "esriFieldTypeDouble",
"alias": "TotalWaitTime"
},
{
"name": "TotalViolationTime",
"type": "esriFieldTypeDouble",
"alias": "TotalViolationTime"
},
{
"name": "RenewalCount",
"type": "esriFieldTypeInteger",
"alias": "RenewalCount"
},
{
"name": "TotalRenewalServiceTime",
"type": "esriFieldTypeDouble",
"alias": "TotalRenewalServiceTime"
},
{
"name": "Shape_Length",
"type": "esriFieldTypeDouble",
"alias": "Shape_Length"
}
],
"features": [
{
"attributes": {
"ObjectID": 1,
"Name": "Truck_1",
"ViolatedConstraints": null,
"OrderCount": 2,
"TotalCost": 55.12577115597857,
"RegularTimeCost": 32.368821966275576,
"OvertimeCost": 0,
"DistanceCost": 22.756949189702993,
"TotalTime": 161.84410983137786,
"TotalOrderServiceTime": 49,
"TotalBreakServiceTime": 0,
"TotalTravelTime": 52.844109831377864,
"TotalDistance": 15.171299459801997,
"StartTime": 1355241600000,
"EndTime": 1355251310647,
"TotalWaitTime": 0,
"TotalViolationTime": 0,
"RenewalCount": 0,
"TotalRenewalServiceTime": 0,
"Shape_Length": 0.27770417275136994
},
"geometry": {
"paths": [
[
[-122.39476499860575,37.79623499914595],
[-122.39486000028876,37.79632999992958]
],
[
[-122.46491587646648,37.77469887205535],
[-122.4648300002043,37.77348999976374]
]
]
}
},
{
"attributes": {
"ObjectID": 2,
"Name": "Truck_2",
"ViolatedConstraints": null,
"OrderCount": 2,
"TotalCost": 58.98111973045911,
"RegularTimeCost": 31.262990736961367,
"OvertimeCost": 0,
"DistanceCost": 27.71812899349775,
"TotalTime": 156.31495368480682,
"TotalOrderServiceTime": 43,
"TotalBreakServiceTime": 0,
"TotalTravelTime": 53.314953684806824,
"TotalDistance": 18.478752662331832,
"StartTime": 1355241600000,
"EndTime": 1355250978897,
"TotalWaitTime": 0,
"TotalViolationTime": 0,
"RenewalCount": 0,
"TotalRenewalServiceTime": 0,
"Shape_Length": 0.30798071724323045
},
"geometry": {
"paths": [
[
[-122.39476499860575,37.79623499914595],
[-122.39486000028876,37.79632999992958]
],
[-122.47389692820065,37.74313425554152],
[-122.47462999977466,37.74310000036479]
]
]
}
},
{
"attributes": {
"ObjectID": 3,
"Name": "Truck_3",
"ViolatedConstraints": null,
"OrderCount": 2,
"TotalCost": 59.96986647554318,
"RegularTimeCost": 28.12653774395585,
"OvertimeCost": 0,
"DistanceCost": 31.843328731587327,
"TotalTime": 140.63268871977925,
"TotalOrderServiceTime": 38,
"TotalBreakServiceTime": 0,
"TotalTravelTime": 42.63268871977925,
"TotalDistance": 21.228885821058217,
"StartTime": 1355241600000,
"EndTime": 1355250037961,
"TotalWaitTime": 0,
"TotalViolationTime": 0,
"RenewalCount": 0,
"TotalRenewalServiceTime": 0,
"Shape_Length": 0.3486039472893737
},
"geometry": {
"paths": [
[
[-122.39476499860575,37.79623499914595],
[-122.39486000028876,37.79632999992958]
],
[
[-122.44930025350385,37.731549383197546],
[-122.45112999974964,37.73153999967133]
]
]
}
}
],
"exceededTransferLimit": false
}
}
out_directions
This provides access to the turn-by-turn directions for each resulting route.
The following table lists the fields that are returned for output directions:
Field | Description |
---|---|
| The name of the route to which the driving action applies. This value is the same as the |
| The time of day to initiate the given driving action. If the route spans multiple days, the date and time of day are displayed. |
| The type of maneuver that the directions feature represents or the type of the directions text. To determine whether
The Maneuver Types
Directions String Types
|
| Specifies whether the
|
| A text description of the travel directions. |
| The time elapsed in minutes from when the current driving direction starts until the next one starts, or until the route ends for the last driving direction. |
| The distance from where the current driving direction occurs to where the next one occurs, or to where the route ends for the last driving direction. The value is in the units specified by the This value is zero for driving directions that occur at the same location where the next one begins. For example, the |
Syntax example for out_directions
The out
parameter is returned as a JSON feature set with the following syntax:
{
"paramName": "out_directions",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPolyline",
"spatialReference": {
"wkid": <wkid>,
"latestWkid": <wkid>,
},
"fields": [
{
"name": "<field1Name>",
"type": "<field1Type>",
"alias": "<field1Alias>",
"length": "<field1Length>" //length is included only for esriFieldTypeString
},
{
"name": "<field2Name>",
"type": "<field2Type>",
"alias": "<field2Alias>",
"length": "<field2Length>"
}
],
"features": [
{
"geometry": {
"paths": [
[
[
<x11>,
<y11>
],
[
<x12>,
<y12>
]
],
[
[
<x21>,
<y21>
],
[
<x22>,
<y22>
]
]
]
},
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"geometry": {
"paths": [
[
[
<x11>,
<y11>
],
[
<x12>,
<y12>
]
],
[
[
<x21>,
<y21>
],
[
<x22>,
<y22>
]
]
]
},
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
],
"exceededTransferLimit": <true|false>
}
}
Example for out_directions
The following is an example of the out
parameter:
{
"paramName": "out_directions",
"dataType": "GPFeatureRecordSetLayer",
"value": {
"displayFieldName": "",
"geometryType": "esriGeometryPolyline",
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
},
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "RouteName",
"type": "esriFieldTypeString",
"alias": "RouteName",
"length": 128
},
{
"name": "ArriveTime",
"type": "esriFieldTypeDate",
"alias": "ArriveTime",
"length": 16
},
{
"name": "Type",
"type": "esriFieldTypeSmallInteger",
"alias": "Type"
},
{
"name": "SubItemType",
"type": "esriFieldTypeSmallInteger",
"alias": "SubItemType"
},
{
"name": "Text",
"type": "esriFieldTypeString",
"alias": "Text",
"length": 255
},
{
"name": "ElapsedTime",
"type": "esriFieldTypeSingle",
"alias": "ElapsedTime"
},
{
"name": "DriveDistance",
"type": "esriFieldTypeSingle",
"alias": "DriveDistance"
},
{
"name": "Shape_Length",
"type": "esriFieldTypeDouble",
"alias": "Shape_Length"
}
],
"features": [
{
"attributes": {
"ObjectID": 1,
"RouteName": "Truck_1",
"ArriveTime": 1355241600000,
"Type": 18,
"SubItemType": 1,
"Text": "Start at San Francisco",
"ElapsedTime": 60,
"DriveDistance": 0,
"Shape_Length": 0
}
},
{
"attributes": {
"ObjectID": 2,
"RouteName": "Truck_1",
"ArriveTime": 1355241600000,
"Type": 6,
"SubItemType": 2,
"Text": "Time Window: 12/11/2012 4:00 PM - 12/12/2012 1:00 AM",
"ElapsedTime": 60,
"DriveDistance": 0,
"Shape_Length": 0
}
},
{
"attributes": {
"ObjectID": 3,
"RouteName": "Truck_1",
"ArriveTime": 1355241600000,
"Type": 9,
"SubItemType": 2,
"Text": "Service Time: 1 hr ",
"ElapsedTime": 60,
"DriveDistance": 0,
"Shape_Length": 0
}
},
{
"attributes": {
"ObjectID": 4,
"RouteName": "Truck_1",
"ArriveTime": 1355245200000,
"Type": 2,
"SubItemType": 1,
"Text": "Go northwest on THE EMBARCADERO (HERB CAEN WAY)",
"ElapsedTime": 1.015078,
"DriveDistance": 0.2596097,
"Shape_Length": 0.004134325550916659
},
"geometry": {
"paths": [
[
[
-122.39476499860575,
37.79623499914595
],
[
-122.3955800002168,
37.79708999990362
]
]
]
}
},
{
"attributes": {
"ObjectID": 5,
"RouteName": "Truck_1",
"ArriveTime": 1355245260905,
"Type": 5,
"SubItemType": 1,
"Text": "Turn left on BROADWAY",
"ElapsedTime": 3.704131,
"DriveDistance": 0.7392571,
"Shape_Length": 0.013397827315874893
},
"geometry": {
"paths": [
[
[
-122.39755000023229,
37.79928999973373
],
[
-122.39792999976964,
37.799070000380254
]
]
]
}
},
{
"attributes": {
"ObjectID": 14,
"RouteName": "Truck_1",
"ArriveTime": 1355246407621,
"Type": 1,
"SubItemType": 1,
"Text": "Arrive at Store_3, on the left",
"ElapsedTime": 24,
"DriveDistance": 0,
"Shape_Length": 0
}
},
{
"attributes": {
"ObjectID": 15,
"RouteName": "Truck_1",
"ArriveTime": 1355246407621,
"Type": 6,
"SubItemType": 2,
"Text": "Time Window: 12/11/2012 5:00 PM - 12/12/2012 1:00 AM",
"ElapsedTime": 24,
"DriveDistance": 0,
"Shape_Length": 0
}
},
{
"attributes": {
"ObjectID": 16,
"RouteName": "Truck_1",
"ArriveTime": 1355246407621,
"Type": 9,
"SubItemType": 2,
"Text": "Service Time: 24 min",
"ElapsedTime": 24,
"DriveDistance": 0,
"Shape_Length": 0
}
},
{
"attributes": {
"ObjectID": 17,
"RouteName": "Truck_1",
"ArriveTime": 1355247847621,
"Type": 18,
"SubItemType": 1,
"Text": "Depart Store_3",
"ElapsedTime": 0,
"DriveDistance": 0,
"Shape_Length": 0
}
},
{
"attributes": {
"ObjectID": 18,
"RouteName": "Truck_1",
"ArriveTime": 1355247847621,
"Type": 2,
"SubItemType": 1,
"Text": "Continue south on 7TH AVE",
"ElapsedTime": 0.5039461,
"DriveDistance": 0.08350408,
"Shape_Length": 0.001211918705951693
},
"geometry": {
"paths": [
[
[
-122.46491587646648,
37.77469887205535
],
[
-122.4648300002043,
37.77348999976374
]
]
]
}
},
{
"attributes": {
"ObjectID": 19,
"RouteName": "Truck_1",
"ArriveTime": 1355247877858,
"Type": 6,
"SubItemType": 1,
"Text": "Turn right on FULTON ST",
"ElapsedTime": 7.81348,
"DriveDistance": 2.474024,
"Shape_Length": 0.04514114889321549
},
"geometry": {
"paths": [
[
[
-122.4648300002043,
37.77348999976374
],
[
-122.46588000006193,
37.773380000087
]
]
]
}
}
],
"exceededTransferLimit": false
}
}
out_unassigned_stops
This provides access to the orders that couldn't be visited by any routes. You can also determine why the orders couldn't be visited and make the necessary changes to correct the problem.
The parameter supports the following fields:
Field | Description |
---|---|
| Indicates whether the stop represents a depot, an order, or a break. The field value is an integer that can be interpreted in the following ways:
|
| The name of the stop. The value of this field is the same as the |
| |
| These fields contain a summary of violated constraints and are set after a solve operation. Each field will contain one violation. If an order has more than one violation, the next Shows a single violated constraint per field.
|
| Indicates the status of the point with respect to its location on the network and the outcome of the analysis. The possible values are the following:
|
Syntax example for out_unassigned_stops
The out
parameter is returned as a JSON feature set with following syntax.
Unlike the out
parameter, the out
parameter does not contain spatial
or geometry
properties because this parameter does not return any geometry information about the stops.
{
"paramName": "out_unassigned_stops",
"dataType": "GPRecordSet",
"value": {
"displayFieldName": "",
"fields": [
{
"name": "<field1Name>",
"type": "<field1Type>",
"alias": "<field1Alias>",
"length": "<field1Length>" //length is included only for esriFieldTypeString
},
{
"name": "<field2Name>",
"type": "<field2Type>",
"alias": "<field2Alias>",
"length": "<field2Length>"
}
],
"features": [
{
"attributes": {
"<field1>": <value11>,
"<field2>": <value12>
}
},
{
"attributes": {
"<field1>": <value21>,
"<field2>": <value22>
}
}
],
"exceededTransferLimit": <true|false>
}
}
Example for out_unassigned_stops
The following is an example of the out
parameter.
{
"paramName": "out_unassigned_stops",
"dataType": "GPRecordSet",
"value": {
"displayFieldName": "",
"fields": [
{
"name": "ObjectID",
"type": "esriFieldTypeOID",
"alias": "ObjectID"
},
{
"name": "StopType",
"type": "esriFieldTypeSmallInteger",
"alias": "StopType"
},
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
"length": 128
},
{
"name": "ViolatedConstraints",
"type": "esriFieldTypeInteger",
"alias": "ViolatedConstraints"
},
{
"name": "Status",
"type": "esriFieldTypeInteger",
"alias": "Status"
}
],
"features": [
{
"attributes": {
"ObjectID": 1,
"StopType": 0,
"Name": "Store_6",
"ViolatedConstraints": 1,
"Status": 5
}
},
{
"attributes": {
"ObjectID": 2,
"StopType": 0,
"Name": "Store_8",
"ViolatedConstraints": 1,
"Status": 5
}
},
{
"attributes": {
"ObjectID": 3,
"StopType": 0,
"Name": "Store_9",
"ViolatedConstraints": 1,
"Status": 5
}
}
],
"exceededTransferLimit": false
}
}
solve_succeeded
Use this parameter to determine whether the service successfully found the solution for the input vehicle routing problem. The error messages for the failure can be obtained by making a request to get the status of the job.
The solve
parameter is returned as a JSON feature set with the following syntax:
{
"paramName": "solve_succeeded",
"dataType": "GPBoolean",
"value": <true | false>
}
The following is an example of the solve
parameter:
{
"paramName": "solve_succeeded",
"dataType": "GPBoolean",
"value": true
}
out_route_data
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. The parameter value is populated only when the save
parameter is set to true
.
out_result_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. The parameter value is not populated when the output
parameter is set to Feature Set
.
out_network_analysis_layer
Use this parameter to access the network analysis layer file that stores the analysis settings and the inputs and outputs used for the analysis. The parameter value is populated only when the save
parameter is set to true
.
Example usage
The vehicle routing problem service supports synchronous and asynchronous operation modes. Asynchronous and synchronous modes define how the application interacts with the service and gets the result. When using the synchronous mode, the application waits for the request to finish and get the results. This mode is well suited for requests that complete quickly (under 10 seconds). When using the asynchronous mode, the client must periodically check whether the service has finished running and, once completed, get the result. While the service is running, you can use the application to do other things. This mode is well suited for requests that take a long time to complete.
A request to the vehicle routing problem service has a URL that is specific to the mode. When using the synchronous mode, the request is in the following format:
https:///EditVehicleRoutingProblem/execute?parameters
When using the asynchronous mode, the request is in the following format:
https:///SolveVehicleRoutingProblem/submitJob?parameters
Service a set of orders with a fleet of vehicles
In this example, you will find the best routes for a fleet of three vehicles, operated by a distribution company, to deliver goods from a distribution center to a set of nine grocery stores. Each store has a specific quantity of demand for the goods, and each truck has a limited capacity for carrying the goods. The main objective is to assign trucks in the fleet a subset of the stores to service and to sequence the deliveries in a way that minimizes the overall transportation costs.
To solve this vehicle routing problem, specify the stores as orders, the distribution center as the depot, and the three trucks as routes. For orders and depots, the geometries are in the spatial reference of the network dataset, so the spatial
property is not required.
For the orders
parameter, the store name will be assigned to the Name
attribute, the service time to the Service
attribute, the total weight of good to be delivered to the Delivery
attribute, the time range in which the store accepts deliveries as the Time
and Time
attributes, and 0
as the value for the Max
attribute since the time windows should not be violated.
For the depots
parameter, specify the depot name as the Name
attribute and the depot operating time as the Time
and Time
attributes.
For the routes
parameter, the name for each truck will be assigned to the Name
attribute, the depot name from where the trucks operation as the Start
and End
attributes, and the time required to fully load the truck with goods as Start
. The same values as Time
and Time
for the depot
parameter can be assigned to the Earliest
and Latest
attributes, since the trucks can start operation as soon as the depot opens. The maximum carrying capacity of each truck assigned to the Capacities
attribute, the wage of the truck driver as the Cost
attribute, and the average dollar amount spent per mile on fuel consumption, truck deprecation, and maintenance as the Cost
attribute. The maximum number of stores that can be serviced by a truck will be assigned to the Max
attribute, the maximum duration of the work shift for the drivers according to the workday constraints applies to the Max
attribute, and the maximum distance a truck can travel that balances both the daily fuel and maintenance costs among the fleet as the Max
attribute.
Since the time-based attribute values, such as Service
, Cost
, and Max
, are in minutes, you can use the default value (which is minutes) for the time
parameter. Similarly, since the distance-based attributes values, such as Cost
and Max
, are in miles, you can use the default value (which is miles) for the distance
parameter. It is difficult for these delivery trucks to make U-turns, so set the uturn
parameter as NO
. You need to generate driving directions in English for each route, so set the populate
parameter to true
and the directions
parameter to en
. Since there are time windows on orders and depots, you need to specify the default
parameter. The default values for all the remaining parameters are valid for this problem, so you will not pass those parameters in the request.
Submit job
Because there are three routes, select the asynchronous mode. The first request is to submit a job that returns the job ID.
Request example
|