Hot Spot Analysis (Getis-Ord Gi*) (Spatial Statistics)

License Level:BasicStandardAdvanced

Summary

Given a set of weighted features, identifies statistically significant hot spots and cold spots using the Getis-Ord Gi* statistic.

Learn more about how Hot Spot Analysis (Getis-Ord Gi*) works

Illustration

Hot Spot Analysis illustration

Usage

Syntax

HotSpots_stats (Input_Feature_Class, Input_Field, Output_Feature_Class, Conceptualization_of_Spatial_Relationships, Distance_Method, Standardization, {Distance_Band_or_Threshold_Distance}, {Self_Potential_Field}, {Weights_Matrix_File})
ParameterExplanationData Type
Input_Feature_Class

The feature class for which hot spot analysis will be performed.

Feature Layer
Input_Field

The numeric count field (number of victims, crimes, jobs, and so on) to be evaluated.

Field
Output_Feature_Class

The output feature class to receive the z-score and p-value results.

Feature Class
Conceptualization_of_Spatial_Relationships

Specifies how spatial relationships among features are conceptualized.

  • INVERSE_DISTANCENearby neighboring features have a larger influence on the computations for a target feature than features that are far away.
  • INVERSE_DISTANCE_SQUAREDSame as INVERSE_DISTANCE except that the slope is sharper, so influence drops off more quickly, and only a target feature's closest neighbors will exert substantial influence on computations for that feature.
  • FIXED_DISTANCE_BANDEach feature is analyzed within the context of neighboring features. Neighboring features inside the specified critical distance receive a weight of 1 and exert influence on computations for the target feature. Neighboring features outside the critical distance receive a weight of zero and have no influence on a target feature's computations.
  • ZONE_OF_INDIFFERENCEFeatures within the specified critical distance of a target feature receive a weight of 1 and influence computations for that feature. Once the critical distance is exceeded, weights (and the influence a neighboring feature has on target feature computations) diminish with distance.
  • CONTIGUITY_EDGES_ONLYOnly neighboring polygon features that share a boundary or overlap will influence computations for the target polygon feature.
  • CONTIGUITY_EDGES_CORNERSPolygon features that share a boundary, share a node, or overlap will influence computations for the target polygon feature.
  • GET_SPATIAL_WEIGHTS_FROM_FILESpatial relationships are defined in a spatial weights file. The path to the spatial weights file is specified in the Weights Matrix File parameter.
String
Distance_Method

Specifies how distances are calculated from each feature to neighboring features.

  • EUCLIDEAN_DISTANCEThe straight-line distance between two points (as the crow flies)
  • MANHATTAN_DISTANCEThe distance between two points measured along axes at right angles (city block); calculated by summing the (absolute) difference between the x- and y-coordinates
String
Standardization

Row standardization has no impact on this tool: results from Hot Spot Analysis (the Getis-Ord Gi* statistic) would be identical with or without row standardization. The parameter is disabled; it remains as a tool parameter only to support backwards compatibility.

  • NONENo standardization of spatial weights is applied.
  • ROWDisabled.
String
Distance_Band_or_Threshold_Distance
(Optional)

Specifies a cutoff distance for Inverse Distance and Fixed Distance options. Features outside the specified cutoff for a target feature are ignored in analyses for that feature. However, for Zone of Indifference, the influence of features outside the given distance is reduced with distance, while those inside the distance threshold are equally considered. The distance value entered should match that of the output coordinate system.

For the Inverse Distance conceptualizations of spatial relationships, a value of 0 indicates that no threshold distance is applied; when this parameter is left blank, a default threshold value is computed and applied. This default value is the Euclidean distance that ensures every feature has at least one neighbor.

This parameter has no effect when Polygon Contiguity or Get Spatial Weights From File spatial conceptualizations are selected.

Double
Self_Potential_Field
(Optional)

The field representing self potential: the distance or weight between a feature and itself.

Field
Weights_Matrix_File
(Optional)

The path to a file containing weights that define spatial, and potentially temporal, relationships among features.

File

Code Sample

HotSpotAnalysis example 1 (Python window)

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

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.HotSpots_stats("911Count.shp", "ICOUNT", "911HotSpots.shp","GET_SPATIAL_WEIGHTS_FROM_FILE","EUCLIDEAN_DISTANCE", "NONE","#", "#", "euclidean6Neighs.swm")
HotSpotAnalysis example 2 (stand-alone Python script)

The following stand-alone Python script demonstrates how to use the HotSpotAnalysis 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 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()

Environments

Output Coordinate System

Feature geometry is projected to the Output Coordinate System prior to analysis, so values entered for the Distance Band/Threshold Distance parameter should match those specified in the Output Coordinate System. All mathematical computations are based on the Output Coordinate System spatial reference.

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
4/18/2013