Summary
Joins attributes from one layer to another based on spatial, temporal, or attribute relationships, or a combination of those relationships.
Illustration
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.
Options Description 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
Attrbitute 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).
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 name Description 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 name Description 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 Reconstruct Tracks tool by doing one or more of the following:
- Set the extent environment so that you only analyze data of interest.
- Use the planar method instead of geodesic.
- Don't apply a buffer.
- Split your tracks using the Time Split, Time Boundary Split, Distance Split, or Split Expression parameters. The Time Boundary Split parameter will have the biggest performance gains.
- 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
Syntax
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})
Parameter | Explanation | Data 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 | 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.
| String |
spatial_relationship (Optional) | Specifies the criteria that will be used to spatially join features.
| 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.
Specifies the time criteria that will be used to match features.
| 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.
| Value Table |
summary_fields [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. | 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.
| 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).
| Boolean |
Derived Output
Name | Explanation | Data Type |
output | The joined output. | Record Set |
Code sample
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