Point Distance (Analysis)

License Level:BasicStandardAdvanced

Summary

Determines the distances from input point features to all points in the near features within a specified search radius.

Learn more about how proximity is calculated in geoprocessing tools

Illustration

Point Distance illustration

Usage

Syntax

PointDistance_analysis (in_features, near_features, out_table, {search_radius})
ParameterExplanationData Type
in_features

The point features from which distances to the near features will be calculated.

Feature Layer
near_features

The points to which distances from the input features will be calculated. Distances between points within the same feature class or layer can be determined by specifying the same feature class or layer for the input and near features.

Feature Layer
out_table

The table containing the list of input features and information about all near features within the search radius. If a search radius is not specified, distances from all input features to all near features are calculated.

Table
search_radius
(Optional)

Specifies the radius used to search for candidate near features. The near features within this radius are considered for calculating the nearest feature. If no value is specified (that is, the default (empty) radius is used) all near features are considered for calculation. The unit of search radius defaults to units of the input features. The units can be changed to any other unit. However, this has no impact on the units of the output DISTANCE field which is based on the units of the coordinate system of the input features.

Linear unit

Code Sample

PointDistance example 1 (Python window)

The following Python interactive window script demonstrates how to use the PointDistance function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data/pointdistance.gdb"
  
arcpy.PointDistance_analysis("police_stations", "crime_location", "crime_distances")
PointDistance example 2 (stand-alone Python script)

The following Python script demonstrates how to use the PointDistance function in a stand-alone script.

# Description: Finds distance of each near point from each input point and outputs to a table.
  
# import system modules
import arcpy
  
# set workspace environment
arcpy.env.workspace = "C:/data/pointdistance.gdb"
  
# set variables
in_features = "police_stations"
near_features = "crime_location"
out_table = "crime_distance4"
search_radius = "22000 Feet"
  
try:
    # find crime locations within the search radius
    arcpy.PointDistance_analysis(in_features, near_features, out_table, search_radius)
    print arcpy.GetMessages(0)
    
except arcpy.ExecuteError:
    print arcpy.GetMessages(2)
    
except Exception as ex:
    print ex.args[0]

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: No
ArcGIS for Desktop Advanced: Yes
3/3/2014