Hide Table of Contents
Class: ServiceAreaTask

require(["esri/tasks/ServiceAreaTask"], function(ServiceAreaTask) { /* code goes here */ });


(Added at v2.0)
Helps you find service areas around any location on a network. A network service area is a region that encompasses all accessible streets that is, streets that are within a specified impedance. For instance, the 5-minute service area for a point includes all the streets that can be reached within five minutes from that point.

Note: ServiceAreaTask, and other service area related classes, requires ArcGIS Server 10.0 or above and a service area layer. A service area layer is a layer of type esriNAServerServiceAreaLayer.

See also
Service area analysis ArcGIS Desktop help topic.


Search for samples that use this class.


new ServiceAreaTask(url)Creates a new ServiceAreaTask object.


NameReturn typeSummary
getServiceDescription()ObjectReturns an object describing a Service Area service endpoint (URL of the endpoint is specified in the constructor).
solve(params, callback?, errback?)DeferredSolve the service area.


[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.


NameEvent ObjectSummary
  result: <ServiceAreaSolveResult>
Fires when ServiceAreaTask has completed.
Constructor Details

new ServiceAreaTask(url)

Creates a new ServiceAreaTask object.
<String> url Required URL to the ArcGIS Server REST resource that represents a network analysis service. Use the Service Directory to obtain the URL.
  "esri/tasks/ServiceAreaTask", ... 
], function(ServiceAreaTask, ... ) {
   var serviceAreaTask = new ServiceAreaTask("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/ServiceArea");
Method Details


Returns an object describing a Service Area service endpoint (URL of the endpoint is specified in the constructor). The description contains information about the default solver settings, underlying network dataset, available cost and restriction attributes, supported travel modes, etc. If the targeted Network Analyst Server is federated with a Portal or ArcGIS Online, the returned supportedTravelModes array will include user-specific travel modes. If the Network Analyst Server works in a standalone configuration, the supportedTravelModes will come from the original Closest Facility service description.
A few properties returned in this object include: attributeParameterValues, impedance, restrictUTurns, restrictions, supportedTravelModes, travelDirection, and useHierarchy.
(Added at v3.14)
Return type: Object

solve(params, callback?, errback?)

Solve the service area.
Return type: Deferred
<ServiceAreaParameters> params Required The ServiceAreaParameters object.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onSolveComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution.
  var result = serviceAreaSolveResult;
  //do something with the results here
Event Details
[ On Style Events | Connect Style Event ]


Fires when ServiceAreaTask has completed. Should be used in favor of onSolveComplete. (Added at v3.5)
Event Object Properties:
<ServiceAreaSolveResult> result The results from the ServiceAreaTask solve operation.
Show Modal