# Central Feature (Spatial Statistics)

## Summary

Identifies the most centrally located feature in a point, line, or polygon feature class.

Learn more about how Central Feature works

## 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.

• This tool honors the 3D nature of your point data and will use x, y and z values in its calculations if z values are available. Since these results are 3D in nature, they will need to be visualized in a Scene. Be sure that you are running the analysis in a Scene or copy the result layer into a Scene for correct visualization of your analysis results.

• 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).

• ##### Caution:

When using shapefiles, keep in mind that they cannot store null values. Tools or other procedures that create shapefiles from nonshapefile inputs may store or interpret null values as zero. In some cases, nulls are stored as very large negative values in shapefiles. This can lead to unexpected results. See Geoprocessing considerations for shapefile output for more information.

## Parameters

 Label 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.Euclidean—The straight-line distance between two points (as the crow flies) Manhattan—The distance between two points measured along axes at right angles (city block); calculated by summing the (absolute) difference between the x- and y-coordinates 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

`arcpy.stats.CentralFeature(Input_Feature_Class, Output_Feature_Class, Distance_Method, {Weight_Field}, {Self_Potential_Weight_Field}, {Case_Field})`
 Name 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.EUCLIDEAN_DISTANCE—The straight-line distance between two points (as the crow flies) MANHATTAN_DISTANCE—The distance between two points measured along axes at right angles (city block); calculated by summing the (absolute) difference between the x- and y-coordinates 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

Output Coordinate System

Feature geometry is projected to the Output Coordinate System prior to analysis.

## Licensing information

• Basic: Yes
• Standard: Yes
• Advanced: Yes