平均中心 (空间统计)

许可等级:BasicStandardAdvanced

摘要

识别一组要素的地理中心(或密度中心)。

了解有关“平均中心”工作原理的详细信息

插图

Mean Center illustration

用法

语法

MeanCenter_stats (Input_Feature_Class, Output_Feature_Class, {Weight_Field}, {Case_Field}, {Dimension_Field})
参数说明数据类型
Input_Feature_Class

将对其计算平均中心的要素类。

Feature Layer
Output_Feature_Class

将包含用于表示输入要素类的平均中心的要素的点要素类。

Feature Class
Weight_Field
(可选)

用于创建加权平均中心的数字字段。

Field
Case_Field
(可选)

用于对要素进行分组以独立计算平均中心的字段。案例分组字段可以为整型、日期型或字符串型。

Field
Dimension_Field
(可选)

此数字字段包含一些计算平均值时所根据的属性值。

Field

代码实例

MeanCenter 示例(Python 窗口)

以下 Python 窗口脚本演示了如何使用 MeanCenter 工具。

import arcpy
arcpy.env.workspace = r"C:\data"
arcpy.MeanCenter_stats("coffee_shops.shp", "coffee_MEANCENTER.shp", "NUM_EMP", "#", "#")
MeanCenter 示例(独立 Python 脚本)

以下独立 Python 脚本演示了如何使用 MeanCenter 工具。

# 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()

环境

输出坐标系

在进行分析之前将要素几何投影到输出坐标系。所有数学计算都基于输出坐标系空间参考

相关主题

许可信息

ArcGIS for Desktop Basic:是
ArcGIS for Desktop Standard:是
ArcGIS for Desktop Advanced:是
9/15/2013