Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: ClosestFacilitySolveResult

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

Description

(Added at v2.0)
The result from a ClosestFacilityTask operation.

Note: ClosestFacilitySolveResult, and other closest facility related classes, requires ArcGIS Server 10.0 or above and a closest facility layer. A closest facility layer is a layer of type esriNAServerClosestFacilityLayer.

Samples

Search for samples that use this class.

Properties

NameTypeSummary
directionsDirectionsFeatureSetAn array of directions.
facilitiesPoint[]An array of points, only returned when ClosestFacilityParameters.returnFacilities is true.
incidentsPoint[]An array of points, only returned when ClosestFacilityParameters.returnIncidents is true.
messagesNAMessage[]Message received when the solve is complete.
pointBarriersPoint[]The point barriers are an array of points.
polygonBarriersPolygon[]The polygon barriers are an array of polygons.
polylineBarriersPolyline[]The polyline barriers are an array of polylines.
routesGraphic[]The array of routes.
Property Details
An array of directions. A direction is an instance of esri.tasks.DirectionFeatureSest. Route directions are returned if returnDirections was set to true, the default is false.
Sample:

var directions = solveResult.directions;

<Point[]> facilities

An array of points, only returned when ClosestFacilityParameters.returnFacilities is true.

<Point[]> incidents

An array of points, only returned when ClosestFacilityParameters.returnIncidents is true.

<NAMessage[]> messages

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.

<Point[]> pointBarriers

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.

<Polygon[]> polygonBarriers

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.

<Polyline[]> polylineBarriers

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.

<Graphic[]> routes

The array of routes. Route graphics are returned if returnRoutes is 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.
Sample:
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, function(solveResult){
    array.forEach(solveResult.routes, function(route, index){
      routeGraphicLayer.add(route);
    });
  ...
});
Show Modal