Network analysis is a type of analysis performed on transportation networks, such as roads, railways, and bus networks. Examples of network analysis operations include finding the best route across a city, finding the closest emergency vehicle or facility, identifying a service area around a location, or servicing a set of orders with a fleet of vehicles.
You can perform network analysis in GeoAnalytics Engine using the Create Routes, Create Service Areas, Find Closest Facilities or Generate OD Matrix tools.
Network analysis with GeoAnalytics Engine requires the geoanalytics-natives
jar. See the Install and set up documentation for more information on how to install this jar in your environment.
Network datasets
The network analysis tools require a network dataset to model transportation networks. Network datasets are created from source records, which can include lines, points, and turns, and they store the connectivity of the source records.
Connectivity is important, given that records are normally unaware of each other. For example, if two line records intersect, neither line is aware of the other. Similarly, a point at the end of a line doesn't have any inherent information that lets it know about the line. However, network datasets keep track of the source records that are coincident. They also have a connectivity policy to further define which coincident records are truly connected.
Network datasets in GeoAnalytics Engine
You will need to create a network dataset to be able to perform network analysis in GeoAnalytics Engine. Make sure to create a network dataset that covers the extent of the input data used when performing analysis. To learn how to create a network dataset, see Create a network dataset.
GeoAnalytics Engine network analysis tools support two network datasource formats:
- Mobile map package—
.mmpk
files are the most commonly used network datasource in GeoAnalytics. You can create a mobile map package in ArcGIS Pro. - Mobile geodatabase—
.geodatabase
files should only be used by a single user and application at time. You can create a mobile geodatabase in ArcGIS Pro.
Loading network data from a file geodatabase is not supported. Using a network service, such as the ArcGIS Online network analysis service, is not supported.
The network dataset must be locally accessible to all nodes in your Spark cluster. For more information, see Locator and network dataset setup.
Start time can be critical in certain types of network analysis. It takes much longer to drive across the city during rush hour than it does during the middle of the night because of increased traffic. Network analysis can be performed by setting start time if historical traffic data is configured in the network dataset. To learn how to create historical traffic data, see Historical traffic.
Describe network datasets in GeoAnalytics Engine
You will need to understand the network dataset to be able to perform network analysis. Some information are essential
for the analysis, such as travel modes and cost attributes supported in the network dataset. You can use the
describe
utility function to describe the network dataset and get the dataset information.
By default, the function returns a dictionary with following properties of the network dataset:
name
—The name of the network dataset in the mobile map package or mobile geodatabase.path
—The path of the network dataset.spatial
—The well-known ID (WKID) of the spatial reference.Reference default
—The name of the network dataset's default travel mode. An empty string will be returned if the network dataset does not have a default travel mode.Travel Mode travel
—The names of the travel modes available in the network dataset.Mode Names cost
—The names of the cost attributes available in the network dataset.Attribute Names
The following code sample shows an example of describing a network dataset:
# Describe the network dataset example.mmpk
import geoanalytics
import json
ND = geoanalytics.util.describe_network_dataset(r"/data/example.mmpk")
print(json.dumps(ND, sort_keys=True, indent=4))
{
"costAttributeNames": [
"Kilometers",
"Miles",
"Minutes",
"TimeAt1KPH",
"TravelTime",
"TruckMinutes",
"TruckTravelTime",
"WalkTime"
],
"defaultTravelMode": "Driving Time",
"name": "Routing_ND",
"path": "C:\\data\\example.mmpk",
"spatialReference": {
"wkid": 4326
},
"travelModeNames": [
"Driving Time",
"Driving Distance",
"Trucking Time",
"Trucking Distance",
"Walking Time",
"Walking Distance",
"Rural Driving Time",
"Rural Driving Distance"
]
}
You can get more network dataset properties using describe
.
In addition to the properties listed above, the following network dataset properties are returned when using extended = True
:
travel
—The properties of each travel mode, such as name, type, descriptions, and impedance attribute.Modes restrictions
—The available restriction attributes of the network dataset.restrict
—The usage types that determine whether the restriction attribute prohibits, avoids, or prefers the network elements associated with it.Usage Param Names max
—The furthest distance in meters that network analysis searches when locating or relocating a point onto the network.Locating Distance Meters
In the extended version of the network data properties, the following properties are available for each travel mode:
name
—The name of the travel mode.type
—The type of the travel mode.description
—The description of the travel mode.impedance
—The name of the impedance attribute of the travel mode.Attribute Name distance
—The name of the distance attribute of the travel mode.Attribute Name time
—The name of the time attribute of the travel mode.Attribute Name restriction
—The list of network attribute names to be used as restrictions in the travel mode.Attribute Names use
—Whether hierarchy of elements in the transportation network should be considered in the travel mode.Hierarchy uturn
—The U-turn policy that specifies how U-turns are handled in the travel mode.At Junctions simplification
—Specifies how much the travel mode generalizes the geometry of analysis results.Tolerance simplification
—The unit of the simplification tolerance.Tolerance Units attribute
— The attribute values of cost and restriction attributes.Parameter Values
The following code sample shows an example of describing a network dataset with the extended option and returning the properties of one travel mode:
# Describe the network dataset example.mmpk with the extended option
ND = geoanalytics.util.describe_network_dataset(r"/data/example.mmpk", extended = True)
# Get the properties for the travel mode 'driving time'
print(json.dumps(ND.get(travelModes)[0], sort_keys=True, indent=4))
{
"attributeParameterValues": [
{
"attributeName": "TravelTime",
"parameterName": "Vehicle Maximum Speed (km/h)",
"value": 0
},
{
"attributeName": "TruckTravelTime",
"parameterName": "Vehicle Maximum Speed (km/h)",
"value": 0
},
{
"attributeName": "WalkTime",
"parameterName": "Walking Speed (km/h)",
"value": 5
},
{
"attributeName": "Any Hazmat Prohibited",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Avoid Carpool Roads",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Avoid Express Lanes",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Avoid Ferries",
"parameterName": "Restriction Usage",
"value": 2
},
{
"attributeName": "Avoid Gates",
"parameterName": "Restriction Usage",
"value": 2
},
{
"attributeName": "Avoid Limited Access Roads",
"parameterName": "Restriction Usage",
"value": 2
},
{
"attributeName": "Avoid Private Roads",
"parameterName": "Restriction Usage",
"value": 2
},
{
"attributeName": "Avoid Roads Unsuitable for Pedestrians",
"parameterName": "Restriction Usage",
"value": 5
},
{
"attributeName": "Avoid Stairways",
"parameterName": "Restriction Usage",
"value": 5
},
{
"attributeName": "Avoid Toll Roads",
"parameterName": "Restriction Usage",
"value": 2
},
{
"attributeName": "Avoid Toll Roads for Trucks",
"parameterName": "Restriction Usage",
"value": 2
},
{
"attributeName": "Avoid Truck Restricted Roads",
"parameterName": "Restriction Usage",
"value": 5
},
{
"attributeName": "Avoid Unpaved Roads",
"parameterName": "Restriction Usage",
"value": 5
},
{
"attributeName": "Axle Count Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Axle Count Restriction",
"parameterName": "Number of Axles",
"value": 0
},
{
"attributeName": "Driving a Bus",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Driving a Taxi",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Driving a Truck",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Driving an Automobile",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Driving an Emergency Vehicle",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Height Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Height Restriction",
"parameterName": "Vehicle Height (meters)",
"value": 0
},
{
"attributeName": "Kingpin to Rear Axle Length Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Kingpin to Rear Axle Length Restriction",
"parameterName": "Vehicle Kingpin to Rear Axle Length (meters)",
"value": 0
},
{
"attributeName": "Length Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Length Restriction",
"parameterName": "Vehicle Length (meters)",
"value": 0
},
{
"attributeName": "Preferred for Pedestrians",
"parameterName": "Restriction Usage",
"value": 0.8
},
{
"attributeName": "Riding a Motorcycle",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Roads Under Construction Prohibited",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Semi or Tractor with One or More Trailers Prohibited",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Single Axle Vehicles Prohibited",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Tandem Axle Vehicles Prohibited",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Through Traffic Prohibited",
"parameterName": "Restriction Usage",
"value": 5
},
{
"attributeName": "Truck with Trailers Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Truck with Trailers Restriction",
"parameterName": "Number of Trailers on Truck",
"value": 0
},
{
"attributeName": "Use Preferred Hazmat Routes",
"parameterName": "Restriction Usage",
"value": 0.5
},
{
"attributeName": "Use Preferred Truck Routes",
"parameterName": "Restriction Usage",
"value": 0.5
},
{
"attributeName": "Walking",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Weight per Axle Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Weight per Axle Restriction",
"parameterName": "Vehicle Weight per Axle (kilograms)",
"value": 0
},
{
"attributeName": "Weight Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Weight Restriction",
"parameterName": "Vehicle Weight (kilograms)",
"value": 0
},
{
"attributeName": "Width Restriction",
"parameterName": "Restriction Usage",
"value": -1
},
{
"attributeName": "Width Restriction",
"parameterName": "Vehicle Width (meters)",
"value": 0
}
],
"description": "Models the movement of cars and other similar small automobiles, such as pickup trucks, and finds solutions that optimize travel time. Travel obeys one-way roads, avoids illegal turns, and follows other rules that are specific to cars. When you specify a start time, dynamic travel speeds based on traffic are used where it is available.",
"distanceAttributeName": "Kilometers",
"impedanceAttributeName": "TravelTime",
"name": "Driving Time",
"restrictionAttributeNames": [
"Avoid Carpool Roads",
"Avoid Express Lanes",
"Avoid Gates",
"Avoid Private Roads",
"Avoid Unpaved Roads",
"Driving an Automobile",
"Roads Under Construction Prohibited",
"Through Traffic Prohibited"
],
"simplificationTolerance": 10.0,
"simplificationToleranceUnits": "esriMeters",
"timeAttributeName": "TravelTime",
"type": "AUTOMOBILE",
"useHierarchy": true,
"uturnAtJunctions": "esriNFSBAtDeadEndsAndIntersections"
}
For more details, go to the GeoAnalytics Engine API reference for describe network dataset.
Network analysis concepts
Travel modes
Travel modes on a network dataset define how a pedestrian, car, truck, or other mode of transportation moves through the network. A travel mode can be general—for example, to model typical trucks—or more specific, such as to model ladder trucks or rescue trucks.
A travel mode is essentially a template consisting of a long list of travel settings that define the physical characteristics of a vehicle or pedestrian. Those characteristics are considered when performing a network analysis to define how the vehicle or pedestrian travels and where it can go. Selecting a predefined travel mode allows you to efficiently and consistently set a number of properties that are appropriate for the mode of travel you intend to model. The benefits are time savings and reduced complexity—you don't need to remember and configure, with each analysis, the parameter values that most accurately characterize the vehicles you're modeling.
Travel modes are defined on the network datasource or using JSON format for a custom travel mode. By default, the network analysis tools use the default travel mode predefined in the network datasource for the analysis.
All network analysis tools have the set
setter. This setter accepts any of the travel modes defined on the
network dataset, or a JSON string that defines a custom travel mode.
Cost attributes
Certain attributes are used to measure and model impedances, such as travel time (transit time on a street) or demand (the volume of garbage picked up on a street). These attributes are apportionable along an edge; that is, they are divided proportionately along the length of an edge. For example, if travel time is modeled as a cost attribute, traversing half an edge will take half the time of traversing the whole edge: if the travel time to traverse the edge is 3 minutes, it takes 1.5 minutes to traverse half the edge. If you are looking for a 1.5-minute route along this edge, the route feature is created from the first half of the edge feature.
Network analysis often involves the minimization of a cost (also known as impedance) during the calculation of a path. Common examples include finding the fastest route (minimizing travel time) or the shortest route (minimizing distance). Travel time and distance are also cost attributes of the network dataset.
The Create Service Areas, Find Closest Facilities,
and Generate OD Matrix tools support accumulating cost attributes along the
network using the .accumulate
method.
How the Create Routes tool works
The Create Routes tool uses a network dataset to understand the connectivity of a transportation network to find the best route between a series of input points. A route is calculated for each record in the input DataFrame. The output DataFrame contains a linestring column with the routes that visit the input points.
Use cases
- A distribution center for grocery stores assigns routes to each of the food delivery trucks to minimize transportation costs.
- A health department creates an optimized route daily for each of the health inspectors to maximize the number of inspections performed each day.
For more information about how to use Create Routes, see the tool documentation.
How the Create Service Areas tool works
The Create Service Areas tool uses a network dataset to generate reachable service areas around facility locations. These service areas are accessible within a given cutoff cost from the facility location. For example, the 10-minute walk-time service area around a subway station indicates a region where residents can walk to the station within ten minutes. The tool accepts point geometries as the input DataFrame, representing the facilities around which the service areas will be created. The output DataFrame can contain polygons that represent reachable areas within the impedance cutoffs or lines that represent the reachable roads before the cutoffs are exceeded.
Use cases
- A retail company is planning to expand its chain of stores to better serve its customers. The company wants to identify potential locations for new stores that would maximize their customer base and minimize the competition with existing stores. They also want to understand the coverage area and accessibility of each potential store location to ensure they are strategically positioned. The tool calculates the service areas around each potential store location based on the road network and travel time or distance constraints.
- A network company wants to generate 2 and 4-hour service areas to check if their customers that have signed up for a service agreement can actually be reached within the given time constraint. Their contract promises a 2 or 4-hour turn-around time in case a network switch/router goes down.
For more information about how to use Create Service Areas, see the tool documentation.
How the Find Closest Facilities tool works
The Find Closest Facilities tool uses a network dataset to find a specified number of closest facilities to an incident based on a specified travel mode. The tool requires two point DataFrames as inputs representing the incidents and the facilities. The tool returns the travel costs and best routes between the incidents and the chosen facilities.
Use cases
- A national healthcare department wants to find the three closest urgent care facilities for every one of their customers so they can disseminate this information with them in their next newsletter.
For more information about how to use Find Closest Facilities, see the tool documentation.
How the Generate OD Matrix tool works
The Generate OD Matrix tool uses a network dataset to create an origin-destination cost matrix from multiple origins to multiple destinations. It returns a table that contains the travel cost, including travel time and travel distance from each origin to each destination within the specified impedance cutoff. The tool requires two point-geometry DataFrames as an input, representing the origins and destinations.
Use cases
- A city's transportation department wants to analyze the commuting patterns of its residents to understand the flow of people between residential areas and major employment centers. The goal is to identify traffic bottlenecks, optimize public transportation routes, and plan infrastructure improvements to reduce congestion and travel times. The tool calculates the travel time or distance matrix between each origin-destination pair, considering the road network and any transportation restrictions.
- GIS analysts in local government offices need to be able to calculate how many and which grocery stores are within a 15-minute drive from each census tract. Depending on the result, they will be able to determine if people living below poverty have access to grocery stores. Transportation engineers will take this information into account when evaluating and improving the transportation infrastructure.
For more information about how to use this tool, see the Generate OD Matrix tool documentation.