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. It is possible to have more than one feature sharing the smallest accumulated distance to all other features. When this happens, all of these most centrally located features are copied to the Output Feature Class.
Accumulated distances are measured using EUCLIDEAN_DISTANCE or MANHATTAN_DISTANCE, as specified by the Distance Method parameter.
-
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. Records with null values for the Case Field will be excluded from the analysis.
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).
Syntax
arcpy.stats.CentralFeature(Input_Feature_Class, Output_Feature_Class, Distance_Method, {Weight_Field}, {Self_Potential_Weight_Field}, {Case_Field})
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
CentralFeature example 1 (Python window)
The following Python window script demonstrates how to use the CentralFeature function.
import arcpy
arcpy.env.workspace = r"C:\data"
arcpy.CentralFeature_stats("coffee_shops.shp", "coffee_CENTRALFEATURE.shp",
"EUCLIDEAN_DISTANCE", "NUM_EMP")
CentralFeature example 2 (stand-alone script)
The following stand-alone Python script demonstrates how to use the CentralFeature function.
# 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"
# 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)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes