Central Feature (Spatial Statistics)
Summary
Identifies the most centrally located feature in a point, line, or polygon feature class.
Illustration
Usage
-
The feature associated with the smallest accumulated distance to all other features in the dataset is the most centrally located feature; this feature is selected and copied to a newly created Output Feature Class.
-
Calculations based on either Euclidean or Manhattan distance require projected data to accurately measure distances.
-
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.
-
Map layers can be used to define the Input Feature Class. When using a layer with a selection, only the selected features are included in the analysis.
-
The Case Field is used to group features for separate Central Feature computations. The Case Field can be of integer, date, or string type.
-
Self-potential is the distance or weight between a feature and itself. Often this weight is zero, but in some cases you may want to specify another fixed value or a different value for every feature (perhaps based on polygon size, for example).
When using shapefiles, keep in mind that they cannot store null values. Tools or other procedures that create shapefiles from non-shapefile inputs may store or interpret null values as zero. This can lead to unexpected results. See also Geoprocessing considerations for shapefile output.
Syntax
Parameter | Explanation | Data Type |
Input_Feature_Class |
The feature class containing a distribution of features from which to identify the most centrally located feature. | Feature Layer |
Output_Feature_Class |
The feature class that will contain the most centrally located feature in the Input Feature Class. | Feature Class |
Distance_Method |
Specifies how distances are calculated from each feature to neighboring features.
| String |
Weight_Field (Optional) |
The numeric field used to weight distances in the origin-destination distance matrix. | Field |
Self_Potential_Weight_Field (Optional) |
The field representing self-potential—the distance or weight between a feature and itself. | Field |
Case_Field (Optional) |
Field used to group features for separate central feature computations. The case field can be of integer, date, or string type. | Field |
Code Sample
The following Python Window script demonstrates how to use the Central Feature tool.
import arcpy arcpy.env.workspace = r"C:\data" arcpy.CentralFeature_stats("coffee_shops.shp", "coffee_CENTRALFEATURE.shp", "EUCLIDEAN_DISTANCE", "NUM_EMP", "#", "#")
The following stand-alone Python script demonstrates how to use the Central Feature tool.
# Measure geographic distribution characteristics of coffee house locations weighted by the number of employees # Import system modules import arcpy # Local variables... workspace = "C:/data" input_FC = "coffee_shops.shp" CF_output = "coffee_CENTRALFEATURE.shp" MEAN_output = "coffee_MEANCENTER.shp" MED_output = "coffee_MEDIANCENTER.shp" weight_field = "NUM_EMP" try: # Set the workspace to avoid having to type out full path names arcpy.env.workspace = workspace # Process: Central Feature... arcpy.CentralFeature_stats(input_FC, CF_output, "EUCLIDEAN_DISTANCE", weight_field, "#", "#") # Process: Mean Center... arcpy.MeanCenter_stats(input_FC, MEAN_output, weight_field, "#", "#") # Process: Median Center... arcpy.MedianCenter_stats(input_FC, MED_output, weight_field, "#", "#") except: # If an error occurred when running the tool, print out the error message. print arcpy.GetMessages()
Environments
- Output Coordinate System
Feature geometry is projected to the Output Coordinate System prior to analysis.