Note:
Calculate Travel Cost was named Connect Origins to Destinations in Map Viewer Classic.
The Calculate Travel Cost tool measures the travel time or distance between pairs of points using either straight lines or network-based travel modes.
The output is a hosted feature layer.
Example
A department store with a rewards program wants to determine how far its customers are traveling to shop. An analyst uses the Calculate Travel Cost tool to find the travel distance between each customer (using ZIP Codes for location) and the store.
Usage notes
Calculate Travel Cost includes configurations for input layers, analysis settings, and result layers.
Input layers
The Input layers group includes the following parameters:
From layer and To layer specify the origin and destination locations between which travel cost is calculated. Point layers with up to 5,000 features are supported.
For feature inputs, a count of features is displayed below the layer name. The count includes all features in the layer, except features that have been removed using a filter. Environment settings, such as Processing extent, are not reflected in the feature count.
The connections created between origins and destinations depend on the numbers of features in the From layer and To layer and are summarized in the following table:
From layer To layer Connections One feature
One feature
The origin connects to the destination.
One feature
More than one feature
The origin connects to all of the destinations.
More than one feature
One feature
All of the origins connect to the destination.
More than one feature
More than one feature
Many-to-many connections are created using matching ID fields. Each origin connects to each destination that has a matching ID field value.
- From layer route ID field and To layer route ID field specify fields in the From layer and To layer that identify a preassigned origin-destination pair. Each origin connects to a destination that has a matching ID field value. These parameters are available when layers with multiple points are chosen for From layer or To layer.
- Optional barrier layers is used to add features that act as temporary restrictions when traveling on the underlying streets. The Optional barrier layers parameter includes the following subparameters:
- Point barrier layer—Point features that block traffic at a specific position along the street. Travel is permitted on the street but not through the barrier. You can specify up to 250 features to act as point barriers. Examples of point barriers include a fallen tree, a traffic accident, or a downed electrical line.
- Line barrier layer—Line features that block traffic across several street segments. The line barriers prohibit travel anywhere the barriers intersect the streets and can intersect up to 500 streets. Examples of line barriers include a parade or protest.
- Polygon barrier layer—Polygon features that block traffic across entire areas of the street network. The polygon barriers prohibit travel anywhere the polygon intersects the street and can intersect up to 2,000 streets. Examples of polygon barriers include a flood or forest fire.
You can choose a layer using the Layer button, or you can create a sketch layer to use as the input using the Draw input features button.
For feature inputs, a count of features is displayed below the layer name. The count includes all features in the layer, except features that have been removed using a filter. Environment settings, such as Processing extent, are not reflected in the feature count. For line and polygon barriers, support is determined by the number of intersecting streets rather than the count of features.
Analysis settings
The Analysis settings group includes the following parameters:
Measurement type is used to choose the method by which travel cost is calculated. The method can be line distance or a travel mode.
Straight line distances are calculated using a geodesic rather than a Euclidean method. Geodesic lines account for the actual shape of the earth (an ellipsoid, or more properly, a geoid). Distances are calculated between two points on a curved surface (the geoid) as opposed to two points on a flat surface (the Cartesian plane).
Travel modes are only available if you have the network analysis privilege.
Learn more about travel modes- Departure time specifies the date and time when travel begins to calculate travel costs. This parameter impacts the travel speed for time-based travel modes and impacts the time accumulation for distance-based travel modes. The Departure time parameter options are as follows:
Now—Traffic conditions will be based on the current date and time. Live traffic conditions will be used when available.
Learn more about network analysis coverage- Custom date and time—Traffic conditions will be based on the specified date and time. If the custom date and time is within four hours of the current time, live traffic conditions will be used. If the custom date and time is not within four hours of the current date and time, average historical traffic conditions for the day of week and time of day will be used. Use this option to perform analysis with typical traffic conditions. For example, choose 9:00 a.m. on the previous Monday to perform analysis with typical conditions for Mondays at 9:00 a.m.
- Time unspecified—Travel speeds will be based on average historical speeds or the posted speed limit.
- Route shape determines how the output routes appear. The same calculation for travel cost is used regardless of which route shape is chosen. The calculation is always based on the chosen measurement type. The Route shape parameter options are as follows:
- Straight line generates straight lines (also called desire lines) between the origins and destinations. This is the default.
- Follow streets generates routes in the shape of the underlying street network. Follow streets is not available when the measurement type is Line distance.
Result layers
The Result layers group includes the following parameters:
- Output name specifies the name of the layer that is created and displayed. The name must be unique. If a layer with the same name already exists in your organization, the tool will fail and you will be prompted to use a different name.
- Include route layers saves each result route as a route layer. A route layer includes all the information for a particular route, such as the stops assigned to the route and the travel directions. Creating route layers is useful if you want to share the individual routes with other members in your organization. Click the individual result route to open a pop-up with options to edit, open the route layer, or zoom to the route.
- Save in folder specifies the name of a folder in My content where the result will be saved.
Limitations
The following limitations apply to the tool:
- Inputs can have no more than 5,000 points.
- The maximum number of route layers that can be created is 1,000. If the result contains more than 1,000 routes and Include route layers is checked, only the output feature service will be created.
- An error will occur if the tool takes more than 60 minutes to run. If this error occurs, try rerunning the analysis with fewer input features.
- You can specify up to 250 features to act as point barriers.
- If the number of street features intersected by all the line barriers exceeds 500, an error is returned.
- If the number of street features intersected by all the polygon barriers exceeds 2,000, an error is returned.
- The straight-line distance between any origin-destination pair cannot exceed 27 miles (43.45 kilometers) when the travel mode is Walking Time or Walking Distance.
- The Draw input features button is not available in Scene Viewer.
Environments
Analysis environment settings are additional parameters that affect a tool's results. You can access the tool's analysis environment settings from the Environment settings parameter group.
This tool honors the Output coordinate system analysis environment.
Credits
This tool consumes credits.
Use Estimate credits to calculate the number of credits that will be required to run the tool. For more information, see Understand credits for spatial analysis.
Outputs
This tool includes the following outputs:
- One line layer with the lines connecting the origin features to the destination features.
- One point layer with the unassigned locations in the From layer.
- One point layer with the unassigned locations in the To layer.
One route layer per line (optional).
Learn more about route layers
Licensing requirements
This tool requires the following user type and configurations:
- Creator, Professional, or Professional Plus user type
- Publisher, Facilitator, or Administrator role, or an equivalent custom role
The Network Analysis privilege is required to run the tool using a travel mode.
Resources
Use the following resources to learn more:
- Connect Origins to Destinations in ArcGIS REST API
- connect_origins_to_destinations in ArcGIS API for Python
- Find Closest in ArcGIS Online
- Plan Routes in ArcGIS Online
- Route solver in ArcGIS Pro with the ArcGIS Network Analyst extension