ServiceAreaParameters

AMD: require(["esri/rest/support/ServiceAreaParameters"], (ServiceAreaParameters) => { /* code goes here */ });
ESM: import ServiceAreaParameters from "@arcgis/core/rest/support/ServiceAreaParameters";
Class: esri/rest/support/ServiceAreaParameters
Inheritance: ServiceAreaParameters Accessor
Since: ArcGIS API for JavaScript 4.20

ServiceAreaParameters provides the input parameters for a serviceArea request.

See also

Constructors

new ServiceAreaParameters(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
String[]

Use this property to specify whether the operation should accumulate values other than the value specified for impedanceAttribute.

more details
ServiceAreaParameters
String

An authorization string used to access a resource or service.

more details
ServiceAreaParameters
AttributeParameterValue[]

Use this property 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.

more details
ServiceAreaParameters
String

The name of the class.

more details
Accessor
Number[]

Use this parameter to specify the size and number of service areas to generate for each facility.

more details
ServiceAreaParameters
String[]

An array of network source names to not use when generating polygons.

more details
ServiceAreaParameters
DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl

The input locations around which service areas are generated.

more details
ServiceAreaParameters
Number

Use this property to specify the number of decimal places in the response geometries returned by solve operation.

more details
ServiceAreaParameters
Number

Use this property to specify the number of decimal places in the response geometries returned by solve operation.

more details
ServiceAreaParameters
Number

Use this property to specify the number of decimal places in the response geometries returned by a solve operation.

more details
ServiceAreaParameters
Boolean

Specify whether invalid input locations should be ignored when finding the best solution.

more details
ServiceAreaParameters
String

Specifies the impedance.

more details
ServiceAreaParameters
Boolean

Use this parameter to specify whether the service areas from different facilities that have the same break value should be joined together or split at break values.

more details
ServiceAreaParameters
Number

Use this property to specify by how much you want to simplify the route geometry returned by the operation.

more details
ServiceAreaParameters
String

Use this property to specify the units for the value specified for the outputGeometryPrecision parameter.

more details
ServiceAreaParameters
String

Use this property to specify the type of route features that are output by the operation.

more details
ServiceAreaParameters
String

This parameter sets whether service area polygons should be returned and to what detail.

more details
ServiceAreaParameters
SpatialReference

Use this property to specify the spatial reference of the geometries, such as line or point features, returned by a solve operation.

more details
ServiceAreaParameters
Boolean

Specifies whether the service area lines from different facilities can overlap each other.

more details
ServiceAreaParameters
Boolean

Specifies whether the service areas from different facilities can overlap each other.

more details
ServiceAreaParameters
Object

Specify additional settings that can influence the behavior of the solver when finding solutions for the network analysis problems.

more details
ServiceAreaParameters
Collection<PointBarrier>|DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl

Use this property 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.

more details
ServiceAreaParameters
Collection<PolygonBarrier>|DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl

Use this property 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.

more details
ServiceAreaParameters
Collection<PolylineBarrier>|DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl

Use this property to specify one or more lines that prohibit travel anywhere the lines intersect the streets.

more details
ServiceAreaParameters
Boolean

Use this property to specify if the Object IDs specified for input locations such as stops or barriers should be preserved when the input locations are returned as output.

more details
ServiceAreaParameters
String[]

Use this property to specify which restrictions should be honored by the operation.

more details
ServiceAreaParameters
String

Specifies how U-Turns should be handled.

more details
ServiceAreaParameters
Boolean

Determines if facilities will be returned by the service.

more details
ServiceAreaParameters
Boolean

Specify whether point barriers will be returned by the routing operation.

more details
ServiceAreaParameters
Boolean

Specify whether polygon barriers will be returned by the routing operation.

more details
ServiceAreaParameters
Boolean

Specify whether polyline barriers will be returned by the routing operation.

more details
ServiceAreaParameters
Boolean

Specifies whether the service area lines should be split at break values.

more details
ServiceAreaParameters
Boolean

Specifies whether multiple service areas around a facility are created as disks or rings.

more details
ServiceAreaParameters
Date|String

Specify the time and date to depart from or arrive at incidents or facilities.

more details
ServiceAreaParameters
Boolean

Specify the time zone or zones of the timeOfDay property.

more details
ServiceAreaParameters
String

Specifies whether the direction of travel used to generate the service area polygons is toward or away from the facilities.

more details
ServiceAreaParameters
TravelMode

A travel mode represents a means of transportation, such as driving or walking.

more details
ServiceAreaParameters
Boolean

Specifies whether the service areas are trimmed.

more details
ServiceAreaParameters
Number

The property defines the distance that can be reached from the network.

more details
ServiceAreaParameters
String

Specifies the units of the value specified trimPolygonDistance.

more details
ServiceAreaParameters
Boolean

Specify whether hierarchy should be used when finding the shortest paths.

more details
ServiceAreaParameters

Property Details

accumulateAttributes String[]

Use this property to specify whether the operation should accumulate values other than the value specified for impedanceAttribute. For example, if your impedanceAttribute is set to travel-time, the total travel time for the route will be calculated by the operation. However, if you also want to calculate the total distance of the route in miles, you can specify Miles as the value for the accumulateAttributes property.

Possible Values:"kilometers"|"miles"|"minutes"|"travel-time"|"truck-minutes"|"truck-travel-time"|"walk-time"|"string"

See also
apiKey String
Since: ArcGIS API for JavaScript 4.21

An authorization string used to access a resource or service. API keys are generated and managed in the ArcGIS Developer dashboard. An API key is tied explicitly to an ArcGIS account; it is also used to monitor service usage. Setting a fine-grained API key on a specific class overrides the global API key.

See also
Example
// Compute the service area for a 2km walking distance.
const url = "https://route-api.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World";
const apiKey = "abcdefghijklmnopqrstuvwxyz";
const spatialReference = SpatialReference.WebMercator;

const start = new Graphic({
  geometry: {
    type: "point",
    x: -13039204.060165292,
    y: 4031816.239573444,
    spatialReference
  },
  symbol: {
    type: "simple-marker",
    color: "white",
    size: 8
  }
});

const networkDescription = await fetchServiceDescription(url, apiKey);
const travelMode = networkDescription.supportedTravelModes.find(
  (travelMode) => travelMode.name === "Walking Distance"
);

const serviceAreaParameters = new ServiceAreaParameters({
  apiKey,
  facilities: new FeatureSet({
    features: [start]
  }),
  defaultBreaks: [2.5],
  travelMode,
  travelDirection: "to-facility",
  outSpatialReference: spatialReference,
  trimOuterPolygon: true
});

const results = await solve(url, serviceAreaParameters);
attributeParameterValues AttributeParameterValue[]

Use this property 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 property. For example, you can choose to never use toll roads, avoid them as much as possible, or prefer them.

See also
declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

defaultBreaks Number[]

Use this parameter to specify the size and number of service areas to generate for each facility. The service generates travel time- or travel distance-based service areas depending on the units for this parameter. If units are time based, the service areas are generated based on travel time along underlying streets. If units are distance based, the service areas are generated based on travel distances.

The unit for this parameter is based on the unit of the impedance attribute specified using impedanceAttributeName parameter or the impedanceAttributeName of the travel mode if travel mode is specified. If the impedanceAttributeName parameter is travel-time, the values specified as the defaultBreaks parameter are interpreted to be in minutes, and the service generates time-based service areas. Otherwise, the values are interpreted to be in miles or kilometers based on whether the impedanceAttributeName is set to miles or kilometers, respectively, and the service generates distance-based service areas.

See also
excludeSourcesFromPolygons String[]

An array of network source names to not use when generating polygons.

This property specifies if certain network sources should be excluded from the service area polygon generation. A service area on a multi-modal network where only one mode is being used to compute the service area would get a more appropriate shape if other modes are excluded from the polygons.

The input locations around which service areas are generated.

See also
geometryPrecision Number
Since: ArcGIS API for JavaScript 4.25

Use this property to specify the number of decimal places in the response geometries returned by solve operation. This applies to x- and y-values only (not m- or z-values).

See also
geometryPrecisionM Number
Since: ArcGIS API for JavaScript 4.25

Use this property to specify the number of decimal places in the response geometries returned by solve operation. This applies to m-value only (not x-,y- or z-values).

See also
geometryPrecisionZ Number
Since: ArcGIS API for JavaScript 4.25

Use this property to specify the number of decimal places in the response geometries returned by a solve operation. This applies to z-value only (not x-,y- or m-values).

See also
ignoreInvalidLocations Boolean
Since: ArcGIS API for JavaScript 4.25

Specify whether invalid input locations should be ignored when finding the best solution. An input point is deemed invalid by the operation if it is not within the maximum snap tolerance of any traversable street. When true invalid points are ignored. When false any invalid point in your request will cause the operation to return a failure.

See also
impedanceAttribute String

Specifies 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. This property will be ignored if travelMode is set.

Possible Values:"kilometers"|"miles"|"minutes"|"travel-time"|"truck-minutes"|"truck-travel-time"|"walk-time"

See also
mergeSimilarPolygonRanges Boolean

Use this parameter to specify whether the service areas from different facilities that have the same break value should be joined together or split at break values.

If true, service area polygons from multiple facilities with the same break value will be merged together, resulting in a single polygon feature per break value.

if false, service area polygons from multiple facilities with the same break values will remain separate polygon features.

Default Value:false
See also
outputGeometryPrecision Number

Use this property to specify by how much you want to simplify the route geometry returned by the operation. 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 value of this property, regardless of whether you rely on the default or explicitly set a value, is overridden when you pass in travelMode.

The units are specified with the outputGeometryPrecisionUnits parameter.

See also
outputGeometryPrecisionUnits String

Use this property to specify the units for the value specified for the outputGeometryPrecision parameter. The value of this parameter, regardless of whether you rely on the default or explicitly set a value, is overridden when you pass in travelMode.

Possible Values:"centimeters"|"decimal-degrees"|"decimeters"|"feet"|"inches"|"kilometers"|"meters"|"miles"|"millimeters"|"nautical-miles"|"points"|"yards"

See also
outputLines String

Use this property to specify the type of route features that are output by the operation. This parameter is applicable only if the returnRoutes parameter is set to true.

Possible Value Description
none Do not return any shapes for the routes.
straight Return a straight line between the stops.
true-shape Return the exact shape of the resulting route that is based on the underlying streets.
true-shape-with-measure Return the exact shape of the resulting route that is based on the underlying streets and include route measurements that keep track of the cumulative travel time or travel distance along the route relative to the first stop.

Possible Values:"none"|"straight"|"true-shape"|"true-shape-with-measure"

See also
outputPolygons String

This parameter sets whether service area polygons should be returned and to what detail.

Possible Value Description
none Do not generate service areas. This is useful in cases in which you don't want to generate areas around facilities, but instead, just want to generate service area lines.
detailed Create detailed service areas.
simplified Create generalized service areas.

Possible Values:"none"|"simplified"|"detailed"

See also
outSpatialReference SpatialReference

Use this property to specify the spatial reference of the geometries, such as line or point features, returned by a solve operation.

See also
overlapLines Boolean

Specifies whether the service area lines from different facilities can overlap each other.

If true, services area lines can overlap one another. If false, service area lines from one facility cannot overlap those from another facility.

Default Value:false
See also
overlapPolygons Boolean

Specifies whether the service areas from different facilities can overlap each other.

If true, services areas can overlap one another. If false, service areas from one facility cannot overlap those from another facility.

Default Value:false
See also
overrides Object
Since: ArcGIS API for JavaScript 4.25

Specify additional settings that can influence the behavior of the solver when finding solutions for the network analysis problems.

See also

Use this property 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.

See also

Use this property 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.

See also

Use this property 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.

See also
preserveObjectID Boolean
Since: ArcGIS API for JavaScript 4.25

Use this property to specify if the Object IDs specified for input locations such as stops or barriers should be preserved when the input locations are returned as output.

See also
restrictionAttributes String[]

Use this property to specify which restrictions should be honored by the operation. A restriction represents a driving preference or requirement. This value is ignored if travelMode is specified.

Possible Values:"any-hazmat-prohibited"|"avoid-carpool-roads"|"avoid-express-lanes"|"avoid-ferries"|"avoid-gates"|"avoid-limited-access-roads"|"avoid-private-roads"|"avoid-roads-unsuitable-for-pedestrians"|"avoid-stairways"|"avoid-toll-roads"|"avoid-toll-roads-for-trucks"|"avoid-truck-restricted-roads"|"avoid-unpaved-roads"|"axle-count-restriction"|"driving-a-bus"|"driving-a-taxi"|"driving-a-truck"|"driving-an-automobile"|"driving-an-emergency-vehicle"|"height-restriction"|"kingpin-to-rear-axle-length-restriction"|"length-restriction"|"preferred-for-pedestrians"|"riding-a-motorcycle"|"roads-under-construction-prohibited"|"semi-or-tractor-with-one-or-more-trailers-prohibited"|"single-axle-vehicles-prohibited"|"tandem-axle-vehicles-prohibited"|"through-traffic-prohibited"|"truck-with-trailers-restriction"|"use-preferred-hazmat-routes"|"use-preferred-truck-routes"|"walking"|"weight-restriction"|"string"

See also
restrictUTurns String

Specifies how U-Turns should be handled.

Possible Value Description
allow-backtrack U-turns are permitted everywhere. Allowing U-turns implies that the vehicle can turn around at a junction and double back on the same street.
at-dead-ends-only U-turns are prohibited at all junctions and intersections and are permitted only at dead ends.
no-backtrack U-turns are prohibited at all junctions, intersections, and dead-ends.
at-dead-ends-and-intersections U-turns are prohibited at junctions where exactly two adjacent streets meet.

Possible Values:"allow-backtrack"|"at-dead-ends-only"|"no-backtrack"|"at-dead-ends-and-intersections"

See also
returnFacilities Boolean

Determines if facilities will be returned by the service.

Default Value:false
See also
returnPointBarriers Boolean

Specify whether point barriers will be returned by the routing operation.

Default Value:false
See also
returnPolygonBarriers Boolean

Specify whether polygon barriers will be returned by the routing operation.

Default Value:false
See also
returnPolylineBarriers Boolean

Specify whether polyline barriers will be returned by the routing operation.

Default Value:false
See also
splitLinesAtBreaks Boolean

Specifies whether the service area lines should be split at break values.

If true, a service area line that intersects a break is split into two lines. This is useful if you want to visualize service area lines by break value.

Default Value:false
See also
splitPolygonsAtBreaks Boolean

Specifies whether multiple service areas around a facility are created as disks or rings.

If true, larger service areas do not include smaller service areas. If false, service areas are independant and may overlap each other.

Default Value:false
See also
timeOfDay Date|String

Specify the time and date to depart from or arrive at incidents or facilities. You can also specify a value of "now", to set the depart or arrive time to current time.

For ServiceAreaParameters the timeOfDay is always "now".

See also
timeOfDayIsUTC Boolean
Since: ArcGIS API for JavaScript 4.25

Specify the time zone or zones of the timeOfDay property.

See also
travelDirection String

Specifies whether the direction of travel used to generate the service area polygons is toward or away from the facilities. The direction of travel may change the shape of the polygons because impedances on opposite sides of streets may differ or one-way restrictions may exist, such as one-way streets.

Possible Value Description
from-facility The service area is generated in the direction away from the facilities.
to-facility The service area is created in the direction toward the facilities.

Possible Values:"from-facility"|"to-facility"

See also
travelMode TravelMode

A travel mode represents a means of transportation, such as driving or walking. Travel modes define the physical characteristics of a vehicle or pedestrian.

Use networkService.fetchServiceDescription to obtain a list of predefined travel modes and the default travel mode that is used if one is not specified in a routing reqest.

See also
trimOuterPolygon Boolean

Specifies whether the service areas are trimmed.

If true, service areas will be trimmed. This is useful when finding service areas in places that have a very sparse street network and you don't want the service area to cover large areas where there are no street features.

The parameter value is ignored when the useHierarchy parameter is set to true.

Default Value:false
See also
trimPolygonDistance Number

The property defines the distance that can be reached from the network.

This property is ignored if trimOuterPolygon is false or useHierarchy is true.

See also
trimPolygonDistanceUnits String

Specifies the units of the value specified trimPolygonDistance.

This property is ignored if trimOuterPolygon is false or useHierarchy is true.

Possible Values:"centimeters"|"decimal-degrees"|"decimeters"|"feet"|"inches"|"kilometers"|"meters"|"miles"|"millimeters"|"nautical-miles"|"points"|"yards"

See also
useHierarchy Boolean

Specify whether hierarchy should be used when finding the shortest paths. This value is ignored if a travelMode is specified.

See also

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

more details
Accessor
this

Creates a deep clone of this object.

more details
ServiceAreaParameters
*

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.

more details
ServiceAreaParameters
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
ServiceAreaParameters

Method Details

addHandles(handleOrHandles, groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

clone(){this}

Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.

Returns
Type Description
this A deep clone of the class instance that invoked this method.
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
Type Description
* Returns a new instance of this class.
hasHandles(groupKey){Boolean}inherited
Since: ArcGIS API for JavaScript 4.25

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
removeHandles(groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
Type Description
Object The ArcGIS portal JSON representation of an instance of this class.

Type Definitions

AttributeParameterValue

An object describing the parameter values for the attributeParameterValues property of ServiceAreaParameters.

Properties
attributeName String

The name of the restriction.

parameterName String

The name of the parameter associated with the restriction. A restriction can have one or more parameterName properties.

value String|Number

The value for parameterName.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.