Working with network analysis on the server
Once you've published the map and enabled the network analysis capability, client applications can send network problems to the server and receive responses that can include routes, driving directions, or any other results produced by the ArcGIS Network Analyst extension solvers.
ArcGIS for Desktop users can consume network analysis services out-of-the-box using the Find Route tool, getting simple point-to-point routing without requiring a network license. ArcGIS developers have many platform choices that can work with network analysis services, such as the following:
- Silverlight, Flex, JavaScript, and application programming interfaces (APIs) for mobile devices
- ArcGIS Server Simple Object Access Protocol (SOAP)
- Representational State Transfer (REST) Web service APIs
The ArcGIS for Server Resource Center Web site has links to detailed help for each API. Each Help system contains sections about consuming network analysis services. However, the general pattern for working with a network analysis service is the same, regardless of the API. The steps are as follows:
- Get a reference to the network analysis service.
- Set up the solver parameters, including the type of analysis you want to perform and the network locations (for example, stops) to use during the analysis.
- Call the Solve method on the network analysis service, passing in the solver parameters.
- Work with the results returned from the service. This can include displaying the results on the map or reporting driving directions.
REST
Routing, Closest Facility, and Service Area solvers are accessible through a set of REST endpoints located at http://<server>:6080/arcgis/rest/services.
The general pattern when working with network analysis through REST is as follows:
- Set properties that are different from the default.
- Set network locations.
- Make an HTTP request to the /Solve endpoint.
- Use the returned JSON object to get the results of the analysis.
More details can be found in the REST API.
REST and Web APIs
If you're writing a light-weight Web application, you do not have to code against the NAServer REST endpoint from scratch. Instead, you can use the out-of-the-box client side libraries. For more information, see the following:
- Flex
- JavaScript
- Silverlight
SOAP
Routing, Closest Facility, Service Area, Location-Allocation, Vehicle Routing Problem, and Origin-Destination Const Matrix solvers are accessible through a set of coarse grained stateless SOAP objects.
The NAServer object is a MapServer server object extension that is capable of performing network analysis through a single, stateless method call. It is used in conjunction with various NAServerSolverParams and NAServerSolverResults objects.
The general pattern when working with server objects is as follows:
- Get a reference to an NAServer object either through a MapServer that has an NAServer extension loaded or through an NAServer Web service.
- Call NAServer.GetSolverParameters2 to get the NAServerSolverParams object holding the default parameters.
- Set properties on the NAServerSolverParams object to configure how you want the analysis to be performed.
- Set network locations (for example, Stops) to use in the analysis.
- Call NAServer.Solve, passing in the NAServerSolverParams object.
- Use the returned NAServerSolverResults object to get at the results of the analysis.
See the SOAP SDK topics for more information.
See Also:
ArcGIS for Server Resource CenterSample: Routing and geocoding application using the NAServer extension in ArcGIS Server via a Web service
Sample: Route application using the NAServer extension in ArcGIS Server via a Web service