Locate analysis inputs

When you perform a network analysis, the inputs to your analysis rarely fall exactly on top of the edges or junctions of the network data source you are using. For example, you may be using a network dataset constructed from street centerlines, but the points you want to analyze are the centroids of parcels in your city. These parcel centroids do not fall on top of the street centerlines; rather, they are offset some distance from the streets. To successfully perform a network analysis, Network Analyst must determine the location on the network dataset where each analysis input lies. This network location, rather than the input's original location, is used in the analysis. For example, if you calculate a route between two parcels in your city, the start and end points of the route are not the parcel centroids but rather the locations where the parcel centroids snap to the street centerlines.

A point located on a network edge

The image above illustrates where a route stop is located on the network. The purple circle indicates the geographic location of the stop. However, the route line begins at the closest point along the street network, which is the point's network location.

The locating process

Network locations are calculated based on several factors, including the geographic locations of the inputs, the settings of the network analysis for which the inputs will be used, and user-specified location settings in the tool or function being used to locate the inputs. The procedure works as follows for an input point:

  1. Network Analyst finds the point on the network that is closest to the original point's location.
  2. Network Analyst considers the network analysis settings and the user's location settings to determine whether this location is valid for locating analysis inputs. If the location is considered invalid for locating, the location is skipped, and the next-closest possible location is considered. The following are a few reasons a network edge or junction may be considered invalid for locating:
    • The location is restricted by the selected travel mode. For example, if the current travel mode restricts all limited-access highways, and the closest network edge is a limited-access highway, points for this analysis cannot be located on this edge.
    • The location is restricted by a barrier.
    • The location is restricted by the location settings you specified. For example, you can use a search query to prevent locating inputs on network edges with a particular road class.
  3. The process repeats, each time examining the next-closest network location, until a valid network location is found for the input point. If no valid location is found within the specified search tolerance distance, the point remains unlocated and cannot be used in the analysis.

Once the input is located, its network location is stored in a set of fields. These fields are described in the Network location fields section below.

When locating point barriers, the travel mode and other barriers are ignored. Only the geometry and the user-specified location settings are considered. Lines and polygons can also be used as network analysis inputs, but only as line and polygon barriers. These barriers locate on all network edges or junctions they overlap, subject to the user-specified location settings.

Network location calculation in a network analysis workflow

How and when inputs are located on the network differs depending on your network analysis workflow.

Layer-based network analysis workflows

When performing analysis using a network analysis layer, you can calculate network locations in advance, when you run the Add Locations tool, automatically at solve time, or any combination of these. The subsections below explain these options in the context of several common workflows.

Layer-based workflows using the Add Locations tool

One of the most common layer-based network analysis workflows is to create a network analysis layer, run the Add Locations tool to add inputs to the network analysis layer, and solve the layer.

If the network analysis layer references a local network dataset, the inputs are located on the network when the Add Locations tool is run. The tool calculates the network locations based on the settings configured in the tool parameters, the network analysis layer's travel mode, and any barriers currently stored in the network analysis layer. After running the tool, the inputs are added to the specified sublayer of the network analysis layer, and the network location fields of that sublayer are populated with the calculated values. You can view network location fields in the attribute table of the sublayer.

By default, the network analysis layer's travel mode and existing barriers are considered when locating inputs. Inputs are not located on edges and junctions that are restricted by the travel mode or by existing barriers. Consequently, it is recommended that you set the travel mode and load barriers before loading other analysis inputs with the Add Locations tool. However, if you change the travel mode after adding locations or you add or remove barriers, the network locations of affected points are automatically recalculated at solve time to ensure that they remain valid, unless this automatic recalculation option is turned off.

For a network analysis layer that references a portal service, the location fields are not calculated until you solve the analysis. The Add Locations tool adds the inputs to your analysis layer without calculating location fields. At solve time, the inputs are sent to the service along with the network analysis layer's analysis and locate settings. The service calculates the location fields, performs the analysis, and returns the result. Once the layer is solved, you can see the now-populated location fields in the attribute tables of the input sublayers.

Layer-based workflows using editing tools to create inputs

Another common layer-based network analysis workflow is to create a network analysis layer, use the standard editing tools to manually create features in the sublayers of the network analysis layer, and solve the layer. In this workflow, the inputs are located on the network at solve time using the locate settings configured on the network analysis layer, its travel mode, and barriers. After the solve completes, you can view the populated network location fields in the attribute table of each input sublayer.

Layer-based workflows using precalculated network locations

In some workflows, network locations are calculated for a feature class in advance using the Calculate Locations tool. In this case, the Add Locations tool uses field mapping to transfer the precalculated network location fields from the input feature class to the specified sublayer.

Learn how to precalculate network locations and use them in an analysis

Under some circumstances, some precalculated network locations may be recalculated at solve time to ensure that they are valid for the analysis, unless that option is turned off. If you used nondefault location settings when precalculating network locations, you should update the network analysis layer's location settings to match. This ensures that any inputs relocated automatically at solve time use the same location settings. More information about this behavior is included in the topic linked above.

Python-based workflows using the Network Analyst module

When performing analysis in Python using the Network Analyst module, arcpy.nax, network locations are either precalculated in advance or calculated at solve time. The subsections below summarize these options.

Learn how to set analysis inputs for a Python-based workflow

Python-based workflows without precalculated network locations

In a typical Python-based workflow, inputs are added to the analysis using the load method or the insertCursor method on the network analysis solver object. Unless existing network location fields are explicitly mapped, the network locations are not calculated until the analysis is solved using the solve method. The travel mode and any barriers used in the analysis are considered when locating inputs, as are the locate settings configured on the network analysis solver object. Once the analysis has been solved, the now-populated location fields appear in the outputs accessible via the solver's result object.

Python-based workflows using precalculated network locations

In some workflows, network locations are calculated for a feature class in advance using the Calculate Locations tool. In this case, the network location fields can be mapped when adding inputs using the load method or the insertCursor method. These preexisting network location fields are then used at solve time.

Learn how to precalculate network locations and use them in an analysis

Under some circumstances, some precalculated network locations may be recalculated at solve time to ensure that they are valid for the analysis, unless that option is turned off. If you used nondefault location settings when precalculating network locations, you should update the solver object's location settings to match. This ensures that any inputs relocated automatically at solve time use the same location settings. More information about this behavior is included in the topic linked above.

Settings that affect how inputs are located

Several settings control locating behavior.

You can control which network edge and junction sources can be used for locating. For example, you can configure the analysis to locate inputs on streets but not on sidewalks. The list of possible sources on which to locate is specific to the network dataset being used for the analysis. When performing network analysis using layer-based workflows, you can adjust this setting using the Search Criteria parameter in the Add Locations tool or using the network analysis layer's properties page. When performing analysis in Python using the Network Analyst module, you can adjust this setting using the searchSources property (which can also be used to set a query for each source).

A search query allows you to restrict locating on network source features matching certain characteristics using an SQL expression. For example, you can configure the analysis to locate inputs only on street features matching certain road classes. When performing network analysis using layer-based workflows, you can adjust this setting using the Search Query parameter in the Add Locations tool or using the network analysis layer's properties page. When performing analysis in Python using the Network Analyst module, you can adjust this setting using the searchSources property (which is also used to control the sources to use for locating).

The search tolerance controls the maximum search distance to use when locating the input features on the network. If no valid network location is found within this distance, the input feature will be considered unlocated. A small search tolerance decreases the likelihood of locating on the wrong street but increases the likelihood of not finding any valid network location. When performing network analysis using layer-based workflows, you can adjust this setting using the Search Tolerance parameter in the Add Locations tool or using the network analysis layer's properties page. When performing analysis in Python using the Network Analyst module, you can adjust this setting using the searchTolerance and searchToleranceUnits properties.

Note:
These settings are not supported when the analysis network data source is ArcGIS Online or a portal running a version of ArcGIS Enterprise earlier than 11.0.

Learn more about controlling these settings using a network analysis layer's properties

Learn more about controlling these settings using the Add Locations tool

Learn more about controlling these settings for workflows using the Network Analyst module

Control locating behavior separately for each input class

In some circumstances, you may want to separately control locating behavior for each input type in an analysis. For example, in an OD cost matrix analysis, you can use a search query for input origins only, if that query should not apply to the input destinations and barriers.

When performing network analysis using layer-based workflows, you can configure locating behavior for individual sublayers using the network analysis layer's properties page. Additionally, when you run the Add Locations tool, any location settings configured on the tool dialog box that do not match the layer's default settings will be preserved on the layer for that sublayer.

When performing analysis in Python using the Network Analyst module, you can use the setLocateSettingsOverrides method to configure locating behavior for individual input classes, overriding the default settings for the analysis. Learn more about this method and see an example in Setting analysis inputs.

Note:
This functionality is not supported when the analysis network data source is ArcGIS Online or a portal running a version of ArcGIS Enterprise earlier than 11.0.

Network location fields

Once an input has been located on the network, its network location is defined using network location fields.

Network location fields for points

For point inputs, the network location fields contain the ID of the network edge or junction where the point is located. If the point is located on an edge, the location fields also contain the position along that edge and the side of the edge where the point falls. The network location fields for point inputs are as follows:

Field nameDescriptionData Type

SourceID

The numeric identifier of the network dataset source feature class on which the input point is located.

Long

SourceOID

The ObjectID of the feature in the source on which the input point is located.

Long

PosAlong

The position along the digitized direction of the source line feature. This value is stored as a ratio. This field is null if the network location references a junction.

Double

SideOfEdge

The side of the edge in relation to the digitized direction of the line feature. This field is limited to a domain of two values: Right Side (1) and Left Side (2).

Long

SnapX

The x-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset.

Double

SnapY

The y-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset.

Double

SnapZ

The z-coordinate of the position on the network dataset where the point was located, in the coordinate system of the network dataset. The SnapZ field is 0 if the network is two dimensional.

Double

DistanceToNetworkInMeters

The distance in meters between the point's geographic location and the position where it was located on the network.

Double

Network location fields for lines and polygons

Lines and polygons can be used as barriers in a network analysis. The network location of a line or polygon input is defined by a single BLOB field: Locations.

Field nameDescriptionData Type

Locations

The information in this field defines which network edges and junctions are covered by the line or polygon and the portion of each edge element that is covered. You cannot directly read or edit the information contained in this field, but Network Analyst interprets it when solving an analysis.

Blob

Unlocated inputs

Sometimes Network Analyst cannot locate an input on the network. This most commonly occurs when no valid network edges or junctions can be found within the specified search tolerance distance. These unlocated inputs cannot be used in the network analysis.

When a point is unlocated, the network location fields are not populated. Additionally, the Status field has a value of 1(Not Located). You can use the Status field to query your table to find all unlocated inputs. Review the geographic locations of these unlocated points to determine whether they are safe to ignore or if they need to be edited.

When you solve a network analysis layer, unlocated inputs are ignored by default. If you instead want the solve to fail if any inputs are unlocated, uncheck the Ignore Invalid Locations option on the Solve tool. For Python-based workflows, use the network analysis solver object's ignoreInvalidLocations property to indicate whether unlocated points should be ignored.

Precalculate network location fields

Calculating network locations for a large number of inputs can be a time-consuming process. If you plan to use the same input data for multiple analyses using the same network dataset and analysis settings, you can save processing time by precalculating your network location fields.

Learn how to precalculate network locations and use them in an analysis

Use a vehicle's bearing to more accurately calculate network locations

The direction in which a vehicle is moving, or its bearing, can be used to more accurately determine its location on a network.

Learn more about how to use bearing when locating points