FRAMES | NO FRAMES Description | New in 10.1 | Parameters | Examples | Response
Solve Closest Facility (Operation)
URL http://<nalayer-url>/solveClosestFacility
Parent Resource Network Layer

Note: The Solve Closest Facility operation was added at 10.

Description

The solve operation is performed on a network layer resource of type closest facility.

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

New in 10.1

M values:  OutputLines parameter supports a new value: esriNAOutputLineTrueShapeWithMeasure. If specified, returned routes, compressed geometry, service area lines will contain M values on each vertex.

Z values:  Closest Facility solver supports a new returnZ parameter. If returnZ=true and the Closest Facility solver is running against Z-aware network dataset, returned routes and compressed geometry will contain Z values on each vertex. Input point and line locations can have Z values on them.

routes, directions in the response include properties hasZ and/or hasM to indicate if the geometry includes z or m.

CompressedGeometry:  CompressedGeometry is capable of containing M- and Z- values. How to decompress Ms and Zs: Code Gallery sample code

An optional url property to specify input facilities, incidents, barriers, polylinebarriers or polygonbarriers. The url value contains a REST Query request to a Feature, Map or a GP service returning a JSON featureset. The advantage of using this format is that locations can be passed directly from a service endpoint as input to the NA operation, bypassing client as intermediate storage.

TimeOfDay, TimeOfDayUsage:  10.1 Closest Facility solver is time aware and can be used in conjunction with historic and real-time traffic information.

Parameters

Parameter Details
f Description: The response format. The default response format is html.

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

Syntax and Examples:

Simple syntax:

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

Syntax: facilities=x1,y1; x2, y2; ...; xn, yn
Example: facilities=-122.406, 37.7831; -122.405, 37.7827

JSON Structures:

Using JSON structures, you can specify 2 types of facilities:

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

Features

You can specify facility 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 traversible, 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 facility and it contains the following fields:

  • geometry: specifies the facility 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.406, "y" : 37.7831},
  "attributes" : {"Name" : "Hospital 1", "Attr_Drivetime" : 15.0}
},
{
  "geometry" : {"x" : -122.405, "y" : 37.7827},
  "attributes" : {"Name" : "Hospital 2", "Attr_Drivetime" : 10.0}
}
]
}

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/3/query?where=1%3D1&returnGeometry=true&outFields=*&f=json",
  "doNotLocateOnRestrictedElements" : true
}

Layer

You can specify facilities 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 facilities 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" : "Hospitals",
  "where" : "BEDS > 100"
}
incidents Description: The set of incidents loaded as network locations during analysis. Incidents can be specified using a simple comma / semi-colon based syntax or as a JSON structure. If incidents are not specified, preloaded incidents from the map document are used in the analysis. If an empty json object is passed ('{}') preloaded incidents are ignored.

Syntax and Examples:

Simple syntax:

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

Syntax: incidents=x1,y1; x2, y2; ...; xn, yn
Example: incidents=-122.406, 37.7831; -122.405, 37.7827

JSON Structures:

Using JSON structures, you can specify 2 types of incidents:

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

Features

You can specify incident 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 traversible, 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 incident and it contains the following fields:

  • geometry: specifies the incident 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:
 
{ 
"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.406, "y" : 37.7831},
  "attributes" : {"Name" : "Accident 1", "Cutoff_Drivetime" : 15.0}
},
{
  "geometry" : {"x" : -122.405, "y" : 37.7827},
  "attributes" : {"Name" : "Accident 2", "Cutoff_Drivetime" : 12.0}
}
]
}

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/4/query?where=1%3D1&returnGeometry=true&outFields=&f=json",
  "doNotLocateOnRestrictedElements" : true
}

Layer

You can specify incident 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 incidents 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"
}
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 2 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:
 
{ 
"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 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 2 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:
 
{ 
"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 2 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"
}
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 charactersitic is compared to a value coming from a descriptor attribute to determine whether or not a network element is traversible. 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 traversible 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
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
returnCFRoutes Description: If true, closest facilities 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
returnFacilities Description: If true, facilities will be returned with the analysis results. Default is false.

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

Values: true | false
returnIncidents Description: If true, incidents will be returned with the analysis results. Default is false.

The incidents are available in the incidents 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
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
defaultCutoff Description: The default cutoff value to stop traversing

Values: <double>
defaultTargetFacilityCount Description: The default number of facilities to find.

Values: <integer>
travelDirection Description: Options for traveling to or from the facility. The default is defined in the network layer.

Values: esriNATravelDirectionFromFacility | esriNATravelDirectionToFacility
outSR Description: The well-known ID of the spatial reference for the geometries returned with the analysis results. If outSR is not specified, the geometries are returned in the spatial reference of the map.
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
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
timeOfDay Description: Arrival or Departure date and time. For example, if travelDirection set to esriNATravelDirectionToFacility and timeOfDayUsage set to esriNATimeOfDayUseAsEndTime and timeOfDay is set to 8:00 AM, the route(s) built will arrive at the Facility at 8:00 in the morning, local time.

Values: specified by number of milliseconds since midnight Jan 1st, 1970, UTC.
timeOfDayUsage Description: Defines the way timeOfDay value is used. The default is as defined in the network layer.

Values: esriNATimeOfDayUseAsStartTime | esriNATimeOfDayUseAsEndTime
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/Closest%20Facility/solveClosestFacility?incidents=%7B+%0D%0A%22features%22++%3A+%5B%0D%0A%7B%0D%0A++%22geometry%22+%3A+%7B%22x%22+%3A+-122.396%2C+%22y%22+%3A+37.6831%7D%2C%0D%0A++%22attributes%22+%3A+%7B%22Name%22+%3A+%22Accident+1%22%7D%0D%0A%7D%5D%0D%0A%7D&facilities=%7B+%0D%0A%22features%22++%3A+%5B%0D%0A%7B%0D%0A++%22geometry%22+%3A+%7B%22x%22+%3A+-122.406%2C+%22y%22+%3A+37.7831%7D%2C%0D%0A++%22attributes%22+%3A+%7B%22Name%22+%3A+%22Hospital+1%22%7D%0D%0A%7D%2C%0D%0A%7B%0D%0A++%22geometry%22+%3A+%7B%22x%22+%3A+-122.405%2C+%22y%22+%3A+37.7827%7D%2C%0D%0A++%22attributes%22+%3A+%7B%22Name%22+%3A+%22Hospital+2%22%7D%0D%0A%7D%0D%0A%5D%0D%0A%7D&barriers=&polylineBarriers=&polygonBarriers=&travelDirection=esriNATravelDirectionToFacility&defaultCutoff=15&defaultTargetFacilityCount=1&outSR=4326&accumulateAttributeNames=&impedanceAttributeName=Time&restrictionAttributeNames=OneWay%2CTurnRestriction%2CAvoid+passenger+ferries%2CNon-routeable+segments&attributeParameterValues=&restrictUTurns=esriNFSBAllowBacktrack&useHierarchy=true&returnDirections=true&returnCFRoutes=true&returnFacilities=false&returnIncidents=false&returnBarriers=false&returnPolylineBarriers=false&returnPolygonBarriers=false&directionsLanguage=&directionsStyleName=NA+Desktop&outputLines=esriNAOutputLineTrueShape&outputGeometryPrecision=&outputGeometryPrecisionUnits=esriUnknownUnits&directionsTimeAttributeName=Time&directionsLengthUnits=esriNAUMiles&f=html

JSON Response Syntax

 
{
  "routes"            : { 
                          "spatialReference" : { <spatialReference> },
						  "hasZ": <true|false>,
						  "hasM": <true|false>,
                          "features" : [ <array of <polyline> features> ] 
                        },
  "facilities"        : { 
                          "spatialReference" : { <spatialReference> },
						  "hasZ": <true|false>,
                          "features" : [ <array of <point> features> ] 
                        },
  "incidents"         : {
                          "spatialReference" : { <spatialReference> },
						  "hasZ": <true|false>,
                          "features" : [ <array of <point> features> ] 
                        },
  "barriers"          : { 
                          "spatialReference" : { <spatialReference> },
						  "hasZ": <true|false>,
                          "features" : [ <array of <point> features> ] 
                        },
  "polylineBarriers"  : {
                          "spatialReference" : { <spatialReference> },
						  "hasZ": <true|false>,
                          "features" : [ <array of <polyline> features> ] 
                        },
  "polygonBarriers"   : {
                          "spatialReference" : { <spatialReference> },
                          "features" : [ <array of <polygon> features> ] 
                        },
  "directions"        : [ {<route1>}, {<route2>},... ],
  "messages"          : [ {<message1>}, {<message2>},... ]
}

where each features object is defined as:

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

each route object in the directions property are defined as:
  
{
  "routeId": <routeId>,
  "routeName": "<routeName>",
  "summary": {
    "totalLength": <totalLength>,
    "totalTime": <totalTime>,
    "totalDriveTime": <totalDriveTime>,
    "envelope": {<envelope>}
  },
  "hasZ": <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>"
    }
  ]
}

and each message is defined as:

{ "type" : <type1>, "description" : <description1> }

JSON Response Example

 
{
  "routes" : {"spatialReference" : {
      "wkid" : 4326
    }, 
    
    "features" : [
      {
        "attributes" : {
          "ObjectID" : 1, 
          "FacilityID" : 2, 
          "FacilityRank" : 1, 
          "Name" : "Accident 1 - Hospital 2", 
          "IncidentCurbApproach" : 1, 
          "FacilityCurbApproach" : 1, 
          "IncidentID" : 1, 
          "Total_Time" : 10.681003218051, 
          "Shape_Length" : 0.123693665336013
        }
        , 
        "geometry" : 
        {
          "paths" : 
          [
            [
              [-122.395844761, 37.6832247680001], 
              [-122.395337, 37.6825930000001], 
              [-122.395127, 37.6822990000001], 
              [-122.395078, 37.6822100000001], 
              [-122.394961, 37.6820240000001], 
              [-122.394864, 37.681839], 
              [-122.394719, 37.681497], 
              [-122.39465, 37.681275], 
              [-122.394578, 37.681046], 
              [-122.3945, 37.681068], 
              [-122.39443, 37.6810760000001], 
              [-122.394464, 37.6812190000001], 
              [-122.40428, 37.780963], 
              [-122.404422, 37.781073], 
              [-122.404422001, 37.781073001], 
              [-122.404946, 37.7814910000001], 
              [-122.405487, 37.78193], 
              [-122.405962, 37.7823090000001], 
              [-122.405179949, 37.7829275240001]
            ]
          ]
        }
      }
    ]
  }, 
  "directions" : [
    {
      "routeId" : 1, 
      "routeName" : "Accident 1 - Hospital 2", 
      "summary" : {
        "totalLength" : 8.08519598918001, 
        "totalTime" : 10.6666666666667, 
        "totalDriveTime" : 10.681003218051, 
        "envelope" : {
          "xmin" : -122.408392, 
          "ymin" : 37.681046, 
          "xmax" : -122.39443, 
          "ymax" : 37.7829275239333, 
          "spatialReference" : {
            "wkid" : 4326
          }
        }
      }, 
      "features" : [
        {
          "attributes" : {
            "length" : 0, 
            "time" : 0, 
            "text" : "Start at Accident 1", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTDepart"
          }, 
          "compressedGeometry" : "+1m91-6fjtc+1vtgu+0+0"
        }, 
        {
          "attributes" : {
            "length" : 0.150853254241241, 
            "time" : 0.259400404989719, 
            "text" : "Go southeast on Bayshore Blvd", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTStraight"
          }, 
          "compressedGeometry" : "+1m91-6fjtc+1vtgu+18-1j+e-q+c-v"
        }, 
        {
          "attributes" : {
            "length" : 2.1656530667998, 
            "time" : 3.72155529726297, 
            "text" : "Make U-turn and go back on Bayshore Blvd", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTUTurn"
          }, 
          "compressedGeometry" : "+1m91-6fjra+1vtdi+4-d+9+2-b+v-g+t-h+p-t+15-10+14-10+v-1k+1c-4q+3l-29+1q-10+11-12+1b-f+o-n+18-1a+2j-6b+ct-8+o-3+l+0+14+3+u+9+l+1m+35+10+23+a+r+1v+4e"
        }, 
        {
          "attributes" : {
            "length" : 0.598385652527213, 
            "time" : 1.02499999850988, 
            "text" : "Continue on Bay Shore Blvd", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTStraight"
          }, 
          "compressedGeometry" : "+1m91-6fkdq+1vusg+h+t+f+15+c+n+1b+1n+l+10+8+9+b+b+g+a+e+6+1u+h+o+e+12+11+1i+1l+g+p+7+h"
        }, 
        {
          "attributes" : {
            "length" : 0.115576051175594, 
            "time" : 0.196666669100523, 
            "text" : "At fork keep left on Bay Shore Blvd", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTForkLeft"
          }, 
          "compressedGeometry" : "+1m91-6fk2s+1vv83+b+12+8+h+5+e+3+c+0+d"
        }, 
        {
          "attributes" : {
            "length" : 3.56891432413399, 
            "time" : 3.38341818004847, 
            "text" : "Take ramp on the left and go on US Hwy 101 N toward Civic Center/Bay Bridge", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTRampLeft"
          }, 
          "compressedGeometry" : "+1m91-6fk21+1vvat-p+2b-9+13-l+18-g+1n-k+1q-20+51-h+1j-2b+63-9+i-1d+2c-2a+4c-3f+5q-f+t-8+n-9+u-7+12-3+18+3+18+8+18+7+n+9+o+l+17+k+r+23+2i+j+t+d+s+b+u+32+9o+6+k+4+r+3+13-1+10-d+4e-5+q-6+l-f+q-k+o-j+g-1j+16-g+d-f+h-d+h-7+d-7+i-4+h-1+f+1+g+7+t+g+10+10+1j+8+l+7+j+4+n+3+n+2+1k"
        }, 
        {
          "attributes" : {
            "length" : 0.557037940125038, 
            "time" : 0.514848945662379, 
            "text" : "Go toward Seventh St", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTStraight"
          }, 
          "compressedGeometry" : "+1m91-6fkd1+201vc+1+p-1+p-l+6h-4+e-8+l-17+1q-b+l-6+g-5+j+0+s"
        }, 
        {
          "attributes" : {
            "length" : 0.139812714384474, 
            "time" : 0.193322874605656, 
            "text" : "Take ramp on the right to 7th St toward US Hwy 101", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTRampRight"
          }, 
          "compressedGeometry" : "+1m91-6fkfv+202d0+4+b+j+v+8+8+n+h+6+8+2+5+1+b-1+4-3+4"
        }, 
        {
          "attributes" : {
            "length" : 0.184959217304317, 
            "time" : 0.312160110566765, 
            "text" : "Continue on 7th St", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTStraight"
          }, 
          "compressedGeometry" : "+1m91-6fke4+202g3-44+39"
        }, 
        {
          "attributes" : {
            "length" : 0.344728539097515, 
            "time" : 0.589068286120892, 
            "text" : "Turn right on Folsom St", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTTurnRight"
          }, 
          "compressedGeometry" : "+1m91-6fki8+202jc+7o+64"
        }, 
        {
          "attributes" : {
            "length" : 0.198729099388571, 
            "time" : 0.340110473334789, 
            "text" : "Turn left on 5th St", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTTurnLeft"
          }, 
          "compressedGeometry" : "+1m91-6fkag+202pg-4e+3i"
        }, 
        {
          "attributes" : {
            "length" : 0.0605461300022504, 
            "time" : 0.145451977849007, 
            "text" : "Turn right on Minna St", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTTurnRight"
          }, 
          "compressedGeometry" : "+1m91-6fkeu+202t2+1b+12"
        }, 
        {
          "attributes" : {
            "length" : 0, 
            "time" : 0, 
            "text" : "Finish at Hospital 2", 
            "ETA" : -2209161600000, 
            "maneuverType" : "esriDMTStop"
          }, 
          "compressedGeometry" : "+1m91-6fkdj+202u4+0+0"
        }
      ]
    }
  ], 
  "messages" : [
  ]
}