收集事件并渲染 (空间统计)

许可等级:BasicStandardAdvanced

摘要

首先将事件数据转换为加权点数据,然后使用分级圆圈对生成的计数字段进行渲染。

法律声明法律声明:

由于 ArcGIS 新特性中允许脚本和模型工具的输出与默认渲染相关联,此工具将在 ArcGIS 10.1 之后的版本中弃用

插图

Collect Events illustration

用法

语法

CollectEventsRendered_stats (Input_Incident_Features, Output_Layer, Output_Weighted_Point_Feature_Class)
参数说明数据类型
Input_Incident_Features

表示事件或事件点数据的要素。

Feature Layer
Output_Layer

用于存储分级圆圈渲染信息的图层文件 (.lyr)。

Layer File
Output_Weighted_Point_Feature_Class

包含加权点数据的输出要素类。

Feature Class

代码实例

收集事件并渲染示例(Python 窗口)

以下 Python 窗口脚本演示了“收集事件并渲染”工具的使用方法。

import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.CollectEventsRendered_stats("911.shp", "911Count_rendered.lyr", "911Count.shp")
收集事件并渲染示例(独立 Python 脚本)

以下独立 Python 脚本演示了“收集事件并渲染”工具的使用方法。

# Analyze the spatial distribution of 911 calls in a metropolitan area
# using the Hot-Spot Analysis Tool (Local Gi*)

# Import system modules
import arcpy

# Set geoprocessor object property to overwrite existing output, by default
arcpy.gp.overwriteOutput = True

# Local variables...
workspace = "C:/Data"

try:
    # Set the current workspace (to avoid having to specify the full path to the feature classes each time)
    arcpy.env.workspace = workspace

    # Copy the input feature class and integrate the points to snap
    # together at 500 feet
    # Process: Copy Features and Integrate
    cf = arcpy.CopyFeatures_management("911Calls.shp", "911Copied.shp",
                         "#", 0, 0, 0)

    integrate = arcpy.Integrate_management("911Copied.shp #", "500 Feet")

    # Use Collect Events to count the number of calls at each location
    # Process: Collect Events
    ce = arcpy.CollectEventsRendered_stats("911Copied.shp", "911Count_rendered.lyr", "911Count.shp")

    # Add a unique ID field to the count feature class
    # Process: Add Field and Calculate Field
    af = arcpy.AddField_management("911Count.shp", "MyID", "LONG", "#", "#", "#", "#",
                     "NON_NULLABLE", "NON_REQUIRED", "#",
                     "911Count.shp")
    
    cf = arcpy.CalculateField_management("911Count.shp", "MyID", "[FID]", "VB")

    # Create Spatial Weights Matrix for Calculations
    # Process: Generate Spatial Weights Matrix... 
    swm = arcpy.GenerateSpatialWeightsMatrix_stats("911Count.shp", "MYID",
                        "euclidean6Neighs.swm",
                        "K_NEAREST_NEIGHBORS",
                        "#", "#", "#", 6,
                        "NO_STANDARDIZATION") 

    # Hot Spot Analysis of 911 Calls
    # Process: Hot Spot Analysis (Getis-Ord Gi*)
    hs = arcpy.HotSpots_stats("911Count.shp", "ICOUNT", "911HotSpots.shp", 
                     "GET_SPATIAL_WEIGHTS_FROM_FILE",
                     "EUCLIDEAN_DISTANCE", "NONE",
                     "#", "#", "euclidean6Neighs.swm")

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: 是
5/10/2014