Summary
Returns the minimum, the maximum, and the average distance to the specified Nth nearest neighbor (N is an input parameter) for a set of features. Results are written as tool execution messages.
Illustration
Usage
Given a set of features, this tool returns three numbers: the minimum, the maximum, and the average distance to a specified number of neighbors (N). Example: if you specify 8 for the Neighbors parameter, this tool creates a list of distances between every feature and its 8th nearest neighbor; from this list of distances it then calculates the minimum, maximum, and average distance.
 The maximum value is the distance you would have to travel away from each feature to ensure every feature has at least N neighbors.
 The minimum value is the distance you would travel away from each feature to ensure that at least one feature has N neighbors.
 The average value is the average distance you would travel away from each feature to find its N nearest neighbors.
The output from this tool is written as messages to the Results window. Rightclick on the Messages entry and select View to see results in a Message dialog box.
Some tools, such as Hot Spot Analysis (GetisOrd Gi*) and Spatial Autocorrelation (Global Moran's I), allow you to specify a neighborhood Distance Band or Threshold Distance value. By using the Maximum Distance output value from this tool for the Distance Band or Threshold Distance parameter, you ensure every feature in the input feature class has at least N neighbors.
This tool provides one strategy for determining a Distance Band or Threshold Distance value to use with tools in the Spatial Statistics Toolbox such as Hot Spot Analysis (GetisOrd Gi*) or Cluster and Outlier Analysis (Local Moran's I). See Selecting a Fixed Distance for additional strategies.
The distances returned by this tool are in the units of the geoprocessing environment Output Coordinate System.
When the Input Feature Class is not projected (that is, when coordinates are given in degrees, minutes, and seconds) or when the output coordinate system is set to a Geographic Coordinate System, distances are computed using chordal measurements. Chordal distance measurements are used because they can be computed quickly and provide very good estimates of true geodesic distances, at least for points within about thirty degrees of each other. Chordal distances are based on an oblate spheroid. Given any two points on the earth's surface, the chordal distance between them is the length of a line, passing through the threedimensional earth, to connect those two points. Chordal distances are reported in meters.

For line and polygon features, feature centroids are used in distance computations. For multipoints, polylines, or polygons with multiple parts, the centroid is computed using the weighted mean center of all feature parts. The weighting for point features is 1, for line features is length, and for polygon features is area.
Syntax
CalculateDistanceBand_stats (Input_Features, Neighbors, Distance_Method)
Parameter  Explanation  Data Type 
Input_Features  The feature class or layer used to calculate distance statistics.  Feature Layer 
Neighbors  The number of neighbors (N) to consider for each feature. This number should be any integer between one and the total number of features in the feature class. A list of distances between each feature and its Nth neighbor is compiled, and the maximum, minimum, and average distances are output to the Results window.  Long 
Distance_Method  Specifies how distances are calculated from each feature to neighboring features.
 String 
Code sample
CalculateDistanceBandfromNeighborCount Example (Python Window)
The following Python Window script demonstrates how to use the CalculateDistanceBandfromNeighborCount tool.
import arcpy
arcpy.env.workspace = "c:/data"
mindist, avgdist, maxdist = arcpy.CalculateDistanceBand_stats("Blocks", 10, "EUCLIDEAN_DISTANCE")
CalculateDistanceBandfromNeighborCount Example (standalone Python script)
The following standalone Python script demonstrates how to use the CalculateDistanceBandfromNeighborCount tool.
# import module
import arcpy
# Set geoprocessing environment Workspace
arcpy.env.workspace = "c:/data"
# Set variables
infc = "Blocks"
field = "POP2000"
outfc = "PopHotSpots"
neighbors = 10
# Run the CalculateDistanceBand tool to get a distance for use with the Hot Spot tool from the tool result object
mindist, avgdist, maxdist = arcpy.CalculateDistanceBand_stats(infc, neighbors, "EUCLIDEAN_DISTANCE")
# Run the Hot Spot Analysis tool, using the maxdist output from the Calculate Distance Band tool as an input
arcpy.HotSpots_analysis(infc, field, outfc, "Fixed Distance Band", "EUCLIDEAN_DISTANCE", "None", maxdist)
Environments
Licensing information
 ArcGIS Desktop Basic: Yes
 ArcGIS Desktop Standard: Yes
 ArcGIS Desktop Advanced: Yes