Near (Analysis)

This ArcGIS 2.9 documentation has been archived and is no longer updated. Content and links may be outdated. See the latest documentation.

Summary

Calculates distance and additional proximity information between the input features and the closest feature in another layer or feature class.

Learn more about how proximity is calculated in geoprocessing tools

Illustration

Finding near feature by geometry type

Usage

  • The following fields will be added to the input. If the fields already exist, the field values will be updated. These field names can be configured using the Field Names (field_names) parameter.

    • NEAR_FID—The ObjectID of the closest near feature. If no near feature is found, the value will be -1.
    • NEAR_DIST—The distance between the input and near feature. The value is in the linear unit of the input features coordinate system or meters when the Method parameter is set to Geodesic and the input is in a geographic coordinate system. If no near feature is found, the value will be -1.
    • NEAR_FC—The catalog path to the feature class that contains the near feature. This field is only added to the output table if multiple near features are specified. If no near feature is found, the value will be empty string or null.

    The following fields will be added to the input features if the Location parameter is checked (location parameter is set to LOCATION in Python). The field values are updated if the fields already exist. The field value units depend on the method selected for the Method parameter. If it's set to Planar, the value is in the linear unit of the input feature's coordinate system. If it's set to Geodesic, the value is in the geographic coordinate system associated with the input feature's coordinate system.

    • NEAR_X—The x-coordinate of the location on the near feature that is closest to the input feature. If no near feature is found, the value will be -1.
    • NEAR_Y—The y-coordinate of the location on the near feature that is closest to the input feature. If no near feature is found, the value will be -1.

    The following field will be added to the input features if the Angle parameter is checked (angle parameter is set to ANGLE in Python). The field values are updated if the fields already exist.

    • NEAR_ANGLE—The angle of the line at the FROM_X and FROM_Y location that connects the input features to the near feature. If no near feature is found or the near feature intersects the input feature, the value will be 0.

  • The values for NEAR_FID and NEAR_DIST will be -1 if no feature is found within the search radius.

  • Both input features and near features can be point, multipoint, line, or polygon.

  • The Near Features can include one or more feature classes of different shape types (point, multipoint, line, or polygon).

  • The same feature class or layer can be used as both input and near features. In this situation, the input feature being evaluated is excluded from the near feature candidates to avoid all features being closest to themselves.

  • The input features can be a layer on which you have performed a selection. The selected features will be used and updated during the execution of the tool. The remaining features will have the values of the newly created fields (such as NEAR_FID and NEAR_DIST) set to -1.

  • When more than one near feature has the same shortest distance from an input feature, one of them is randomly chosen as the nearest feature.

  • When using the Planar option for the Method parameter, the input features must be in a projection that is appropriate for distance measurement, such as an equidistant projection.

    Learn more about coordinate systems and projections.

  • To visualize the FROM_X, FROM_Y, NEAR_X, and NEAR_Y locations, the output table can be used as input to the Make XY Event Layer or XY To Line tool.

Parameters

LabelExplanationData Type
Input Features

The input features that can be point, polyline, polygon, or multipoint type.

Feature Layer
Near Features

One or more feature layers or feature classes containing near feature candidates. The near features can be point, polyline, polygon, or multipoint. If multiple layers or feature classes are specified, the NEAR_FC field is added to the input table and will store the paths of the source feature class containing the nearest feature found. The same feature class or layer can be used as both input and near features.

Feature Layer
Search Radius
(Optional)

The radius used to search for near features. If no value is specified, all near features are considered. If a distance but no unit or unknown is specified, the units of the coordinate system of the input features are used. If the Geodesic option is used for the Method parameter, use a linear unit such as kilometers or miles.

Linear Unit
Location
(Optional)

Specifies whether x- and y-coordinates of the closest location of the near feature will be written to the NEAR_X and NEAR_Y fields.

  • Unchecked—Locations will not be written. This is the default.
  • Checked—Locations will be written.
Boolean
Angle
(Optional)

Specifies whether the near angle will be calculated and written to a NEAR_ANGLE field in the output table. A near angle measures direction of the line connecting an input feature to its nearest feature at their closest location. When the Planar method is used in the Method parameter, the angle is within the range of -180° to 180°, with 0° to the east, 90° to the north, 180° (or -180°) to the west, and -90° to the south. When the Geodesic method is used, the angle is within the range of -180° to 180°, with 0° to the north, 90° to the east, 180° (or -180°) to the south, and -90° to the west.

  • Unchecked—The NEAR_ANGLE field will not be added. This is the default.
  • Checked—The NEAR_ANGLE field will be added.
Boolean
Method
(Optional)

Specifies whether a shortest path will be used on a spheroid (geodesic) or a flat earth (planar) method. It is recommended that you use the Geodesic method with data stored in a coordinate system that is not appropriate for distance measurements (for example, Web Mercator or any geographic coordinate system) and any analysis that spans a large geographic area.

  • PlanarPlanar distances will be used between the features. This is the default.
  • GeodesicGeodesic distances will be used between features. This method takes into account the curvature of the spheroid and correctly deals with data near the dateline and poles.
String
Field Names
(Optional)

Specifies the names of the attribute fields that will be added during processing.

If this parameter is not used or any fields that will be added are excluded from this parameter, the default field names will be used.

By default, NEAR_FID and NEAR_DIST fields will always be added, NEAR_X and NEAR_Y fields will be added when the Location parameter (location in Python) is enabled, the NEAR_ANGLE field will be added when the Angle parameter (angle in Python) is enabled, and the NEAR_FC field will be added when multiple inputs are used.

Value Table

Derived Output

LabelExplanationData Type
Updated Input Features

The updated input features.

Feature Layer

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics