Calculate Distance Band from Neighbor Count (Spatial Statistics)
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 accessible from the Results window.
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. Right-click on the Messages entry and select View to see results in a Message dialog box.
Some tools, such as Hot Spot Analysis (Getis-Ord 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 (Getis-Ord 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.
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.
The feature class or layer used to calculate distance statistics.
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.
Specifies how distances are calculated from each feature to neighboring features.
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")
The following stand-alone 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)
- Output Coordinate System
Feature geometry is projected to the Output Coordinate System prior to analysis. All mathematical computations are based on the Output Coordinate System spatial reference.