# Mean Center (Spatial Statistics)

Identifies the geographic center (or the center of concentration) for a set of features.

Learn about how Mean Center works

## Usage tips

• Calculations based on either Euclidean or Manhattan distance require projected data to accurately measure distances.

• The mean center is a point constructed from the average x and y values for the input feature centroids.

• If a case field is specified, the input features are grouped according to case field values, and a mean center is calculated from the average x and y values for the centroids in each group.

• The x and y values for the mean center feature()s are attributes in the output feature class. The values are stored in the fields XCOORD and YCOORD.

• For line and polygon features, true geometric centroids are calculated before the mean center is computed.

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

• Current map layers may be used to define the input feature class. When using layers, only the currently selected features are included in the analysis.

## Syntax

MeanCenter_stats (Input_Feature_Class, Output_Feature_Class, Weight_Field, Case_Field, Dimension_Field)
Parameter Explanation Datatype
Input Feature Class (Required)

A feature class for which the mean center will be calculated.

Feature Layer
Output Feature Class (Required)

A point feature class that will contain the features representing the mean centers of the input feature class.

Feature Class
Weight Field (Optional)

The numeric field used to create a weighted mean center.

Field
Case Field (Optional)

Field used to group features for separate mean center calculations. The case field can be of numeric, date, or string type.

Field
Dimension Field (Optional)

A numeric field containing attribute values from which an average value will be calculated.

Field
Data types for geoprocessing tool parameters

Script Example

```# Measure geographic distribution characteristics of coffee house locations weighted by the number of employees

# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Local variables...
workspace = "C:/data"
input_FC = "coffee_shops.shp"
CF_output = "coffee_CF.shp"
MC_output = "coffee_MC.shp"
weight_field = "NUM_EMP"

try:
# Set the workspace to avoid having to type out full path names
gp.workspace = workspace

# Process: Central Feature...
gp.CentralFeature_stats(input_FC, CF_output, "Euclidean Distance", weight_field, "#", "#")

# Process: Mean Center...
gp.MeanCenter_stats(input_FC, MC_output, weight_field, "#", "#")

except:
# If an error occurred when running the tool, print out the error message.
print gp.GetMessages()

```