Find Space Time Matches (Crime Analysis and Safety)

Summary

Identifies matches between two feature classes based on proximity, time extent, or both.

Usage

  • The output feature classes will contain all features from input feature classes that meet the match criteria. A single feature from either input feature class can match more than one other feature. In this case, the feature is copied to the output as many times as necessary to preserve unique feature matches.

  • Empty output feature classes will be created when no matches are found in any input features.

  • The input features and fields are carried over to the output feature classes.

  • When Space and time or Time only is specified for the Output Match Types parameter, the input feature classes must contain a date field.

  • The following fields will be added to the output:

    • MATCHID—The identifier value that defines the relationship of the output feature classes. This field can be used to create a one-to-one relationship between the output feature classes.
    • MATCHTYPE—A value assigned to each feature that describes the type of match criteria between the input features.
      • B—Both input features are within proximity of each other during the same time frame, for example, a call occurred on Phone 2 within 1000 feet and 30 minutes of a call occurring on Phone 1. This is a Space and time match type.
      • S—Both input features are within proximity of each other, for example, a call occurred on Phone 2 within 1000 feet of Phone 1 but not within the 30-minute time extent. This is a Space only match type.
      • T—Both input features are within the time frame, for example, a call occurred on Phone 2 within 30 minutes of a call occurring on Phone 1 but not within 1000 feet. This is a Time only match type.

Syntax

FindSpaceTimeMatches(in_primary_features, in_comparison_features, out_primary_feature_class, out_comparison_feature_class, match_types, {search_radius}, {temporal_search_radius}, {primary_start_date_field}, {comparison_start_date_field}, {primary_end_date_field}, {comparison_end_date_field})
ParameterExplanationData Type
in_primary_features

The primary input feature class.

Feature Layer
in_comparison_features

The comparison input feature class.

Feature Layer
out_primary_feature_class

The output feature class containing features from the input primary features where output match types occurred.

Feature Class
out_comparison_feature_class

The output feature class containing features from input comparison features where output match types occurred.

Feature Class
match_types
[match_types,...]

Specifies the types of matches to compare.

  • SPACE_AND_TIMEMatches based on both the time extent and proximity defined in the temporal and spatial search radius will be compared, for example, 25 meters and 10 minutes.
  • SPACE_ONLYMatches based only on the proximity defined in the spatial search radius will be compared, for example, 25 meters.
  • TIME_ONLYMatches based only on the time extent defined in the temporal search radius will be compared, for example, 10 minutes.
String
search_radius
(Optional)

The radius used to search between input feature classes.

Linear Unit
temporal_search_radius
(Optional)

The time extent used to search between input feature classes.

Time Unit
primary_start_date_field
(Optional)

The primary start date and time field of the input primary features.

Field
comparison_start_date_field
(Optional)

The comparison start date and time field of the input comparison features.

Field
primary_end_date_field
(Optional)

The primary end date and time field of the input primary features. When specified, the time range defined by the start and end date and the temporal search radius will be used to search comparison features. The temporal search radius can be set to 0 to compare only the time defined by the feature's time range.

Field
comparison_end_date_field
(Optional)

The comparison end date and time field of the input comparison features. When specified, the time range defined by the start and end date and the temporal search radius will be used to evaluate relationships with primary features. The temporal search radius can be set to 0 to compare only the time defined by the feature's time range.

Field

Code sample

FindSpaceTimeMatches example 1 (Python window)

The following script demonstrates how to use the FindSpaceTimeMatches function in immediate mode.

import arcpy
arcpy.env.workspace = r"C:/data/city_pd.gdb"
arcpy.ca.FindSpaceTimeMatches("CDR_Phone_1_Sites",
                            "CDR_Phone_2_Sites",
                            "CDR_Phone_1_Sites_Matches",
                            "CDR_Phone_2_Sites_Matches",
                            "SPACE_AND_TIME",
                            "1000 Meters",
                            "30 Minutes",
                            "starttime",
                            "starttime",
                            "endtime",
                            "endtime")
FindSpaceTimeMatches example 2 (stand-alone script)

The following script demonstrates how to use the FindSpaceTimeMatches function in a stand-alone script.

# Description: Use the FindSpaceTimeMatches function to create two feature 
#              classes with matches based on proximity, time extent, or both 
#              proximity and time extent.

# Import required modules
import arcpy

# Set environment settings
arcpy.env.workspace = r"C:\data\city_pd.gdb"

# Set local variables
in_primary_features = "CDR_Phone_1_Sites"
in_comparison_features = "CDR_Phone_2_Sites"
out_primary_feature_class = "CDR_Phone_1_Sites_Matches"
out_comparison_feature_class = "CDR_Phone_2_Sites_Matches"
match_types = ["SPACE_AND_TIME","SPACE_ONLY","TIME_ONLY"]
search_radius = "1000 Meters"
temporal_search_radius = "30 Minutes"
primary_start_date_field = "starttime"
comparison_start_date_field = "starttime"
primary_end_date_field = "endtime"
comparison_end_date_field = "endtime"

# Execute the FindSpaceTimeMatches tool
arcpy.ca.FindSpaceTimeMatches(in_primary_features,
                              in_comparison_features,
                              out_primary_feature_class,
                              out_comparison_feature_class,
                              match_types,
                              search_radius,
                              temporal_search_radius,
                              primary_start_date_field ,
                              comparison_start_date_field,
                              primary_end_date_field,
                              comparison_end_date_field)

Licensing information

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

Related topics