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

# Generate Near Table (Analysis) (ArcInfo only)

Release 9.3

Print all topics in : "Tools"

Related Topics

NOTE: This topic was updated for 9.3.1.

Determines the distance from each feature in the Input Features to the nearest features in the Near Features, within the Search Radius. The results are recorded in the output table.

Illustration

Usage tips

• This tool behaves the same as NEAR, but it will be required to create a new output table. The table will contain the INPUT_FID and NEAR_FID and other attributes such as NEAR_XY, NEAR_ANGLE, and NEAR_FC if necessary. The input features will not be updated with this tool.

• The output table can be joined back to the input feature class or a near feature class using the original FIDs.

• The <in_features> and <near_features> support any geometry feature types:

• POINT
• POLYLINE
• POLYGON
• MULTIPOINT

• The default option for this tool is to output only the closest features. However, the user can choose the ALL option to create the table containing all the near features within the search radius.

• The values for NEAR_DIST will be -1 if no match is found within the 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 input feature to the closest near feature will be used.

• If the Near Features are polylines, the distance is calculated from the location on the polyline closest to the Input Feature. If a polyline in the Near Features touches or intersects a feature from the Input Features, the distance will be zero.

• If the Near Features is a Polygon feature class, the distance is calculated from a point on the boundary of the polygon closest to the Input Feature. If a polygon in the Near Features contains or intersects a feature from the Input Features, the distance will be zero.

• 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. However, the value for the NEAR_DIST will be based on the units of the input.

• 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.

• Both the Input Features and Near Features can be the same dataset. In any instance where the Input Feature and Near feature are the same, the result will be calculated to -1.

• The following environment affects this tool: Extent.

Command line syntax
An overview of the Command Line window
GenerateNearTable_analysis <in_features> <near_features> <out_table> {search_radius} {NO_LOCATION | LOCATION} {NO_ANGLE | ANGLE} {CLOSEST | ALL} {closest_count}

 Parameter Explanation Data Type The feature class or layer containing features from which near distances are calculated to each feature in the Near Features. Feature Layer The feature class or layer containing features from which distances are calculated to the closest feature in the Input Features. If multiple feature classes or layers are specified, an extra field named NEAR_FC will be added to the output table to identify which near feature class contains the closest feature. Feature Layer The output table that will contain the proximity information such as INPUT_FID, NEAR_FID, and NEAR_DIST and other attributes such as NEAR_XY, NEAR_ANGLE, and NEAR_FC if necessary. Table {search_radius} The maximum distance between Input Features and Near Features for which distance and FIDs will be determined. If no Search Radius is specified, all Near Features will be used. Linear unit {NO_LOCATION | LOCATION} Determines whether the x,y coordinates of the nearest feature are added to the output table 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 — Additional fields named NEAR_X and NEAR_Y will be added to the output table. These fields will contain the x- and y-coordinates of the Near Features. Boolean {NO_ANGLE | ANGLE} Determines whether the angle between the near feature will be calculated and stored in the NEAR_ANGLE field. The angle value is 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. NO_ANGLE — The angle between the nearest point will not be saved. This is the default. ANGLE — A field named NEAR_ANGLE will be added to the output table and will contain the angle from the Input to the nearest point on the Near Feature. Boolean {CLOSEST | ALL} Determines whether to locate and return only the closest features or return all the features within the search radius. CLOSEST — Locate and return only the closest features from the Near Features to the Input Features within the search radius. This is the default. ALL — Locate and return all features from the Near Features to the Input Features within the search radius. Boolean {closest_count} Finds only the specified number of closest features. This parameter is disabled if Find only closest feature is selected. Long
Data types for geoprocessing tool parameters

### Command line example

`GenerateNearTable_analysis D:\Workspace\wells.shp D:\Workspace\seis.shp D:\Workspace\NearestSeis.dbf 25000 LOCATION ANGLE CLOSEST`

Scripting syntax
About getting started with writing geoprocessing scripts
GenerateNearTable_analysis (in_features, near_features, out_table, search_radius, location, angle, closest, closest_count)

 Parameter Explanation Data Type in_features (Required) The feature class or layer containing features from which near distances are calculated to each feature in the Near Features. Feature Layer near_features (Required) The feature class or layer containing features from which distances are calculated to the closest feature in the Input Features. If multiple feature classes or layers are specified, an extra field named NEAR_FC will be added to the output table to identify which near feature class contains the closest feature. Feature Layer out_table (Required) The output table that will contain the proximity information such as INPUT_FID, NEAR_FID, and NEAR_DIST and other attributes such as NEAR_XY, NEAR_ANGLE, and NEAR_FC if necessary. Table search_radius (Optional) The maximum distance between Input Features and Near Features for which distance and FIDs will be determined. If no Search Radius is specified, all Near Features will be used. Linear unit location (Optional) Determines whether the x,y coordinates of the nearest feature are added to the output table 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 — Additional fields named NEAR_X and NEAR_Y will be added to the output table. These fields will contain the x- and y-coordinates of the Near Features. Boolean angle (Optional) Determines whether the angle between the near feature will be calculated and stored in the NEAR_ANGLE field. The angle value is 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. NO_ANGLE — The angle between the nearest point will not be saved. This is the default. ANGLE — A field named NEAR_ANGLE will be added to the output table and will contain the angle from the Input to the nearest point on the Near Feature. Boolean closest (Optional) Determines whether to locate and return only the closest features or return all the features within the search radius. CLOSEST — Locate and return only the closest features from the Near Features to the Input Features within the search radius. This is the default. ALL — Locate and return all features from the Near Features to the Input Features within the search radius. Boolean closest_count (Optional) Finds only the specified number of closest features. This parameter is disabled if Find only closest feature is selected. Long

Data types for geoprocessing tool parameters

### Script example

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

gp.workspace = "D:/Workspace"
gp.generateneartable("wells.shp", "seismic.shp", "nearestseis.dbf", "25000", "LOCATION", "ANGLE", "CLOSEST")
```

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