AMD: require(["esri/rest/serviceArea"], (serviceArea) => { /* code goes here */ });
ESM: import * as serviceArea from "@arcgis/core/rest/serviceArea";
Object: esri/rest/serviceArea
Since: ArcGIS API for JavaScript 4.19

Helps you find service areas around any location on a network. A network service area is a region that encompasses all accessible streets (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.

Method Overview

Name Return Type Summary Object
Promise<ServiceAreaSolveResult>more details

Determines the service area based on a set of parameters.

more detailsserviceArea

Method Details

solve(url, params, requestOptions){Promise<ServiceAreaSolveResult>}

Determines the service area based on a set of parameters.

url String

URL to the ArcGIS Server REST resource that represents a network analysis service.

The parameters needed to define the service area.

requestOptions Object

Additional options to be used for the data request (will override requestOptions defined during construction).

Type Description
Promise<ServiceAreaSolveResult> When resolved, returns an instance of ServiceAreaSolveResult.
], function(esriConfig, Map, MapView, serviceArea, ServiceAreaParams, FeatureSet, Graphic, ...) {

  // API key from developer's account
  // authenticates for the basemap and the serviceArea request
  esriConfig.apiKey = "YOUR_API_KEY";

  const map = new Map({
    basemap: "arcgis-newspaper"

  const view = new MapView({
    container: "viewDiv",
    map: map,
    center: [-116.53818, 33.82586]
    zoom: 11

  const serviceAreaUrl = "";

  view.on("click", function(event){
    const locationGraphic = createGraphic(event.mapPoint);
    const serviceAreaParams = createServiceAreaParams(locationGraphic, view.spatialReference);
    solveServiceArea(serviceAreaUrl, serviceAreaParams);

  // Create the location graphic
  function createGraphic(point) {;
    const graphic = new Graphic({
      geometry: point,
      symbol: {
        type: "simple-marker",
        color: "white",
        size: 8
    return graphic;

  function createServiceAreaParams(locationGraphic, outSpatialReference) {
    // Create one or more locations (facilities) to solve for
    const featureSet = new FeatureSet({
      features: [locationGraphic]

    // Set all of the input parameters for the service
    const serviceAreaParameters = new ServiceAreaParams({
      facilities: featureSet,
      trimOuterPolygon: true,
      outSpatialReference: outSpatialReference
    return serviceAreaParameters;

  function solveServiceArea(url, serviceAreaParams) {
    return serviceArea.solve(url, serviceAreaParams)
        if (result.serviceAreaPolygons.length) {
          // Draw each service area polygon
            graphic.symbol = {
              type: "simple-fill",
              color: "rgba(62,13,94,.25)"
      }, function(error){

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