Join Features

The Join Features task works with two layers. Join Features 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.
Join Features can be applied to points, lines, polygons, and tables.
Request URL
http://<analysis url>/JoinFeatures/submitJob
Request parameters
Parameter | Description |
|---|---|
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 web example:
REST scripting example:
|
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 scripting example:
|
joinOperation (Required) | A string representing the type of join that will be applied. Syntax: JoinOneToOne | JoinOneToMany.
REST web example: JoinOneToMany REST scripting example: "joinOperation" : "JoinOneToOne" |
joinFields | 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. Syntax: "joinFields": [{"action": "<action>" , "field" : "<fieldname>", "to" : <new field name>"},...] action can be the following:
REST web examples:
REST scripting 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. Syntax: [{"statisticType" : "<statistic type>", "onStatisticField" : "<field name>" }, ...] fieldName is the name of the fields in the target layer. statisticType is one of the following for numeric fields:
statisticType is one of the following for string fields:
REST web examples:
REST scripting examples:
|
spatialRelationship | Defines the spatial relationship used to spatially join features. Values: Equals | Intersects | Contains | Within | Crosses | Touches | Overlaps| Near | NearGeodesic (at 10.7.1 or later). Learn more about spatial relationships supported in ArcGIS GeoAnalytics Server REST web examples:
REST scripting 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 only enter a single distance value. The units of the distance values are supplied by the spatialNearDistanceUnit parameter. REST web examples: 4 REST scripting examples:"spatialNearDistance" : 4 Analysis using a Near spatial relationship requires that the targetLayer or processing extent (processSR) has a projected coordinate system. |
spatialNearDistanceUnit (Required if spatialRelationship is Near or NearGeodesic) | The linear unit to be used with the distance value specified in spatialNearDistance. Values: Meters | Kilometers | Feet | Miles | NauticalMiles | Yards The default is Meters. REST web example: Miles REST scripting example: "spatialNearDistanceUnit" : "Miles" |
temporalRelationship | Defines the temporal relationship used to temporally join features. Values: Equals | Intersects| During | Contains | Finishes | FinsihedBy | Meets | MetBy | Overlaps | OverlappedBy |Starts|StartedBy |Near|NearBefore (at 10.6 or later) |NearAfter (at 10.6 or later). REST web examples:
REST scripting 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 web example: 4 REST scripting example: "temporalNearDistance" : 53 |
temporalNearDistanceUnit (Required if temporalRelationship is Near, NearBefore, or NearAfter) | The temporal unit to be used with the distance value specified in temporalNearDistance. Values: Milliseconds | Seconds | Minutes | Hours | Days | Weeks | Months | Years REST web example: Minutes REST scripting example: "temporalNearDistanceUnit" : "Minutes" |
attributeRelationship | 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 equalIgnoreCaseTrimWhiteSpace through json or ~= using a string. Syntax as a json (recommended): Attribute relationship in join features Syntax as a string: "attributeRelationship": "target["target fieldname"] = join["join fieldname"] REST web examples:
REST scripting examples:
|
joinCondition | Applies a condition to specified fields. Only features with fields that meet these conditions will be joined. Note:At 10.5 use fields in the format feature['StoreDist'] , starting at 10.5.1 use fields in the format $feature['StoreDist'] REST web examples:
REST scripting examples:
For example, to apply a join to a dataset for only those features where health_spending is greater than 20 percent of income, apply a join condition of target['health_spending'] > (join['income'] * .20) using the field health_spending from the first dataset (targetLayer) and the income field from the second dataset (joinLayer). |
outputName (Required) | The task will create a feature service of the results. You define the name of the service. REST web example: myOutput REST scripting example: "outputName" : "myOutput" |
context | 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 |
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>
Accessing 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
Parameter | 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 outputwill have a Count attribute, which is the number of features that matched the join conditions; and by default, will calculate all statistics for each field in the joinLayer.If a JoinOneToMany was applied, the output will have each pair of joined features. Example: 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. |
