Join Features (GeoAnalytics)

Summary

Joins attributes from one layer to another based on spatial, temporal, or attribute relationships, or a combination of those relationships.

Illustration

Join Features tool example
Both examples show a spatiotemporal join using the Join Features tool.

Usage

  • A spatial join matches features (rows) from the input features (the Target Layer and Join Layer parameters) based on their spatial locations. A temporal join matches features (rows) from the input features based on their temporal relationships. An attribute join matches features based on field values.

  • You can join features based on a spatial relationship, a temporal relationship, an attribute relationship, or a combination of the three.

    OptionsDescription

    Spatial Relationship

    The spatial relationship that will determine whether features are joined to each other. The available relationships depend on the geometry type (point, line, or area) of the layers being joined. Available spatial relationships are as follows:

    • Intersects
    • Equals
    • Planar Near—Uses planar distances.
    • Geodesic Near—Uses geodesic distances. This is only available in ArcGIS Enterprise 10.7.1 and later.
    • Contains
    • Within
    • Touches
    • Crosses
    • Overlaps

    Learn more about spatial relationships in GeoAnalytics Server Tools

    Temporal Relationship

    The temporal relationship that will determine whether features are joined to each other. The available relationships depend on the time type (instant or interval) of the layers being joined. Available temporal relationships are as follows:

    • Meets
    • Met by
    • Overlaps
    • Overlapped by
    • During
    • Contains
    • Equals
    • Finishes
    • Finished by
    • Starts
    • Started by
    • Intersects
    • Near
    • Near Before
    • Near After

    Learn more about temporal relationships in GeoAnalytics Server Tools

    Attribute Relationship

    The attribute relationship that will determine whether features are joined to each other. Features are matched when the field values in the join layer are equal to field values in the target layer.

  • If target and join features are in different coordinate systems, the coordinate system of the target feature will be used. If an output coordinate system is specified, both features are projected to the output coordinate system and are then joined.

  • When the Spatial Relationship parameter value is Planar near, Join Features requires that the Target Layer value is projected or that the output coordinate system is set to a projected coordinate system.

  • If multiple features match the same target feature, you can decide whether all the matching features will be joined (Join one to many) or all the matching features will be summarized together (Join one to one) as follows:

    • Join one to many—Joins all the matching features in the join layer to the target layer. The result layer will contain multiple records of the target feature.
    • Join one to one—Summarizes all of the matching join features with each feature in the target layer. Only the features that have a match will be included in the summary and output. The count of joined features will be added, in addition to other statistics such as sum, minimum, maximum, range, mean, variance, and standard deviation. By default, only those target features that have the specified relationships will be maintained in the output feature class (inner join). If Keep All Target Features is checked, all input target features are written to the output feature class (this is known as a left outer join).
    Examples of joining one to many and one to one
    Examples of a one-to-many and one-to-one join are shown. In this example, the one-to-one join only includes the count; additional statistics that can be calculated are shown below.

  • You can optionally build an expression to join features using the Join Condition parameter. If you specify an expression, only features that meet the condition will be used. For example, using the $target["Magnitude"] > $join["Explosion"] expression, you can only join target features from theMagnitude field if greater than the join feature with a field named Explosion. See Join Features expressions for more information.

  • The following fields are included in the output features when running a one-to-many join:

    • All fields from the target layers
    • All fields from the joined layer

    If the same field name exists in the target and join datasets, the joined field will start with the word join (for example join_fieldname).

    Field nameDescription

    start_datetime

    This field represents the start time and is created when the input has time set as an instant or interval.

    end_datetime

    This field represents the end time and is created when the input has time set as an interval.

    In addition to all fields from the target layer, the following fields are included in the output features when running a one-to-one join:

    Field nameDescription

    count

    The count of features that have been joined.

    statistic_fieldname

    Specified statistics will each create an attribute field named in the following format: statistic_fieldname. For example, the maximum and standard deviation of the id field is MAX_id and SD_id.

    start_datetime

    This field represents the start time and is created when the input has time set as an instant or interval.

    end_datetime

    This field represents the end time and is created when the input has time set as an interval.

  • You can improve performance of the Join Features tool by doing one or more of the following:

    • Set the extent environment so that you only analyze data of interest.
    • Make the join conditions as selective as possible. For example, a near join of 1 kilometer will perform better than a near join of 5 kilometers on the same data.
    • Add more than one join condition. Additional join conditions make the join more selective. For example, a near join of 1 kilometer and 1 hour will perform better than a near join of 1 kilometer on the same data.
    • Apply a join expression.
    • Use data that is local to where the analysis is being run.

  • Similar analysis can also be completed using the Spatial Join tool in the Analysis toolbox.

  • This geoprocessing tool is powered by ArcGIS GeoAnalytics Server. Analysis is completed on your GeoAnalytics Server, and results are stored in your content in ArcGIS Enterprise.

  • When running GeoAnalytics Server tools, the analysis is completed on the GeoAnalytics Server. For optimal performance, make data available to the GeoAnalytics Server through feature layers hosted on your ArcGIS Enterprise portal or through big data file shares. Data that is not local to your GeoAnalytics Server will be moved to your GeoAnalytics Server before analysis begins. This means that it will take longer to run a tool, and in some cases, moving the data from ArcGIS Pro to your GeoAnalytics Server may fail. The threshold for failure depends on your network speeds, as well as the size and complexity of the data. Therefore, it is recommended that you always share your data or create a big data file share.

    Learn more about sharing data to your portal

    Learn more about creating a big data file share through Server Manager

Parameters

LabelExplanationData Type
Target Layer

Contains the target features. The attributes from the target features and the attributes from the joined features will be transferred to the output.

Record Set
Join Layer

Contains the join features. The attributes from the join features will be joined to the attributes of the target features. See the explanation of the Join Operation (join_operation in Python) parameter for details about how the aggregation of joined attributes are affected by the type of join operation.

Record Set
Output Name

The name of the output feature service.

String
Join Operation

Specifies how joins between the Target Layer values and the Join Layer values will be handled in the output if multiple join features are found that have the same spatial relationship with a single target feature.

  • Join one to one —The attributes from the multiple join features will be aggregated. For example, if a point target feature is found in two separate polygon join features, the attributes from the two polygons will be aggregated before being transferred to the output point feature class. If one polygon has an attribute value of 3 and the other has a value of 7, and the summary statistic sum is specified for that field, the aggregated value in the output feature class will be 10. This is the default, and only the count statistic is returned.
  • Join one to many — The output feature class will contain multiple copies (records) of the target feature. For example, if a single-point target feature is found in two separate polygon join features, the output feature class will contain two copies of the target feature: one record with the attributes of one polygon and another record with the attributes of the other polygon. There are no summary statistics available with this method.
String
Spatial Relationship
(Optional)

Specifies the criteria that will be used to spatially join features.

  • Intersects — The features in the join features will be matched if they intersect a target feature. This is the default.
  • Equals — The features in the join features will be matched if they are the same geometry as a target feature.
  • Planar Near — The features in the join features will be matched if they are within a specified distance of a target feature. The distance is measured using planar distance. Specify a distance in the Spatial Near Distance parameter.
  • Geodesic Near —The features in the join features will be matched if they are within a specified distance of a target feature. The distance is measured geodesically. Specify a distance in the Spatial Near Distance parameter. This option is available with ArcGIS Enterprise 10.7 or later.
  • Contains — The features in the join features will be matched if a target feature contains them. The target features must be polygons or polylines. The join features can only be polygons when the target features are also polygons. A polygon can contain any feature type. A polyline can contain only polylines and points. A point cannot contain any feature, not even a point. If the join feature is entirely on the boundary of the target feature (no part is properly inside or outside), the feature will not be matched.
  • Within — The features in the join features will be matched if a target feature is within them. It is the opposite of the contains relationship. For this option, the target features can only be polygons when the join features are also polygons. A point can be a join feature only if a point is also a target feature. If the entirety of the feature in the join features is on the boundary of the target feature, the feature will not be matched.
  • Touches — The features in the join features will be matched if they have a boundary that touches a target feature. When the target and join features are lines or polygons, the boundary of the join feature can only touch the boundary of the target feature, and no part of the join feature can cross the boundary of the target feature.
  • Crosses — The features in the join features will be matched if a target feature is crossed by their outline. The join and target features must be lines or polygons. If polygons are used for the join or target features, the polygon's boundary (line) will be used. Lines that cross at a point will be matched, but lines that share a line segment will not.
  • Overlaps — The features in the join features will be matched if they overlap a target feature.
String
Spatial Near Distance
(Optional)

The distance from a target feature within which join features will be considered for the spatial join. A search radius is only valid when the Spatial Relationship parameter value is Planar Near or Geodesic Near.

Linear Unit
Temporal Relationship
(Optional)

Specifies the time criteria that will be used to match features.

  • Meets — When a target time interval end is equal to the join time interval start, the target time meets the join time.
  • Met by — When a target time interval start is equal to the join time interval end, the target time is met by the join time.
  • Overlaps — When a target time interval starts and ends before the start and end of the join time interval, the target time overlaps the join time.
  • Overlapped by — When a target time interval starts and ends after the start and end time of the join time interval, the target time is overlapped by the join time.
  • During — When a target time occurs between the start and end of the join time interval, the target time is during the join time.
  • Contains — When a join feature time occurs between the start and end of the target time interval, the target time contains the join time.
  • Equals — Two times are considered equal if their instants or intervals are identical.
  • Finishes — When a target time ends at the same time as a join time, and the target time started after the join time, the target time finishes the join time.
  • Finished by — When a join feature time ends at the same time as a target time, and the join time started after the target time, the target time is finished by the join time.
  • Starts — When a target time starts at the same time as the join time interval and ends before the join time interval ends, the target time starts the join time.
  • Started by — When a target interval time starts at the same time as the join time and ends after the join time, the target time is started by the join time.
  • Intersects — When any part of a target time occurs at the same time as the join time, the target time intersects the join time.
  • Near — When a target time is within a specified range of time from the join time, the target time is near the join time.
  • Near before —When a target time is before the join time but within a specified range of time from the join time, the target time is near before the join time. This option is available with ArcGIS Enterprise 10.6 or later.
  • Near after —When a target time is after the join time but within a specified range of time from the join time, the target time is near after the join time. This option is available with ArcGIS Enterprise 10.6 or later.
String
Temporal Near Distance
(Optional)

The distance in time from a target feature within which join features will be considered for the spatial join. A time is only valid when the Temporal Relationship parameter value is Near, Near Before, or Near After and both features are time enabled.

Time Unit
Attribute Relationship
(Optional)

Joins features based on values in an attribute field. Specify the attribute field from the target layer that matches an attribute field from the join layer.

  • Target Field—An attribute field from the target layer containing values to match.
  • Join Field—An attribute field from the join layer containing values to match.

Value Table
Summary Fields
(Optional)

The statistics that will be calculated on specified fields.

Value Table
Join Condition
(Optional)

Applies a condition to specified fields. Only features with fields that meet these conditions will be joined.

For example, you could apply a join condition to features in which the HealthSpending attribute in the join layer is more than 20 percent of the Income attribute in the target layer. In 10.5 and 10.5.1, the join condition to use to apply this expression is join["HealthSpending"] > target["Income"] * .2. In 10.6 and later, use an Arcade expression such as $join["HealthSpending"] > $target["Income"] * .2.

If the layer is added to the map, the Fields and Helpers filters can be used to build an expression.

Learn more about Join Features expressions at 10.6

String
Data Store
(Optional)

Specifies the ArcGIS Data Store where the output will be saved. The default is Spatiotemporal big data store. All results stored in a spatiotemporal big data store will be stored in WGS84. Results stored in a relational data store will maintain their coordinate system.

  • Spatiotemporal big data store —Output will be stored in a spatiotemporal big data store. This is the default.
  • Relational data store —Output will be stored in a relational data store.
String
Keep All Target Features
(Optional)

Specifies whether all target features will be maintained in the output feature class (known as a left outer join) or only those that have the specified relationships with the join features (inner join).

  • Checked—All target features will be maintained in the output (outer join).
  • Unchecked—Only those target features that have the specified relationships will be maintained in the output feature class (inner join). Any point features not within the polygon features will be excluded from the output. This is the default.

Boolean

Derived Output

LabelExplanationData Type
Output_Feature_Class

The joined output.

Record Set

arcpy.geoanalytics.JoinFeatures(target_layer, join_layer, output_name, join_operation, {spatial_relationship}, {spatial_near_distance}, {temporal_relationship}, {temporal_near_distance}, {attribute_relationship}, {summary_fields}, {join_condition}, {data_store}, {keep_all_target_features})
NameExplanationData Type
target_layer

Contains the target features. The attributes from the target features and the attributes from the joined features will be transferred to the output.

Record Set
join_layer

Contains the join features. The attributes from the join features will be joined to the attributes of the target features. See the explanation of the Join Operation (join_operation in Python) parameter for details about how the aggregation of joined attributes are affected by the type of join operation.

Record Set
output_name

The name of the output feature service.

String
join_operation

Specifies how joins between the target_layer values and join_layer values will be handled in the output feature if multiple join features are found that have the same spatial relationship with a single target feature.

  • JOIN_ONE_TO_ONE The attributes from the multiple join features will be aggregated. For example, if a point target feature is found in two separate polygon join features, the attributes from the two polygons will be aggregated before being transferred to the output point feature class. If one polygon has an attribute value of 3 and the other has a value of 7, and the summary statistic sum is specified for that field, the aggregated value in the output feature class will be 10. This is the default, and only the count statistic is returned.
  • JOIN_ONE_TO_MANYThe output feature class will contain multiple copies (records) of the target feature. For example, if a single-point target feature is found in two separate polygon join features, the output feature class will contain two copies of the target feature: one record with the attributes of one polygon and another record with the attributes of the other polygon. There are no summary statistics available with this method.
String
spatial_relationship
(Optional)

Specifies the criteria that will be used to spatially join features.

  • INTERSECTSThe features in the join features will be matched if they intersect a target feature. This is the default.
  • EQUALS The features in the join features will be matched if they are the same geometry as a target feature.
  • NEARThe features in the join features will be matched if they are within a specified distance of a target feature. The distance is measured using planar distance. Specify a distance in the spatial_near_distance parameter.
  • NEAR_GEODESICThe features in the join features will be matched if they are within a specified distance of a target feature. The distance is measured geodesically. Specify a distance in the spatial_near_distance parameter. This option is available with ArcGIS Enterprise 10.7 or later.
  • CONTAINSThe features in the join features will be matched if a target feature contains them. The target features must be polygons or polylines. The join features can only be polygons when the target features are also polygons. A polygon can contain any feature type. A polyline can contain only polylines and points. A point cannot contain any feature, not even a point. If the join feature is entirely on the boundary of the target feature (no part is properly inside or outside), the feature will not be matched.
  • WITHINThe features in the join features will be matched if a target feature is within them. It is the opposite of the contains relationship. For this option, the target features can only be polygons when the join features are also polygons. A point can be a join feature only if a point is also a target feature. If the entirety of the feature in the join features is on the boundary of the target feature, the feature will not be matched.
  • TOUCHESThe features in the join features will be matched if they have a boundary that touches a target feature. When the target and join features are lines or polygons, the boundary of the join feature can only touch the boundary of the target feature, and no part of the join feature can cross the boundary of the target feature.
  • CROSSESThe features in the join features will be matched if a target feature is crossed by their outline. The join and target features must be lines or polygons. If polygons are used for the join or target features, the polygon's boundary (line) will be used. Lines that cross at a point will be matched, but lines that share a line segment will not.
  • OVERLAPSThe features in the join features will be matched if they overlap a target feature.
String
spatial_near_distance
(Optional)

The distance from a target feature within which join features will be considered for the spatial join. A search radius is only valid when the spatial_relationship parameter value is NEAR or NEAR_GEODESIC.

Linear Unit
temporal_relationship
(Optional)

Specifies the time criteria that will be used to match features.

  • MEETSWhen a target time interval end is equal to the join time interval start, the target time meets the join time.
  • MET_BYWhen a target time interval start is equal to the join time interval end, the target time is met by the join time.
  • OVERLAPSWhen a target time interval starts and ends before the start and end of the join time interval, the target time overlaps the join time.
  • OVERLAPPED_BYWhen a target time interval starts and ends after the start and end time of the join time interval, the target time is overlapped by the join time.
  • DURINGWhen a target time occurs between the start and end of the join time interval, the target time is during the join time.
  • CONTAINSWhen a join feature time occurs between the start and end of the target time interval, the target time contains the join time.
  • EQUALSTwo times are considered equal if their instants or intervals are identical.
  • FINISHESWhen a target time ends at the same time as a join time, and the target time started after the join time, the target time finishes the join time.
  • FINISHED_BYWhen a join feature time ends at the same time as a target time, and the join time started after the target time, the target time is finished by the join time.
  • STARTSWhen a target time starts at the same time as the join time interval and ends before the join time interval ends, the target time starts the join time.
  • STARTED_BYWhen a target interval time starts at the same time as the join time and ends after the join time, the target time is started by the join time.
  • INTERSECTSWhen any part of a target time occurs at the same time as the join time, the target time intersects the join time.
  • NEARWhen a target time is within a specified range of time from the join time, the target time is near the join time.
  • NEAR_BEFOREWhen a target time is before the join time but within a specified range of time from the join time, the target time is near before the join time. This option is available with ArcGIS Enterprise 10.6 or later.
  • NEAR_AFTERWhen a target time is after the join time but within a specified range of time from the join time, the target time is near after the join time. This option is available with ArcGIS Enterprise 10.6 or later.

Specifies the time criteria that will be used to match features.

  • MEETSWhen a target time interval end is equal to the join time interval start, the target time meets the join time.
  • MET_BYWhen a target time interval start is equal to the join time interval end, the target time is met by the join time.
  • OVERLAPSWhen a target time interval starts and ends before the start and end of the join time interval, the target time overlaps the join time.
  • OVERLAPPED_BYWhen a target time interval starts and ends after the start and end time of the join time interval, the target time is overlapped by the join time.
  • DURINGWhen a target time occurs between the start and end of the join time interval, the target time is during the join time.
  • CONTAINSWhen a join feature time occurs between the start and end of the target time interval, the target time contains the join time.
  • EQUALSTwo times are considered equal if their instants or intervals are identical.
  • FINISHESWhen a target time ends at the same time as a join time, and the target time started after the join time, the target time finishes the join time.
  • FINISHED_BYWhen a join feature time ends at the same time as a target time, and the join time started after the target time, the target time is finished by the join time.
  • STARTSWhen a target time starts at the same time as the join time interval and ends before the join time interval ends, the target time starts the join time.
  • STARTED_BYWhen a target interval time starts at the same time as the join time and ends after the join time, the target time is started by the join time.
  • INTERSECTSWhen any part of a target time occurs at the same time as the join time, the target time intersects the join time.
  • NEARWhen a target time is within a specified range of time from the join time, the target time is near the join time.
  • NEAR_BEFOREWhen a target time is before the join time but within a specified range of time from the join time, the target time is near before the join time. This option is available with ArcGIS Enterprise 10.6 or later.
  • NEAR_AFTERWhen a target time is after the join time but within a specified range of time from the join time, the target time is near after the join time. This option is available with ArcGIS Enterprise 10.6 or later.
String
temporal_near_distance
(Optional)

The distance in time from a target feature within which join features will be considered for the spatial join. A time is only valid when the temporal_relationship parameter value is NEAR, NEAR_BEFORE, or NEAR_AFTER and both feature are time enabled.

Time Unit
attribute_relationship
[attribute_relationship,...]
(Optional)

Joins features based on values in an attribute field. Specify the attribute field from the target layer that matches an attribute field from the join layer.

  • Target Field—An attribute field from the target layer containing values to match.
  • Join Field—An attribute field from the join layer containing values to match.

Value Table
summary_fields
[summary_fields,...]
(Optional)

The statistics that will be calculated on specified fields.

  • COUNT—The number of nonnull values. It can be used on numeric fields or strings. The count of [null, 0, 2] is 2.
  • SUM—The sum of numeric values in a field. The sum of [null, null, 3] is 3.
  • MEAN—The mean of numeric values. The mean of [0,2, null] is 1.
  • MIN—The minimum value of a numeric field. The minimum of [0, 2, null] is 0.
  • MAX—The maximum value of a numeric field. The maximum value of [0, 2, null] is 2.
  • STDDEV—The standard deviation of a numeric field. The standard deviation of [1] is null. The standard deviation of [null, 1,1,1] is null.
  • VAR—The variance of a numeric field in a track. The variance of [1] is null. The variance of [null, 1,1,1] is null.
  • RANGE—The range of a numeric field. This is calculated as the minimum value subtracted from the maximum value. The range of [0, null, 1] is 1. The range of [null, 4] is 0.
  • ANY—A sample string from a field of type string.

Value Table
join_condition
(Optional)

Applies a condition to specified fields. Only features with fields that meet these conditions will be joined.

For example, you could apply a join condition to features in which the HealthSpending attribute in the join layer is more than 20 percent of the Income attribute in the target layer. In 10.5 and 10.5.1, the join condition to use to apply this expression is join["HealthSpending"] > target["Income"] * .2. In 10.6 and later, use an Arcade expression such as $join["HealthSpending"] > $target["Income"] * .2.

String
data_store
(Optional)

Specifies the ArcGIS Data Store where the output will be saved. The default is SPATIOTEMPORAL_DATA_STORE. All results stored in a spatiotemporal big data store will be stored in WGS84. Results stored in a relational data store will maintain their coordinate system.

  • SPATIOTEMPORAL_DATA_STOREOutput will be stored in a spatiotemporal big data store. This is the default.
  • RELATIONAL_DATA_STOREOutput will be stored in a relational data store.
String
keep_all_target_features
(Optional)

Specifies whether all target features will be maintained in the output feature class (known as a left outer join) or only those that have the specified relationships with the join features (inner join).

  • KEEP_ALLAll target features will be maintained in the output (left outer join).
  • KEEP_COMMONOnly those target features that have the specified relationships will be maintained in the output feature class (inner join). This is the default.
Boolean

Derived Output

NameExplanationData Type
output

The joined output.

Record Set

Code sample

JoinFeatures example (stand-alone script)

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

# Name: JoinFeatures.py
# Description: Join crime events that are close together in time and space, and 
#              return the count of nearby crimes. This example is a self join 
#              (joining the same layer to itself).
# Requirements: ArcGIS GeoAnalytics Server 

# Import system modules 
import arcpy 

# Set local variables 
inFeatures = "https://MyGeoAnalyticsMachine.domain.com/geoanalytics/rest/services/DataStoreCatalogs/bigDataFileShares_Crimes/BigDataCatalogServer/Chicago"
spatialOperation = "NEAR" 
nearDistance = "1 Kilometers" 
temporalOperation = "NEAR" 
nearTime = "3 Hours" 
outFS = "CloseCrimes" 
dataStore = "SPATIOTEMPORAL_DATA_STORE" 

# Execute Join Features
arcpy.geoanalytics.JoinFeatures(inFeatures, inFeatures, outFS, "JOIN_ONE_TO_ONE", 
                                spatialOperation, nearDistance, temporalOperation, 
                                nearTime, None, None, None, dataStore)

Environments

Output Coordinate System

The coordinate system that will be used for analysis. Analysis will be completed in the input coordinate system unless specified by this parameter. For GeoAnalytics Tools, final results will be stored in the spatiotemporal data store in WGS84.

Licensing information

  • Basic: Requires ArcGIS GeoAnalytics Server
  • Standard: Requires ArcGIS GeoAnalytics Server
  • Advanced: Requires ArcGIS GeoAnalytics Server

Related topics