ClosestFacilitySolveResult

Class: esri/tasks/support/ClosestFacilitySolveResult
Inheritance: ClosestFacilitySolveResult Accessor
Since: ArcGIS API for JavaScript 4.0

The result from ClosestFacilityTask.

ClosestFacilitySolveResult, and other closest facility related classes require a "closest facility" layer. A closest facility layer is a layer of type esriNAServerClosestFacilityLayer.

See also:

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummary
String

The name of the class.

more details
more details
DirectionsFeatureSet

An array of directions.

more details
more details
Point[]

An array of points representing facilities.

more details
more details
Point[]

An array of points representing incidents.

more details
more details
NAMessage[]

Message received when the solve is complete.

more details
more details
Point[]

The point barriers are an array of points.

more details
more details
Polygon[]

The polygon barriers are an array of polygons.

more details
more details
Polyline[]

The polyline barriers are an array of polylines.

more details
more details
Graphic[]

The array of routes.

more details
more details

Property Details

declaredClassStringreadonly

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

An array of directions. A direction is an instance of DirectionsFeatureSet. Route directions are returned if returnDirections = true (default is false).

facilitiesPoint[]

An array of points representing facilities. Only returned when ClosestFacilityParameters.returnFacilities = true.

incidentsPoint[]

An array of points representing incidents. Only returned when ClosestFacilityParameters.returnIncidents = true.

messagesNAMessage[]

Message received when the solve is complete. If a closest facility cannot be solved, the message returned by the server identifies the incident that could not be solved.

pointBarriersPoint[]

The point barriers are an array of points. They are returned only if ClosestFacilityParameters.returnPointBarriers was set to true (which is not the default). If you send in the point barriers as a FeatureSet (instead of using DataLayer), you already have the barriers and might not need to request them back from the server.

polygonBarriersPolygon[]

The polygon barriers are an array of polygons. They are returned only if ClosestFacilityParameters.returnPolygonBarriers was set to true (which is not the default). If you send in the polygon barriers as a FeatureSet (instead of using DataLayer), you already have the barriers and might not need to request them back from the server.

polylineBarriersPolyline[]

The polyline barriers are an array of polylines. They are returned only if ClosestFacilityParameters.returnPolylineBarriers was set to true (which is not the default). If you send in the polyline barriers as a FeatureSet (instead of using DataLayer), you already have the barriers and might not need to request them back from the server.

routesGraphic[]

The array of routes. Route graphics are returned if returnRoutes = true and outputLines does not equal esriNAOutputLineNone. From version 2.0 to 2.5 the type is an array of Polylines. At version 2.6 the type is an array of Graphics.

Example:
require([
  "esri/layers/GraphicsLayer", "esri/tasks/ClosestFacilityTask", "dojo/_base/array", ...
], function(GraphicsLayer, ClosestFacilityTask, array, ... ) {
  var routeGraphicLayer = new GraphicsLayer( ... );
  var closestFacilityTask = new ClosestFacilityTask();
  closestFacilityTask.solve(params).then(function(solveResult){
    array.forEach(solveResult.routes, function(route, index){
      routeGraphicLayer.add(route);
    });
    ...
  });
});

Method Overview

NameReturn TypeSummary
*

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

more details
more details
Object

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

more details
more details

Method Details

fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. 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:
TypeDescription
*Returns a new instance of this class.

toJSON(){Object}

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

Returns:
TypeDescription
ObjectThe ArcGIS Portal JSON representation of an instance of this class.

API Reference search results

NameTypeModule

There were no match results from your search criteria.