Assign Nearest

Title Assign Nearest

Summary

Assigns a field value to point or polyline features from their nearest feature in another feature class or layer.


Usage

  • When evaluating input and search features which both have polyline shapes, a special algorithm is used to to determine the nearest search feature. This algorithm considers the distances from a search feature to an input feature's from, mid, and to points. The algorithm requires at least two of these distances be within the search tolerance. The nearest feature is determined as the feature having the lowest sum value of the distances which are within the search distance. A search feature within the search distance of all 3 points will be considered as the nearest feature over one that is within search distance of only 2 points.

  • If multiple search features are found to be equally close to an input feature, only one of their values will be assigned. The feature whose value will be assigned should be considered non-deterministic. The value of the first feature found at the nearest distance will be assigned to the input feature.

  • If the input features are from a layer having a selection set, only the selected features will be used.

  • If the search features are from a layer having a selection set, only the selected features will be used.

  • Will update a field in the input features named 'DistFrom' (Double or Integer) with the distance between a feature and its nearest feature if either the input features or search features is a point geometry type. The distance will be in the same units as the XY units of the input features.


Syntax

Assign_Nearest (input_features, update_field, search_features, value_field, search_distance)

Parameter Explanation Data Type
input_features Dialog Reference

The input point or polyline layer or feature class whose attribute value will be updated with a value from the nearest search feature.

Table View
update_field Dialog Reference

The field in the input feature class that will be updated.

Field
search_features Dialog Reference

The point, polyline, or polygon layer or feature class that will be searched to locate the nearest feature.

Table View
value_field Dialog Reference

The field in the search feature class whose value will be copied to the input feature.

Field
search_distance Dialog Reference

The maximum distance allowed between an input feature and the nearest feature. If no search features can be found within this distance, the field is not updated.

Linear unit

Code Samples

Tags

Credits

Use limitations