Join Features
- URL:https://<geoanalytics-url>/JoinFeatures
- Version Introduced:10.5
Description
The JoinFeatures operation works with two layers. JoinFeatures joins attributes from one feature to another based on spatial, temporal, and attribute relationships or some combination of the three. The tool determines all input features that meet the specified join conditions and joins the second input layer to the first. You can optionally join all features to the matching features or summarize the matching features.
JoinFeatures can be applied to points, lines, polygons, and tables.
Request parameters
Parameter | Details |
---|---|
targetLayer (Required) | The table, point, line, or polygon features to be joined to. Syntax: As described in Feature input, this parameter can be one of the following:
REST examples
|
joinLayer (Required) | The point, line, or polygon features that will be joined to the targetLayer. Syntax: As described in Feature input, this parameter can be one of the following:
REST examples
|
joinOperation (Required) | A string representing the type of join that will be applied. There are two options available: JoinOneToOne and JoinOneToMany. For JoinOneToOne, if multiple join features are found that have the same relationships with a single target feature, the attributes from the multiple join features will be aggregated using the specified summary statistics. For example, if a point feature is found within 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 a summaryField of sum is selected, the aggregated value in the output feature class will be 10. There will always be a Count field calculated, with a value of 2, for the number of features specified. For JoinOneToMany, if multiple join features are found that have the same relationship with a single target feature, the output feature class will contain multiple copies (records) of the target feature. For example, if a single point target feature is found within two separate polygon join features, the output feature class will contain two copies of the target feature: one record with the attributes of the first polygon, and another record with the attributes of the second polygon. There are no summary statistics calculated with this method. REST examples
|
keepAllTargetFeatures (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). This option is only available when the joinOperation parameter is JoinOneToOne. False (inner join) is the default. This parameter is available at ArcGIS GeoAnalytics Server 10.9 or later. REST examples
|
joinFields (Required) | A list of modifications to field names in the joinLayer to be made before completing analysis. Any field that is removed will not have statistics calculated on it. In the syntax below, action can be either remove or rename. remove specifies that a field should be removed from analysis and output. rename specifies that a field should be renamed before running the analysis. REST examples
|
summaryFields (Optional) | A list of field names and statistical summary types you want to calculate. Note that the count is always returned. By default, all statistics are returned. onStatisticField specifies the name of the fields in the target layer. statisticType is one of the following for numeric fields:
REST examples
|
spatialRelationship (Required) | Defines the spatial relationship used to spatially join features. To learn more about the supported spatial relationships, see Spatial relationships in ArcGIS GeoAnalytics Server. Values: Equals | Intersects | Contains | Within | Crosses | Touches | Overlaps | Near | NearGeodesic (at 10.7.1 or later) REST examples
|
spatialNearDistance (Required if spatialRelationship is Near or NearGeodesic) | A double value used for the search distance to determine if the targetFeatures are near the joinFeatures. This is only applied if Near or NearGeodesic is the selected spatialRelationship. You can enter a single distance value. The units of the distance values are supplied by the spatialNearDistanceUnit parameter. Analysis using a Near spatial relationship requires that the targetLayer or processing extent (processSR) have a projected coordinate system. REST examples
|
spatialNearDistanceUnit (Required if spatialRelationship is Near or NearGeodesic) | The linear unit to be used with the distance value specified in spatialNearDistance. The default value is Meters. Values: Meters | Kilometers | Feet | Miles | NauticalMiles | Yards REST examples
|
temporalRelationship (Optional) | Defines the temporal relationship used to temporally join features. Values: Equals | Intersects | During | Contains | Finishes | FinishedBy | Meets | MetBy | Overlaps | OverlappedBy | Starts | StartedBy | Near | NearBefore (at 10.6 or later) | NearAfter (at 10.6 or later) REST examples
|
temporalNearDistance (Required if temporalRelationship is Near, NearBefore, or NearAfter) | An integer value used for the temporal search distance to determine if the targetFeatures are temporally near the joinFeatures. This is only applied if Near, NearBefore, or NearAfter is the selected temporalRelationship. You can only enter a single distance value. The units of the distance values are supplied by the temporalNearDistanceUnit parameter. REST examples
|
temporalNearDistanceUnit (Required if temporalRelationship is Near, NearBefore, or NearAfter) | The temporal unit to be used with the distance value specified in temporalNearDistance. Values: Meters | Kilometers | Feet | Miles | NauticalMiles | Yards REST examples
|
attributeRelationship (Optional) | A target field, relationship, and join field used to join equal attributes. At 10.5 and 10.5.1, an equals relationship is used (equal in JSON, and = using the string format). At 10.6 or later, you can join strings that are equal without comparing casing or trailing and leading white spaces using equalIgnoreCaseTrimeWhiteSpace through JSON or ~= using a string. REST examples
|
joinCondition (Optional) | Applies a condition to specified fields. Only features with fields that meet these conditions will be joined. ![]() At 10.5, use fields in the format feature['storeDist']. Starting at 10.5.1, use fields in the format $feature['StoreDist']. For example, to apply a join to a dataset for only those features where health_spending is greater than 20 percent of income, and apply a join condition of target['health_spending'] > (join['income'] * .20) using the field health_spending from the first dataset (targerLayer) and the income field from the second dataset (joinLayer), use the following: REST examples
|
outputName (Required) | The task will create a feature service of the results. You define the name of the service. REST examples
|
context (Optional) | The context parameter contains additional settings that affect task execution. For this task, there are four settings:
Syntax:
|
f | The response format. The default response format is html. Values: html | json |
Example usage
Below is a sample request URL for JoinFeatures:
https://webadaptor.domain.com/server/rest/services/System/GeoAnalyticsTools/GPServer/GeneralizedLinearRegression/submitJob?predictionType=Train&inputLayer={"url":"https://webadaptor.domain.com/server/rest/services/Hurricane/hurricaneTrack2017/0"}&featuresToPredict={"url":"https://webadaptor.domain.com/server/rest/services/Hosted/corpusChristi/0"}&dependentVariable=ShelterCapacity&explanatoryVariables=CityDensity, ShelterLocations®ressionFamily=Binary&generateCoefficientTable=false&explanatoryVariableMatching=[{"predictionLayerField":"Hurricane2019","trainingLayerField":"hurricanesIn2019"},{"predictionLayerField":"ShelterLocations","trainingLayerField":"CorpusChristiShelters"}&dependentMapping=[{"value0":"Shelter"},{"value1":"NoShelter"}]&outputName=myOutput&context={"extent":{"xmin":-122.68,"ymin":45.53,"xmax":-122.45,"ymax":45.6,"spatialReference":{"wkid":4326}}}&f=json
Response
When you submit a request, the service assigns a unique job ID for the transaction.
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}
After the initial request is submitted, you can use jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, use jobId to retrieve the results. To track the status, you can make a request of the following form:
https://<analysis url>/JoinFeatures/jobs/<jobId>
Access results
When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:
http://<analysis-url>/JoinFeatures/jobs/<jobId>/results/output?token=<your token>&f=json
Response | Description |
---|---|
output |
The output will be the same geometry as the targetLayer. The targetLayer will inherit all the attributes of the joined joinLayer. If a JoinOneToOne was applied, the output will have a Count attribute, which is the number of features that matched the join conditions, and by default, it will calculate all statistics for each field in the joinLayer. If a JoinOneToMany was applied, the output will have each pair of joined features.
The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request. The value contains the URL of the feature service layer.
See Feature output for more information about how the result layer is accessed. |