Skip to main content

Snap To Roads (Network Analyst Tools)

Summary

Aligns an ordered sequence of related point features, such as GPS observations or track points, to a road network, accounting for the properties of the network and travel mode.

Because the input points are assumed to be a travel path along roads, this accounts for the sequence of points and travel times between them along the network rather than snapping each point independently. The tool is typically used to align raw, imprecise GPS coordinates to the road network for data cleaning and route adherence workflows.

Usage

  • The travel mode influences snapping behavior. The snapping algorithms use the travel mode settings when determining the most likely roads that were traveled. For example, if the travel mode restricts travel on express lanes, the algorithms attempt to return roads that are not express lanes. However, in cases where the track clearly indicates the use of an express lane, the algorithms return the express lane regardless of the restriction setting. In other words, the travel mode settings are used as a guideline to influence the snapping behavior, but they may be overridden when the track data does not match those settings.

  • In addition to snapping the input points to the network, the tool can output lines representing the inferred road paths along the network.

  • In addition to geometry, the tool can enrich outputs with additional attributes, such as speed limits, length, or identifiers, derived from the underlying network source features. Configure the properties using the Road Properties Definition parameter and specify which properties to apply to each output using the Road Properties on Snapped Points and Road Properties on Lines parameters.

  • This tool is similar to the Snap Tracks tool. However, that tool does not account for the characteristics of the road network beyond directionality and connectivity when snapping points, and it does not return lines. It does not require a network dataset or the Network Analyst extension license, making it a good choice for analyses in which the detailed rules of the road are not important and output lines are not needed.

  • Learn more about the algorithms used by this tool

  • Use the GPX To Features tool to convert a .gpx file to a feature class usable as input to this tool.

  • The schema of the output snapped points feature class is as follows:

    • confidence—The confidence level of the computed solution—how likely it is that the computed snapped location is accurate. Its value is between 0 and 1, where 0 means it didn't snap to a road at all and 1 is very confident that the snapping is correct.

    • point_type—The type of the output point. The possible values are as following:

      • Snapped—The output point is snapped to a road. The confidence field indicates the confidence level of the snapping result.

      • OffRoad—The output point is not snapped to any road. This occurs if the input point is too far from a road, the tool cannot find a suitable match, or the surrounding points are identified as off-road, in which case the tool maintains track consistency by also marking the current point as off-road.

      • Noise—The output point is identified as noise. This occurs when the point belongs to a cluster; in such cases, middle points are flagged as noise and removed to improve snapping accuracy. Additionally, a point is treated as noise if it is a duplicate of the previous point or part of a sequence of zero-speed points, where only the initial point is retained.

      • Outlier—The output point is identified as an outlier. This occurs when the input point is too far from the rest of the track; the tool classifies it as an outlier to maintain track consistency.

    • line_id—If output lines are returned, this field represents the Object ID of the line feature in the output line feature class that the point snapped to.

    • track_id—The value of the field mapped to the track_id field in the Input Points Field Mappings parameter.

    • location_timestamp—The value of the field mapped to the location_timestamp field in the Input Points Field Mappings parameter.

    • horizontal_accuracy—The value of the field mapped to the horizontal_accuracy field in the Input Points Field Mappings parameter.

    • speed—The value of the field mapped to the speed field in the Input Points Field Mappings parameter.

    • course—The value of the field mapped to the course field in the Input Points Field Mappings parameter.

    • ORIG_FID—The Object ID of the input point

    The output will also include fields specified in the Road Properties on Snapped Points parameter.

  • The schema of the output lines feature class is as follows:

    • line_type—The type of the output line. The possible values are as following:

      • Road—The output line represents a road segment.

      • OffRoad—The output line represents a segment that is not a road or is not known to the routing data. The off-road segments uses straight line to connect the last point before the off-road segment and the first point after the off-road segment, and all the intermediate points are not snapped.

      • Noise—The output point is identified as noise. This occurs when the point belongs to a cluster; in such cases, middle points are flagged as noise and removed to improve snapping accuracy. Additionally, a point is treated as noise if it is a duplicate of the previous point or part of a sequence of zero-speed points, where only the initial point is retained.

      • Gap—The output line represents a gap between two part of the tracks. This can happen when the tracks are not continuous, typically when the GPS signal is lost. The gap is represented by a straight line between the last point before the gap and the first point after the gap.

    • from_position—The starting position of the line along the network edge source feature that was traversed. Values range from 0 to 1.

    • to_position—The ending position of the line along the network edge source feature that was traversed. Values range from 0 to 1.

    • track_id—The value of the field mapped to the track_id field in the Input Points Field Mappings parameter.

    The output will also include fields specified in the Road Properties on Lines parameter.

Parameters

Label Explanation Data type

Input Points

The GPS track points to snap to the network.

Feature Layer

Network Data Source

The network dataset on which the network analysis will be performed.

The parameter can be specified using the following:

  • The catalog path to a network dataset.

  • A network dataset layer

The network must have at least one travel mode. The tool does not support a portal URL as the network data source.

Network Data Source

Output Snapped Points

The output GPS track points snapped to the road network.

A shapefile is not a valid value.

Feature Class

Output Lines

(Optional)

Lines representing the inferred path traveled through the road network.

This parameter is optional. When not specified, no lines will be created.

A shapefile is not a valid value.

Feature Class

Input Points Field Mappings

(Optional)

Maps fields in the input points layer that can be used to improve and refine the snapping results.

All field mappings are optional. Any that are specified will be used to improve results, and others will be ignored.

Fields with matching names are automatically mapped by default.

Value table columns:

  • location_timestamp—The date and time at which the point was collected. This is the same as the Time field in a GPX file. This field is used to sequence the points.

  • horizontal_accuracy—The horizontal accuracy of the point measured in meters. This is the same as the HDOP field in a GPX file.

  • speed—The speed of the point in meters per second.

  • course—The compass direction of the point in degrees with values ranging from 0 to 360. 0 is due North, 90 is due East, and so on.

  • track_id—The ID of the track that the point belongs to. This attribute is used to group points that belong to the same track. You can snap multiple tracks in a single tool run by assigning unique track IDs to points that belong to different tracks. If this field is not mapped, the algorithm will assume that all points belong to the same track. If the field is mapped, all points must have a value for this field.

Value Table

Travel Mode

(Optional)

The travel mode that will be used by the snapping algorithm to improve and refine snapping results. The travel mode represents a collection of network settings, such as travel restrictions and U-turn policies, that determine how a pedestrian, car, truck, or other medium of transportation moves through the network. Travel modes are defined on your network data source.

A travel mode name, arcpy.nax.TravelMode object, and a string containing the valid JSON representation of a travel mode can be used as input to this parameter.

The default is the network data source's default travel mode.

Network Travel Mode

Road Properties Definition

(Optional)

Definitions for properties that can be calculated from the road network and added as field on the outputs. Define the properties using this parameter and apply them to the outputs using the Road Properties on Snapped Points and Road Properties on Lines parameters.

Value table columns:

  • Road Property Name—The name for the road property. This name will be used as the name of a field in the output.

  • Source Feature Class Name—The name of the network dataset source feature class from which to draw information for this property.

  • FromTo Field—The field in the specified network dataset source feature class that will be used to populate this road property when the network edge is traveled in the direction of digitization.

  • ToFrom Field—The field in the specified network dataset source feature class that will be used to populate this road property when the network edge is traveled against the direction of digitization.

Value Table

Road Properties on Snapped Points

(Optional)

The road properties to include as fields on the output snapped points feature class. The available list of properties is defined by the Road Property Name column values in the Road Properties Definition parameter.

String

Road Properties on Lines

(Optional)

The road properties to include as fields on the output lines feature class. The available list of properties is defined by the Road Property Name column values in the Road Properties Definition parameter.

String

Overrides

(Optional)
Note:

This parameter is for internal use only.

String

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Requires Network Analyst
  • Standard: Requires Network Analyst
  • Advanced: Requires Network Analyst