Closest facility (online)

Find the nearest facility to a location using Closest Facility Task. Task parameters are populated and passed to the task's solve or solveAsync method. Task parameters include the facility locations, any barriers present (there are none in this sample), and the spatial reference of the facilities and barriers. Click on the map to add facility and incident graphics. Click on Solve to run the task and route all incidents to the closest facilities shown on the map.