Description
Class added v2.0.dojo.require("esri.tasks.closestfacility");Helps you find closest facilities around any location (incident) on a network.
When finding closest facilities, you can specify how many to find and whether the direction of travel is toward or away from them. Once you've found the closest facilities, you can display the best route to or from them, return the travel cost for each route, and display directions to each facility.
You can also specify a cutoff cost beyond which ArcGIS Network Analyst should not search for a facility. For instance, you can set up a closest facility problem to search for hospitals within a 15-minute drive time of the site of an accident. Any hospitals that take longer than 15 minutes to reach will not be included in the results.
Note: ClosestFacilityTask, 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.
See also
Closest Facility ArcGIS Desktop Help.
Samples
Search for
samples that use this class.
Class hierarchy
esri.tasks.ClosestFacilityTask
Constructor
Methods
Events
Constructor Detail
esri.tasks.ClosestFacilityTask()
Creates a new ClosestFacilityTask object.
Options:
|
<String>
url |
URL to the ArcGIS Server REST resource that represents a network analysis service. Use the Service Directory to obtain the URL.
|
Code snippets:
closestFacilityTask = new esri.tasks.ClosestFacilityTask("http://174.129.22.43/ArcGIS/rest/services/Network/USA/NAServer/Closest Facility");
Methods Detail
solve(params, callback?, errback?)
Solve the closest facility. (As of v2.0)
Input Parameters:
|
<ClosestFacilityParameters> params |
Required |
The ClosestFacilityParameters 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. |
Code snippets:
closestFacilityTask.solve(params,function(solveResult){
//do something with the solve results here
});
Events Detail
onSolveComplete(closestFacilitySolveResult)
Fired when the ClosestFacilityTask solve is complete.
Arguments: