You are here:
Geoprocessing tool reference > Analysis toolbox > Proximity toolset > Tools

# Near (Analysis) (ArcInfo only)

Release 9.2

Print all topics in : "Tools"

Related Topics

Determines the distance from each point in the Input Features to the nearest point or polyline in the Near Features, within the Search Radius.

Illustration

Usage tips

• The results are recorded in the Input Features attribute table. Fields for distance and feature ID of the closest feature are added or updated. The field names are NEAR_DIST and NEAR_FID.

• The values for NEAR_DIST will be zero if no match is found within the specified Search Radius.

• The values for NEAR_FID will be -1 if no match is found within the specified Search Radius.

• If the fields NEAR_DIST and NEAR_FID already exist, the values will be recalculated.

• If no Search Radius is specified, a radius large enough to calculate a distance from each point in the Input Features to the closest point or polyline in the Near Features will be used.

• The calculated distance from a point to a line will be from the point to the nearest location along the line.

• The distances calculated by Near are determined by the units of the Input Features. If the linear units of the input feature class are in Meters, the search radius will default to Meters. The units of the Search Radius can be changed. Specifying one kilometer is the same as entering one thousand meters.

• Fields for x and y coordinates are added when Location is checked, and a field for ANGLE is added when Angle is checked.

• Angles are measured in degrees, where one degree represents 1/360 of a circle, and fractions of a degree are represented as decimal points. Angles are measured from 180° to -180° ; 0° to the east, 90° to the north, 180° (-180° ) to the west, and -90° to the south.

• Near is useful for assigning attributes to nearest lines or points. For example, when assigning address ranges to lines or searching for the closest sewer line in a sewage network for a specific property.

• The following environment affects this tool: Extent.

Command line syntax
An overview of the Command Line window
Near_analysis <in_features> <near_features> {search_radius} {NO_LOCATION | LOCATION} {NO_ANGLE | ANGLE}

 Parameter Explanation Data Type The feature class or layer containing points from which distances are calculated to each closest polyline or point in the Near Features. Feature Layer The feature class or layer containing points or polylines whose features are used to calculate distances from each point in the Input Features. Feature Layer {search_radius} The maximum distance between Input Features and Near Features for which distance and FID will be determined. Linear unit {NO_LOCATION | LOCATION} Determines whether the x,y coordinates of the nearest feature are added to the Input Features, as well as NEAR_FID and NEAR_DIST. The new fields are NEAR_X and NEAR_Y. NO_LOCATION — The x,y coordinates or the nearest point are not saved. This is the default. LOCATION — The x,y coordinates of the nearest point, NEAR_FID, and NEAR_DIST will be saved. Boolean {NO_ANGLE | ANGLE} Determines whether the angle between the near feature will be saved, as well as NEAR_FID and NEAR_DIST. NO_ANGLE — The angle between the nearest point will not be saved. This is the default. ANGLE — The angle between the nearest point will be saved. Boolean
Data types for geoprocessing tool parameters

### Command line example

`Near_analysis D:\Workspace\wells.shp D:\Workspace\seis.shp 25000 LOCATION ANGLE`

Scripting syntax
About getting started with writing geoprocessing scripts
Near_analysis (in_features, near_features, search_radius, location, angle)

 Parameter Explanation Data Type in_features (Required) The feature class or layer containing points from which distances are calculated to each closest polyline or point in the Near Features. Feature Layer near_features (Required) The feature class or layer containing points or polylines whose features are used to calculate distances from each point in the Input Features. Feature Layer search_radius (Optional) The maximum distance between Input Features and Near Features for which distance and FID will be determined. Linear unit location (Optional) Determines whether the x,y coordinates of the nearest feature are added to the Input Features, as well as NEAR_FID and NEAR_DIST. The new fields are NEAR_X and NEAR_Y. NO_LOCATION — The x,y coordinates or the nearest point are not saved. This is the default. LOCATION — The x,y coordinates of the nearest point, NEAR_FID, and NEAR_DIST will be saved. Boolean angle (Optional) Determines whether the angle between the near feature will be saved, as well as NEAR_FID and NEAR_DIST. NO_ANGLE — The angle between the nearest point will not be saved. This is the default. ANGLE — The angle between the nearest point will be saved. Boolean

Data types for geoprocessing tool parameters

### Script example

```import arcgisscripting
gp = arcgisscripting.create()

gp.workspace = "D:/Workspace"
gp.toolbox = "analysis"
gp.near("wells.shp", "seismic.shp", "25000", "LOCATION", "ANGLE")```

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.