Solve Route

Description

The solve operation is performed on a network layer resource.

The solve operation is supported on a network layer whose layerType is esriNAServerRouteLayer.

You can provide arguments to the solve route operation as query parameters defined in the parameters table below.

Added at 10.3

Set travelMode and automatically set override values for various other parameters to quickly and consistently model cars, trucks, a type of truck, and so on.

Added at 10.2.1

startTimeIsUTC lets you specify whether startTime is in UTC or the time zone of the first stop. By using UTC, you can have all routes start at the same time regardless of which time zones the stops are located in.

Added at 10.1

Request Parameters

Parameter

Details

f

Description: The response format. The default response format is html.

Values: html | json

stops

Description: The set of stops loaded as network locations during analysis. Stops can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If stops are not specified, preloaded stops from the map document are used in the analysis.

Syntax and Examples:

Simple syntax:

You can use a simple comma/semi-colon based syntax if you need to specify only stop point geometries in the default spatial reference or WGS84.

Syntax: stops=x1,y1; x2, y2; ...; xn, yn

Example: stops=-122.4079, 37.78356; -122.404, 37.782

JSON Structures:

Using JSON structures, you can specify two types of stops:

  • Features: Stop geometries and attributes expressed as a feature set.
  • Layer: Stops referencing a data layer in the map service.

Features

You can specify stop geometries as well as attributes using a more comprehensive JSON structure.

The JSON structure can include the following properties:

  • features: Optional. An array of features. Either "features" or "url" property should be specified.
  • //This option was added at 10.1.

    url: Optional. REST Query request to a Feature, Map, GP service returning a JSON feature set. Either "features" or "url" property should be specified.

  • type: Optional. The default type is features.
  • doNotLocateOnRestrictedElements: Optional. If true, the features will only be located on streets that are traversable, not on roads that are restricted due to restriction attributes or barriers. Default is true.
  • hasZ: Optional. Indicates if the features geometry contain Z values.

Each feature in this array represents a stop and it contains the following fields:

  • geometry: specifies the stop geometry. The structure for the geometry is same as the structure of the standard ArcGIS REST API point geometry.
  • attributes: key-value pairs where the key is the name of the specified field, and the value is the value for the corresponding field.

Syntax 1: using features:

{ 
"type" : "features",
"hasZ": <true|false>,
"features"  : [
{
  "geometry" : {<geometry1>},
  "attributes" : {"<field1>" : <value11>, "<field2>" : <value12>}
},
{
  "geometry" : {<geometry2>},
  "attributes" : {"<field1>" : <value21>, "<field2>" : <value22>}
}
],
"doNotLocateOnRestrictedElements" : true | false
}

Example:

{ 
"features"  : [
{
  "geometry" : {"x" : -122.4079, "y" : 37.78356},
  "attributes" : {"Name" : "From", "RouteName" : "Route A"}
},
{
  "geometry" : {"x" : -122.404, "y" : 37.782},
  "attributes" : {"Name" : "To", "RouteName" : "Route A"}
}
]
}

Syntax 2: using url: //This option was added at 10.1.

{ 
  "type" : "features",
  "url" : "<url>",
  "doNotLocateOnRestrictedElements" : true | false
}

Example:

{ 
  "type" : "features",
  "url" : "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/1/query?where=1%3D1&outFields=Name,RouteName&f=json",
  "doNotLocateOnRestrictedElements" : true
}

Layer

You can specify stops by referencing a data layer in the map service. Attribute and spatial filters can also be applied on the layer.

The JSON structure can include the following properties:

  • type: The type should be set to layer to indicate that the user is specifying the stops by referencing a layer.
  • layerName: The name or Id of the data layer in the map service that is being referenced.
  • where: Optional. A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed.
  • geometry: Optional. The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the json geometry objects returned by the ArcGIS REST API.

    The geometry type is specified using the geometryType property.

  • geometryType: Optional. The type of geometry specified by the geometry property. The geometry type can be an envelope, point, line, or polygon. The default geometry type is an envelope.

    Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope

  • spatialRel: Optional. The spatial relationship to be applied on the input geometry. The supported spatial relationships include intersects, contains, envelope intersects, within, etc. The default spatial relationship is intersects (esriSpatialRelIntersects).

    Values: esriSpatialRelIntersects | esriSpatialRelContains | esriSpatialRelCrosses | esriSpatialRelEnvelopeIntersects | esriSpatialRelIndexIntersects | esriSpatialRelOverlaps | esriSpatialRelTouches | esriSpatialRelWithin

  • doNotLocateOnRestrictedElements: Optional. If true, restricted network elements should be considered when finding network locations.

    Default is false.

Syntax:

{ 
  "type" : "layer",
  "layerName" : "<layerName>",
  "where" : "<whereClause>",
  "geometry" : {<geometry>},
  "geometryType" : "<geometryType>",
  "spatialRel" : "<spatialRel>",
  "doNotLocateOnRestrictedElements" : true | false
}

Example:

{ 
  "type" : "layer",
  "layerName" : "PointsOfInterest",
  "where" : "CITY = 'San Francisco'"
}

barriers

Description: The set of barriers loaded as network locations during analysis. Barriers can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If barriers are not specified, preloaded barriers from the map document are used in the analysis. If an empty json object is passed ('{}') preloaded barriers are ignored.

Syntax and Examples:

Simple syntax:

You can use a simple comma / semi-colon based syntax if you need to specify only barrier point geometries in the default spatial reference or WGS84.

Syntax: barriers=x1,y1; x2, y2; ...; xn, yn

Example: barriers=-122.406, 37.7831; -122.405, 37.7827

JSON Structures:

Using JSON structures, you can specify two types of barriers:

  • Features: Barrier geometries and attributes expressed as a feature set.
  • Layer: Barriers referencing a data layer in the map service.

Features

You can specify barrier geometries as well as attributes using a more comprehensive JSON structure.

The JSON structure can include the following properties:

  • features: Optional. An array of features. Either "features" or "url" property should be specified.
  • url: Optional. REST Query request to a Feature, Map, GP service returning a JSON feature set. Either "features" or "url" property should be specified.
  • type: Optional. The default type is features.
  • hasZ: Optional. Indicates if the features geometry contain Z values.

Each feature in this array represents a barrier, and it contains the following fields:

  • geometry: specifies the barrier geometry. The structure for the geometry is same as the structure of the standard ArcGIS REST API point geometry.
  • attributes: key-value pairs where the key is the name of the specified field, and the value is the value for the corresponding field.

Syntax 1: using features:

{ 
"type" : "features",
"hasZ": <true|false>,
"features"  : [
{
  "geometry" : {<geometry1>},
  "attributes" : {"<field1>" : <value11>, "<field2>" : <value12>}
},
{
  "geometry" : {<geometry2>},
  "attributes" : {"<field1>" : <value21>, "<field2>" : <value22>}
}
]
}

Example:

{ 
"features"  : [
{
  "geometry" : {"x" : -122.406, "y" : 37.7831},
  "attributes" : {"Name" : "Barrier 1"}
},
{
  "geometry" : {"x" : -122.405, "y" : 37.7827},
  "attributes" : {"Name" : "Barrier 2"}
}
]
}

Syntax 2: using url: //This option was added at 10.1.

{ 
  "type" : "features",
  "url" : "<url>"
}

Example:

{ 
  "type" : "features",
  "url" : "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/0/query?where=1%3D1&returnGeometry=true&f=json"
}

Layer

You can specify barriers by referencing a data layer in the map service. Attribute and spatial filters can also be applied on the layer.

The JSON structure can include the following properties:

  • type: The type should be set to layer to indicate that the user is specifying the barriers by referencing a layer.
  • layerName: The name or Id of the data layer in the map service that is being referenced.
  • where: Optional. A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed.
  • geometry: Optional. The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the json geometry objects returned by the ArcGIS REST API.

    The geometry type is specified using the geometryType property.

  • geometryType: Optional. The type of geometry specified by the geometry property. The geometry type can be an envelope, point, line, or polygon. The default geometry type is an envelope.

    Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope

  • spatialRel: Optional. The spatial relationship to be applied on the input geometry. The supported spatial relationships include intersects, contains, envelope intersects, within, etc. The default spatial relationship is intersects (esriSpatialRelIntersects).

    Values: esriSpatialRelIntersects | esriSpatialRelContains | esriSpatialRelCrosses | esriSpatialRelEnvelopeIntersects | esriSpatialRelIndexIntersects | esriSpatialRelOverlaps | esriSpatialRelTouches | esriSpatialRelWithin

Syntax:

{ 
  "type" : "layer",
  "layerName" : "<layerName>",
  "where" : "<whereClause>",
  "geometry" : {<geometry>},
  "geometryType" : "<geometryType>",
  "spatialRel" : "<spatialRel>"
}

Example:

{ 
  "type" : "layer",
  "layerName" : "TrafficAccidents",
  "where" : "SEVERITY > 0"
}

polylineBarriers

Description: The set of polyline barriers loaded as network locations during analysis. If polyline barriers are not specified, preloaded polyline barriers from the map document are used in the analysis. If an empty json object is passed ('{}') preloaded polyline barriers are ignored.

Syntax and Examples:

JSON Structures:

Using JSON structures, you can specify two types of barriers:

  • Features: Polyline barrier geometries and attributes expressed as a feature set.
  • Layer: Polyline barriers referencing a data layer in the map service.

Features

You can specify polyline barrier geometries as well as attributes using a more comprehensive JSON structure.

The JSON structure can include the following properties:

  • features: Optional. An array of features. Either "features" or "url" property should be specified.
  • url: Optional. REST Query request to a Feature, Map, GP service returning a JSON feature set. Either "features" or "url" property should be specified.
  • type: Optional. The default type is features.
  • hasZ: Optional. Indicates if the features geometry contain Z values.

Each feature in this array represents a barrier and it contains the following fields:

  • geometry: specifies the barrier geometry. The structure for the geometry is same as the structure of the standard ArcGIS REST API polyline geometry.
  • attributes: key-value pairs where the key is the name of the specified field, and the value is the value for the corresponding field.

Syntax 1: using features:

{ 
"type" : "features",
"hasZ": <true|false>,
"features"  : [
{
  "geometry" : {<polyline1>},
  "attributes" : {"<field1>" : <value11>, "<field2>" : <value12>}
},
{
  "geometry" : {<polyline2>},
  "attributes" : {"<field1>" : <value21>, "<field2>" : <value22>}
}
]
}

Example:

{ 
"features"  : [
{
  "geometry" : {
     "paths" : [ 
     [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ], 
     [ [-97.06326,32.759], [-97.06298,32.755] ]
    ],
    "spatialReference" : {"wkid" : 4326}
    },
  "attributes" : {"Name" : "Barrier 1"}
},
{
  "geometry" : {
     "paths" : [ 
     [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ], 
     [ [-97.06326,32.759], [-97.06298,32.755] ]
    ],
    "spatialReference" : {"wkid" : 4326}
   },
  "attributes" : {"Name" : "Barrier 2"}
}
]
}

Syntax 2: using url: //This option was added at 10.1.

{ 
  "type" : "features",
  "url" : "<url>"
}

Example:

{ 
  "type" : "features",
  "url" : "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/6/query?where=1%3D1&returnGeometry=true&f=json"
}

Layer

You can specify polyline barriers by referencing a data layer in the map service. Attribute and spatial filters can also be applied on the layer.

The JSON structure can include the following properties:

  • type: The type should be set to layer to indicate that the user is specifying the polyline barriers by referencing a layer.
  • layerName: The name of the data layer in the map service that is being referenced.
  • where: Optional. A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed.
  • geometry: Optional. The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the json geometry objects returned by the ArcGIS REST API.

    The geometry type is specified using the geometryType property.

  • geometryType: Optional. The type of geometry specified by the geometry property. The geometry type can be an envelope, point, line, or polygon. The default geometry type is an envelope.

    Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope

  • spatialRel: Optional. The spatial relationship to be applied on the input geometry. The supported spatial relationships include intersects, contains, envelope intersects, within, etc. The default spatial relationship is intersects (esriSpatialRelIntersects).

    Values: esriSpatialRelIntersects | esriSpatialRelContains | esriSpatialRelCrosses | esriSpatialRelEnvelopeIntersects | esriSpatialRelIndexIntersects | esriSpatialRelOverlaps | esriSpatialRelTouches | esriSpatialRelWithin

Syntax:

{ 
  "type" : "layer",
  "layerName" : "<layerName>",
  "where" : "<whereClause>",
  "geometry" : {<geometry>},
  "geometryType" : "<geometryType>",
  "spatialRel" : "<spatialRel>"
}

Example:

{ 
  "type" : "layer",
  "layerName" : "PolylineBarrier"
}

polygonBarriers

Description: The set of polygon barriers loaded as network locations during analysis. If polygon barriers are not specified, preloaded polygon barriers from the map document are used in the analysis. If an empty json object is passed ('{}') preloaded polygon barriers are ignored.

Syntax and Examples:

JSON Structures:

Using JSON structures, you can specify two types of barriers:

  • Features: Polygon barrier geometries and attributes expressed as a feature set.
  • Layer: Polygon barriers referencing a data layer in the map service.

Features

You can specify polygon barrier geometries as well as attributes using a more comprehensive JSON structure.

The JSON structure can include the following properties:

  • features: Optional. An array of features. Either "features" or "url" property should be specified.
  • url: Optional. REST Query request to a Feature, Map, GP service returning a JSON feature set. Either "features" or "url" property should be specified.
  • type: Optional. The default type is features.
  • hasZ: Optional. Indicates if the features geometry contain Z values.

Each feature in this array represents a barrier and it contains the following fields:

  • geometry: specifies the barrier geometry. The structure for the geometry is same as the structure of the standard ArcGIS REST API polygon geometry.
  • attributes: key-value pairs where the key is the name of the specified field, and the value is the value for the corresponding field.

Syntax:

{ 
"type" : "features",
"features"  : [
{
  "geometry" : {<polygon1>},
  "attributes" : {"<field1>" : <value11>, "<field2>" : <value12>}
},
{
  "geometry" : {<polygon3>},
  "attributes" : {"<field1>" : <value21>, "<field2>" : <value22>}
}
]
}

Example:

{ 
"features"  : [
{
  "geometry" : {
     "rings" : [ 
     [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ], 
     [ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]
    ],
    "spatialReference" : {"wkid" : 4326}
    },
  "attributes" : {"Name" : "Barrier 1"}
},
{
  "geometry" : {
    "rings" : [ 
     [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ], 
     [ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]
    ],
    "spatialReference" : {"wkid" : 4326}
    },
  "attributes" : {"Name" : "Barrier 2"}
}
]
}

Syntax 2: using url: //This option was added at 10.1.

{ 
  "type" : "features",
  "url" : "<url>"
}

Example:

{ 
  "type" : "features",
  "url" : "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/7/query?where=1%3D1&returnGeometry=true&f=json"
}

Layer

You can specify polygon barriers by referencing a data layer in the map service. Attribute and spatial filters can also be applied on the layer.

The JSON structure can include the following properties:

  • type: The type should be set to layer to indicate that the user is specifying the polygon barriers by referencing a layer.
  • layerName: The name or Id of the data layer in the map service that is being referenced.
  • where: Optional. A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed.
  • geometry: Optional. The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the json geometry objects returned by the ArcGIS REST API.

    The geometry type is specified using the geometryType property.

  • geometryType: Optional. The type of geometry specified by the geometry property. The geometry type can be an envelope, point, line, or polygon. The default geometry type is an envelope.

    Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope

  • spatialRel: Optional. The spatial relationship to be applied on the input geometry. The supported spatial relationships include intersects, contains, envelope intersects, within, etc. The default spatial relationship is intersects (esriSpatialRelIntersects).

    Values: esriSpatialRelIntersects | esriSpatialRelContains | esriSpatialRelCrosses | esriSpatialRelEnvelopeIntersects | esriSpatialRelIndexIntersects | esriSpatialRelOverlaps | esriSpatialRelTouches | esriSpatialRelWithin

Syntax:

{ 
  "type" : "layer",
  "layerName" : "<layerName>",
  "where" : "<whereClause>",
  "geometry" : {<geometry>},
  "geometryType" : "<geometryType>",
  "spatialRel" : "<spatialRel>"
}

Example:

{ 
  "type" : "layer",
  "layerName" : "PolygonBarrier"
}

travelMode

//Added at 10.3

Travel modes provide override values that help you quickly and consistently model a vehicle or mode of transportation. By setting a travel mode, you don't need to explicitly set values for the following parameters:

  • impedanceAttributeName
  • attributeParameterValues
  • restrictUTurns
  • useHierarchy
  • restrictionAttributeNames
  • outputGeometryPrecision
  • outputGeometryPrecisionUnits
  • directionsTimeAttributeName

CautionCaution:

When setting travelMode, the service automatically overrides the values of the parameters listed above, even if you define their values in the request. If you don't set travelMode, the service honors the default or user-defined values for the parameters that would otherwise be overridden, allowing you to create your own travel mode when making the request.

The chosen travel mode must be preconfigured on the network dataset that the routing service references.

NoteNote:

The travelMode parameter requires an item ID to be passed in rather than a travel-mode name. The item ID values of the service may change over time, so it is important to include the following look-up logic in your applications:

  1. Retrieve the service description in JSON form (for example, http://<my server>:6080/arcgis/rest/services/<service name>/NAServer/Route?f=json).

  2. In the JSON file, look up the supportedTravelModes name, whose value is an array.

    Example supportedTravelModes value.

    { ...
        "supportedTravelModes": [
            {
                "name": "TruckingTime",
                "itemId": "1"
            },
            {
                "name": "WalkingTime",
                "itemId": "5"
            }
        ] 
    ...
    }
    

  3. In the array, find the travel mode name you want and get the associated itemId value.

  4. Pass the itemID value as the travelMode parameter value.

Example: travelMode=5

attributeParameterValues

Description: A set of attribute parameter values that can be parameterized to determine which network elements can be used by a vehicle.

The parameter holding a vehicle characteristic is compared to a value coming from a descriptor attribute to determine whether or not a network element is traversable. For e.g. a parameterized restriction attribute can compare the height of your vehicle with a descriptor attribute that holds the clearance under overpasses through tunnels. If the vehicles height is greater than the clearance, the edge is restricted.

Parameterized cost attributes that can reference other cost attributes and scale them, can also be used. This is useful when inclement weather like ice, fog or heavy rain, descends on the study area and hinders normal flow of traffic. By having a parameter already outfitted on a cost attribute, travel-time expectations and traversable network paths can be adjusted with respect to changes in traffic speeds.

Syntax:

[ 
{
  "attributeName" : "<attribute1>",
  "parameterName" : "<parameter1>",
  "value" : "<value1>"
}, 
{
  "attributeName" : "<attribute2>",
  "parameterName" : "<parameter2>",
  "value" : "<value2>"
}
]

Example:

[
{ 
  "attributeName" : "Time",
  "parameterName" : "65 MPH",
  "value" : "5.0"
}
]

returnDirections

Description: If true, directions will be generated and returned with the analysis results. Default is true.

The directions are available in the directions property of the JSON response.

Values: true | false

returnRoutes

Description: If true, routes will be returned with the analysis results. Default is true.

The routes are available in the routes property of the JSON response.

Values: true | false

returnStops

Description: If true, stops will be returned with the analysis results. Default is false.

The stops are available in the stops property of the JSON response.

Values: true | false

returnBarriers

Description: If true, barriers will be returned with the analysis results. Default is false.

The barriers are available in the barriers property of the JSON response.

Values: true | false

returnPolylineBarriers

Description: If true, polyline barriers will be returned with the analysis results. Default is false.

The polyline barriers are available in the polylineBarriers property of the JSON response.

Values: true | false

returnPolygonBarriers

Description: If true, polygon barriers will be returned with the analysis results. Default is false.

The polygon barriers are available in the polygonBarriers property of the JSON response.

Values: true | false

outSR

Description: The spatial reference of the geometries returned with the analysis results.

The spatial reference can be specified as either a well-known ID or as a spatial reference json object.

If outSR is not specified, the geometries are returned in the spatial reference of the map.

ignoreInvalidLocations

Description: If true, the solver will ignore invalid locations. Otherwise, it will raise an error. The default is as defined in the network layer.

Values: true | false

outputLines

Description: The type of output lines to be generated in the result. The default is as defined in the network layer.

Values: esriNAOutputLineNone | esriNAOutputLineStraight | esriNAOutputLineTrueShape | esriNAOutputLineTrueShapeWithMeasure

findBestSequence

Description: If true, the solver should re-sequence the route in the optimal order. The default is as defined in the network layer.

Values: true | false

preserveFirstStop

Description: If true, the solver should keep the first stop fixed in the sequence. The default is as defined in the network layer.

Values: true | false

preserveLastStop

Description: If true, the solver should keep the last stop fixed in the sequence. The default is as defined in the network layer.

Values: true | false

useTimeWindows

Description: If true, the solver should consider time windows. The default is as defined in the network layer.

Values: true | false

startTime

Description: The time the route begins. If not specified, the solver will use the default as defined in the network layer.

The time should be specified as a numeric value representing the milliseconds since midnight January 1, 1970. It can be a negative number.

You can also specify a value of none to indicate that a start time should not be used.

Example: startTime=1227663551096 (Wed Nov 26 2008 01:39:11 UTC)

startTimeIsUTC

This option was added at 10.2.1

Description: The time zone of the startTime parameter.

By setting this parameter to false, which is the default value, the startTime parameter refers to the time zone in which the first stop is located. (Even though startTime is set as the number of milliseconds since midnight January 1, 1970 UTC to the target start time and date UTC, the UTC time zone is ignored and replaced with the time zone in which the first stop is located. For example, a time of 2:00 a.m. today UTC would become 2:00 a.m. today Eastern time if the first stop is located in the Eastern time zone.)

A true value for startTimeIsUTC indicates the startTime parameter refers to Coordinated Universal Time (UTC). Choose this option if you want to solve the analysis for a specific time, such as now, but aren't certain in which time zone the facilities or demand points will be located.

When solving a route analysis that spans across multiple time zones and setting a start time, preserveFirstStop must be true.

Values: true | false

accumulateAttributeNames

Description: The list of network attribute names to be accumulated with the analysis. The default is as defined in the network layer.

The value should be specified as a comma separated list of attribute names.

You can also specify a value of none to indicate that no network attributes should be accumulated.

Example: accumulateAttributeNames=WalkingMinutes,Meters

impedanceAttributeName

Description: The network attribute name to be used as the impedance attribute in analysis. The default is as defined in the network layer.

Example: impedanceAttributeName=DrivingMinutes

restrictionAttributeNames

Description: The list of network attribute names to be used as restrictions with the analysis. The default is as defined in the network layer.

The value should be specified as a comma separated list of attribute names.

You can also specify a value of none to indicate that no network attributes should be used as restrictions.

Example: restrictionAttributeNames=Oneway

restrictUTurns

Description: Specifies how U-Turns should be restricted in the analysis. The default is as defined in the network layer.

Values: esriNFSBAllowBacktrack | esriNFSBAtDeadEndsOnly | esriNFSBNoBacktrack | esriNFSBAtDeadEndsAndIntersections

useHierarchy

Description: If true, the hierarchy attribute for the network should be used in analysis. The default is as defined in the network layer.

Values: true | false

directionsLanguage

Description: The language to be used when computing directions. The default is as defined in the network layer. The list of supported languages can be found in REST layer description.

Example: directionsLanguage=en

directionsOutputType

Description: Defines content, verbosity of returned directions. The default is esriDOTStandard.

Values: esriDOTComplete | esriDOTCompleteNoEvents | esriDOTInstructionsOnly | esriDOTStandard | esriDOTSummaryOnly

directionsStyleName

Description: The style to be used when returning the directions. The default is as defined in the network layer. The list of supported styles can be found in REST layer description.

Example: directionsStyleName=NA Navigation

directionsLengthUnits

Description: The length units to use when computing directions. The default is as defined in the network layer.

Values: esriNAUFeet | esriNAUKilometers | esriNAUMeters | esriNAUMiles | esriNAUNauticalMiles | esriNAUYards | esriNAUUnknown

directionsTimeAttributeName

Description: The name of network attribute to use for the drive time when computing directions. The default is as defined in the network layer.

Example: directionsTimeAttributeName=DriveTime

outputGeometryPrecision

Description: The precision of the output geometry after generalization. If 0, no generalization of output geometry is performed. The default is as defined in the network service configuration. If present and positive, it represents the MaximumAllowableOffset parameter - generalization is performed according to IPolycurve.Generalize.

Example: outputGeometryPrecision=0.5

outputGeometryPrecisionUnits

Description: The units of the output geometry precision. The default value is esriUnknownUnits

Values: esriUnknownUnits | esriCentimeters | esriDecimalDegrees | esriDecimeters | esriFeet | esriInches | esriKilometers | esriMeters | esriMiles | esriMillimeters | esriNauticalMiles | esriPoints | esriYards

returnZ

//This option was added at 10.1.

Description: If true, Z values will be included in the returned routes and compressed geometry if the network dataset is Z-aware. The default is false.

Example Usage

Example 1: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route/solve?stops={"features":[{"geometry":{"x":-122.4079,"y":37.78356},"attributes":{"Name":"From","RouteName":"Route A"}},{"geometry":{"x":-122.404,"y":37.782},"attributes":{"Name":"To","RouteName":"Route A"}}]}&barriers=&polylineBarriers=&polygonBarriers=&outSR=4326&ignoreInvalidLocations=true&accumulateAttributeNames=&impedanceAttributeName=Time&restrictionAttributeNames=OneWay,TurnRestriction,Avoid passenger ferries,Non-routeable segments&attributeParameterValues=&restrictUTurns=esriNFSBAllowBacktrack&useHierarchy=true&returnDirections=true&returnRoutes=true&returnStops=false&returnBarriers=false&returnPolylineBarriers=false&returnPolygonBarriers=false&directionsLanguage=&directionsStyleName=NA Desktop&outputLines=esriNAOutputLineTrueShape&findBestSequence=false&preserveFirstStop=true&preserveLastStop=true&useTimeWindows=true&startTime=1227663551096&outputGeometryPrecision=&outputGeometryPrecisionUnits=esriUnknownUnits&directionsTimeAttributeName=Time&directionsLengthUnits=esriNAUMiles&f=pjson

JSON Response Syntax

{
"directions": [
{
  "routeId": <routeId>,
  "routeName": "<routeName>",
  "summary": {
    "totalLength": <totalLength>,
    "totalTime": <totalTime>,
    "totalDriveTime": <totalDriveTime>,
    "envelope": {<envelope>}
  },
  "hasZ": <true|false>,
  "hasM": <true|false>,
  "features": [
    {
      "attributes" : 
      {
        "length": <length1>,
        "time": <time1>,
        "text": "<text1>",
        "ETA": <ETA>,
        "maneuverType": "<maneuverType1>"
      },
      "compressedGeometry": "<compressedGeometry1>"
    },
    {
      "attributes" : 
      {
        "length": <length2>,
        "time": <time2>,
        "text": "<text2>",
        "maneuverType": "<maneuverType2>"
      },
      "compressedGeometry": "<compressedGeometry2>"
    }
  ]
}
],
"routes": {
  "spatialReference" : { <spatialReference> },
   "hasZ": <true|false>,
   "hasM": <true|false>,
  "features": [
  {
    "attributes": {
      "<field1>": <value11>,
      "<field2>": <value12>
    },
    "geometry": {<polyline1>}
  },
  {
    "attributes": {
      "<field1>": <value21>,
      "<field2>": <value22>
    },
    "geometry": {<polyline2>}
  }
  ]
},
"stops": {
  "spatialReference" : { <spatialReference> },
   "hasZ": <true|false>,
   "features": [
  {
    "attributes": {
      "<field1>": <value11>,
      "<field2>": <value12>
    },
    "geometry": {<point1>}
  },
  {
    "attributes": {
      "<field1>": <value21>,
      "<field2>": <value22>
    },
    "geometry": {<point2>}
  }
  ]
},
"barriers": {
  "spatialReference" : { <spatialReference> },
  "hasZ": <true|false>,
  "features": [
  {
    "attributes": {
      "<field1>": <value11>,
      "<field2>": <value12>
    },
    "geometry": {<point1>}
  },
  {
    "attributes": {
      "<field1>": <value21>,
      "<field2>": <value22>
    },
    "geometry": {<point2>}
  }
  ]
},
"messages": [
  { "type": <type1>, "description": "<description1>" },
  { "type": <type2>, "description": "<description2>" }
]
}

JSON Response Example

{
"directions": [
{
  "routeId": 1,
  "routeName": "Location 1 - Location 2",
  "summary": {
    "totalLength": 0.50052060003988,
    "totalTime": 0.95,
    "totalDriveTime": 0.94686265905424,
    "envelope": {"xmin": -122.4079, "ymin": 37.782, "xmax": -122.40272, "ymax": 37.784}
  },
  "features": [
    {
      "attributes: {
        "length": 0,
        "time": 0,
        "text": "Start at Location 1",
        "ETA": 1227663551096,
        "maneuverType": "esriDMTDepart"
      },
      "compressedGeometry": "+1lmd-6dda6+1vcv5+0+0"
    },
    {
      "attributes: {
        "length": 0.021503010479337,
        "time": 0.0515989876798832,
        "text": "Go northeast on Stevenson St toward 5th St",
        "ETA": 1228163550000,
        "maneuverType": "esriDMTStraight"
      },
      "compressedGeometry": "+1lmd-6dda6+1vcv5+f+c"
    },
    {
      "attributes: {
        "length": 0.1085833094564,
        "time": 0.260563671374356,
        "text": "Turn right on Howard St",
        "ETA": 1228724380080,
        "maneuverType": "esriDMTTurnRight"
      },
      "compressedGeometry": "+1lmd-6dd1i+1vcv0-o-j-1l-1a"
    },
    {
      "attributes: {
        "length": 0,
        "time": 0,
        "text": "Finish at Location 2, on the left",
        "ETA": 1229125881280,
        "maneuverType": "esriDMTStop"
      },
      "compressedGeometry": "+1lmd-6dd3v+1vct3+0+0"
    }
  ]
}
],
"routes": {
  "spatialReference" : {"wkid" : 4326},
  "features": [
  {
    "attributes": {
      "ObjectID": 1,
      "Name": "Location 1 - Location 2",
      "FirstStopID": 1,
      "LastStopID": 2,
      "StopCount": 2,
      "Total_Minutes": 12.6930240139726,
      "Total_Meters": 16446.0849108173,
      "Shape_Length": 0.171641389705288
    },
    "geometry": {
      "paths": [[
        [-122.407735892572, 37.7833496425899],
        [-122.407456001947, 37.7835679980589],
        [-122.407200001947, 37.7833439980587],
        [-122.407024001946, 37.7831999980585]
      ]]
    }
  }
  ]
},
"stops": {
  "spatialReference" : {"wkid" : 4326},
  "features": [
  {
    "attributes": {
      "ObjectID": 1,
        "Name": "Location 1",
        "Sequence": 1,
        "TimeWindowStart": null,
        "TimeWindowEnd": null,
        "ArriveCurbApproach": 1,
        "DepartCurbApproach": 2
    },
    "geometry": { "x": -122.4079, "y": 37.7835 }
    }
  },
  {
    "attributes": {
      "ObjectID": 2,
        "Name": "Location 2",
        "Sequence": 2,
        "TimeWindowStart": null,
        "TimeWindowEnd": null,
        "ArriveCurbApproach": 1,
        "DepartCurbApproach": 2
    },
    "geometry": { "x": -122.3931, "y": 37.79496 }
    }
  }
  ]
},
"barriers": {
  "spatialReference" : {"wkid" : 4326},
  "features": [
  {
    "attributes": {
      "ObjectID": 1,
      "Name": "Barrier 1",
      "SourceID": 1,
      "SourceOID": 9619,
      "PosAlong": 0.841037735851507,
      "SideOfEdge": 2,
      "CurbApproach": null,
      "Status": 0
    },
    "geometry": { "x": -122.41, "y": 37.7889 }
    }
  }
  ]
},
"messages": [
  {
    "type": 50,
    "description": "Location \"Location 3\" in \"Stops\" is unlocated."
  },
  {
    "type": 50,
    "description": "Location \"Location 4\" in \"Stops\" is unlocated."
  }
]
}