Managing ArcGIS applications

The Route service, the Closest Facility Service, and the Service Area Service support synchronous and asynchronous execution modes. Asynchronous and synchronous modes define how the application interacts with the service and gets the results.

Synchronous execution mode: the application must wait for the request to finish and get the results. This execution mode is well-suited for requests that complete quickly (under 10 seconds).

Asynchronouse execution mode: the client must periodically check whether the service has finished execution and, once completed, retrieve the results. While the service is executing, the application is available to do other things. This execution mode is well-suited for requests that take a long time to complete because it allows users to continue to interact with the application while the results are generated.

To submit synchronous calls to those services, you would need to access them via the arcgis.network module initializing the NetworkLayer objects for each type of the service.

To submit asynchronous calls to those services, you would need to access them via the network.analysis module.

Some services are in nature very compute intensive, so they can be accessed only via the asynchronous calls. These services are the Location-Allocation service, the Vehicle Routing Problem service, and the Origin Destination Cost Matrix Service.

The route service can be used to find the best way to get from one location to another or to visit several locations. The best route can be the quickest route for a given time of day considering the traffic conditions applicable during that time, or it can be the shortest route that minimizes the travel distance. The route service can also find the best route that visits each stop during permitted time windows you specify. If you have more than two stops to visit, the best route can be determined for the fixed order of locations you specify. Such a route is called a simple route. Alternatively, the route service can determine the best sequence in which to visit the locations (the traveling salesperson problem). Such a route is called an optimized route.

The maximum time an application can use the Route service when using the asynchronous execution mode is 1 hour (3,600 seconds). If your request does not complete within this time limit, it will time out and return a failure.

The find_routes method's input parameters types are slightly different from the synchronous solve method of the RouteLayer network analysis layer. For instance, time_of_day optional parameter expects to get a datetime object and not the milliseconds since midnight, January 1 1970.

When using synchronous network analysis services, you get back a Python dictionary with all the information you may need such as routes, stops, barriers, and directions. In contrast, when using asynchronous network analysis services, the result object returned is of ToolOutput type. This object has several properties associated with it.

If you would need to take the result routes between stops into a desktop GIS for further analysis or visualization, you might want to save them into a shapefile. This can be done using arcpy package which comes together with the ArcGIS Desktop or ArcGIS Enterprise installation or by using the save() method of a FeatureSet object.

With the service area service, you can find the area that can be reached from the input location within a given travel time or travel distance. A service area is the area that encompasses all streets that can be accessed within a given distance or travel time from one or more locations, referred to as facilities. Service areas are generally used to visualize and measure the accessibility of facilities.

For example, a three-minute drive-time polygon around a grocery store can determine which residents are able to reach the store within three minutes and are thus more likely to shop there. The service can also create multiple concentric service areas around one or more facilities that can show how accessibility changes with an increase in travel time or travel distance. It can be used, for example, to determine how many hospitals are within 5, 10, and 15 minute drive times of schools. When creating service areas based on travel times, the service can make use of traffic data, which can influence the area that can be reached during different times of the day.

The maximum time an application can use the service area service when using the asynchronous execution mode is 1 hour (3,600 seconds). If your request does not complete within that time limit, it will time out and return a failure.

After getting back the polygon representing the service area you can use the geometry module of arcgis package to filter features stored within a feature layer. If you have ArcGIS Pro, ArcGIS Desktop, or ArcGIS Server installed on the machine you author your Python script, you can use the arcpy site-package to re-project the Web Mercator coordinates into the WGS84 ones.

USA Major CitiesThis layer presents the locations of cities within United States with populations of 10,000 or greater (based on Census 2000 figures), all state capitals, and the national capital.Feature Layer Collection by esri
Last Modified: February 07, 2017
1 comments, 1,141,428 views

When submitting the query to a feature layer, it is possible to specify the filter object: this is the geometry to apply as the spatial filter. In this case, we want to select all point features (cities) in the feature layer that are located within the polygon feature (service area).

Finally, it can be handy just to print out some of the attributes of the features that were returned by the query. The result representing the query's result feature set can be represented as a pandas data frame which makes it very easy to inspect or process data further.

Finding the closest hospital to an accident, the closest police cars to a crime scene, and the closest store to a customer's address are all examples of problems that can be solved using the closest facility service. When finding the 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 and include the travel time, travel distance, and driving directions to each facility. The service can use current traffic conditions when determining the best routes. Additionally, you can specify an impedance cutoff beyond which the service should not search for a facility.

For instance, you can set up a closest facility service to search for hospitals within 15 minutes' 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. The hospitals are referred to as facilities, and the accident is referred to as an incident. The service allows you to perform multiple closest facility analyses simultaneously. This means you can have multiple incidents and find the closest facility or facilities to each incident.

The maximum time an application can use the closest facility service when using the asynchronous execution mode is 1 hour (3,600 seconds). If your request does not complete within this time limit, it will time out and return a failure.

The Origin Destination Cost Matrix service helps you to create an origin-destination (OD) cost matrix from multiple origins to multiple destinations. An OD cost matrix is a table that contains the cost, such as the travel time or travel distance, from each origin to each destination. Additionally, it ranks the destinations that each origin connects to in ascending order based on the minimum cost required to travel from that origin to each destination. When generating an OD cost matrix, you can optionally specify the maximum number of destinations to find for each origin and the maximum time or distance to travel when searching for destinations.

The maximum time an application can use the Origin Destination Cost Matrix service is 1 hour (3,600 seconds). If your request does not complete within this time limit, it will time out and return a failure.

Just as with result objects received from the services earlier, it is very easy to get the information needed by iterating the pandas data frame of the lines connecting the origins and the destinations.

Location-allocation helps you choose which facilities from a set of facilities to operate based on their potential interaction with demand points. The objective may be to minimize the overall distance between demand points and facilities, maximize the number of demand points covered within a certain distance of facilities, maximize an apportioned amount of demand that decays with increasing distance from a facility, or maximize the amount of demand captured in an environment of friendly and competing facilities.

The maximum time an application can use the location-allocation service is 1 hour (3,600 seconds). If your request does not complete within this time limit, it will time out and return a failure.

Various organizations service orders with a fleet of vehicles. For example, a large furniture store might use several trucks to deliver furniture to homes. A specialized grease recycling company might route trucks from a facility to pick up used grease from restaurants. A health department might schedule daily inspection visits for each of its health inspectors. The problem that is common to these examples is the vehicle routing problem (VRP).

Each organization needs to determine which orders (homes, restaurants, or inspection sites) should be serviced by each route (truck or inspector) and in what sequence the orders should be visited. The primary goal is to best service the orders and minimize the overall operating cost for the fleet of vehicles. The VRP service can be used to determine solutions for such complex fleet management tasks. In addition, the service can solve more specific problems because numerous options are available, such as matching vehicle capacities with order quantities, providing a high level of customer service by honoring any time windows on orders, giving breaks to drivers, and pairing orders so they are serviced by the same route.

The maximum time an application can use the vehicle routing problem service when using the asynchronous execution mode is 4 hours (14,400 seconds). If your request does not complete within the time limit, it will time out and return a failure. When using the synchronous execution mode, the request must complete within 60 seconds. If your request takes longer, the web server handling the request will time out and return the appropriate HTTP error code in the response.