Collect Events (Spatial Statistics)

Summary

Converts event data, such as crime or disease incidents, to weighted point data.

Illustration

Collect Events tool illustration

Usage

  • Collect Events combines coincident points: it creates a new Output Feature Class containing all of the unique locations found in the Input Feature Class. It then adds a field named ICOUNT to hold the sum of all incidents at each unique location.

  • This tool will only combine features that have the exact same X and Y centroid coordinates. You may want to use the Integrate tool to snap nearby features together prior to running the Collect Events tool.

    Caution:

    The Integrate tool permanently alters feature geometry; always make a backup copy of your feature class prior to using Integrate.

  • The Hot Spot Analysis (Getis-Ord Gi*), Cluster and Outlier Analysis (Local Moran's I), and Spatial Autocorrelation (Morans I) tools, for example, require weighted points rather than individual incidents. Collect Events can be used to create weights when the input feature class contains coincident features.

  • Although this tool will work with polygon or line data, it is really only appropriate for event, incident, or other point feature data. For line and polygon features, feature coincidence is based on feature true geometric centroids. For multipoint, polyline, 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.

  • When the Input Feature Class is not projected (that is, when coordinates are given in degrees, minutes, and seconds) or when the output coordinate system is set to a Geographic Coordinate System, distances are computed using chordal measurements. Chordal distance measurements are used because they can be computed quickly and provide very good estimates of true geodesic distances, at least for points within about thirty degrees of each other. Chordal distances are based on an oblate spheroid. Given any two points on the earth's surface, the chordal distance between them is the length of a line, passing through the three-dimensional earth, to connect those two points. Chordal distances are reported in meters.

    Caution:

    Be sure to project your data if your study area extends beyond 30 degrees. Chordal distances are not a good estimate of geodesic distances beyond 30 degrees.

  • If you want each individual point/part of multipoint/multipart data treated as singlepart features, run the Multipart to Singlepart tool, then run Collect Events on the single part feature class. For more information, see Processing Multipoint Data.

  • In addition to the Output Feature Class, this function passes, as derived output values, the name of the count field and the maximum count value encountered for any one location. These derived output values are helpful when you use this tool in models or scripts.

  • When this tool runs in ArcMap, the output feature class is automatically added to the Table of Contents (TOC) with default rendering applied to the ICOUNT field. The graduated circle rendering is defined by a layer file in <ArcGIS Pro>\Resources\ArcToolBox\Templates\Layers. You can reapply the default rendering, if needed, by re-applying the layer symbology.

Syntax

CollectEvents(Input_Incident_Features, Output_Weighted_Point_Feature_Class)
ParameterExplanationData Type
Input_Incident_Features

The features representing event or incident data.

Feature Layer
Output_Weighted_Point_Feature_Class

The output feature class to contain the weighted point data.

Feature Class

Derived Output

NameExplanationData Type
Results_Field

The name of the count field

Field
Z_Max_Value

The maximum count value encountered for any one location.

Double

Code sample

CollectEvents example 1 (Python window)

The following Python window script demonstrates how to use the CollectEvents tool.

import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.CollectEvents_stats("911Copied.shp", "911Count.shp", "Count", "#")
CollectEvents example 2 (stand-alone script)

The following stand-alone Python script demonstrates how to use the CollectEvents tool.

# 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 property to overwrite existing output, by default
arcpy.env.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")

    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.CollectEvents_stats("911Copied.shp", "911Count.shp", "Count", "#")

    # 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!", "PYTHON")

    # 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 arcpy.ExecuteError:
    # If an error occurred when running the tool, print out the error message.
    print(arcpy.GetMessages())

Environments

Output Coordinate System

Feature geometry is projected to the Output Coordinate System prior to analysis. All mathematical computations are based on the Output Coordinate System spatial reference.

Licensing information

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

Related topics