Recopilar eventos (Estadística espacial)

Nivel de licencia:BasicStandardAdvanced

Resumen

Convierte datos de eventos, como incidentes de delitos o enfermedades, en datos de punto ponderado.

Ilustración

Ilustración de la herramienta Adquirir eventos

Uso

Sintaxis

CollectEvents_stats (Input_Incident_Features, Output_Weighted_Point_Feature_Class)
ParámetroExplicaciónTipo de datos
Input_Incident_Features

Las entidades que representan datos de eventos o incidentes.

Feature Layer
Output_Weighted_Point_Feature_Class

La clase de entidad de salida que contendrá los datos de punto ponderado.

Feature Class

Ejemplo de código

Ejemplo de CollectEvents (ventana de Python)

La siguiente secuencia de comandos de la ventana de Python muestra cómo utilizar la herramienta Adquirir eventos.

import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.CollectEvents_stats("911Copied.shp", "911Count.shp", "Count", "#")
Ejemplo de CollectEvents (secuencia de comandos de Python independiente)

La siguiente secuencia de comandos de Python independiente muestra cómo utilizar la herramienta Adquirir eventos.

# 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.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]", "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()

Entornos

Temas relacionados

Información sobre licencias

ArcGIS for Desktop Basic: Sí
ArcGIS for Desktop Standard: Sí
ArcGIS for Desktop Advanced: Sí
5/10/2014