The JoinFeatures task works with two layers and joins the attributes from one feature to another based on spatial and attribute relationships.
Request URL
http://<analysis url>/JoinFeatures/SubmitJob
Request parameters
Parameter | Description |
---|---|
targetLayer (Required) | The point, line, polygon, or table layer that will have attributes from the joinLayer parameter appended to its table. Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:
Examples:
|
joinLayer
(Required) | The point, line, polygon, or table layer that will be joined to the targetLayer parameter. Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:
|
spatialRelationship | Defines the spatial relationship used to spatially join features. Values: IdenticalTo | Intersects | CompletelyContains | CompletelyWithin | WithinDistance | Contains | Within. |
spatialRelationshipDistance (Required if spatialRelationship is WithinDistance) | A double value used for the search distance to determine if the targetFeatures are near or within a specified distance of the joinFeatures. This is only applied if withinDistance is the selected spatialRelationship parameter. You can only enter a single distance value. The units of the distance values are supplied by the spatialRelationshipDistanceUnits parameter. Examples:
|
spatialRelationshipDistanceUnits (Required if spatialRelationship is WithinDistance) | The linear unit to be used with the distance value specified in spatialRelationshipDistance. The default is Miles. Values: Miles | Yards | Feet | NauticalMiles | Meters | Kilometers |
attributeRelationship | Defines an attribute relationship used to join features. Features are matched when the field values in the join layer are equal to field values in the target layer. Syntax
Examples:
|
joinOperation | A string representing the type of join (JoinOneToOne or JoinOneToMany) that will be applied:
Note:Adding summary statistics is not supported for JoinOneToMany operations.Values: JoinOneToOne | JoinOneToMany. |
summaryFields | A list of field names and statistical summary types that you want to calculate. Note that the count is always returned by default. Note:fieldName is the name of one of the numeric fields found in the input joinLayer. Syntax:
statisticType is one of the following:
Example:
|
recordsToMatch | Defines which feature from the joinLayer is joined to the target feature when multiple join features have the same relationship with a single target feature. The feature that is joined is the first matching record when the features are sorted by the field listed in the orderByFields parameter in either ascending or descending order. Syntax: Examples: |
outputName | If provided, the task will create a feature service of the results. You define the name of the service. If outputName is not supplied, the task will return a feature collection. |
context | Context contains additional settings that affect task execution. There are two settings:
Syntax:
|
joinType | The type of join used to determine which target features are returned, Inner or Left:
|
f | The response format. The default response format is html. Values: html | json | kmz |
Response
When you submit a request, the service assigns a unique job ID for the transaction.
Syntax:{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}
After the initial
request is submitted, you can use the
jobId to periodically check the status of the job and messages as described in Checking job status.
Once the job has successfully completed, use
the jobId to retrieve the results. To track the status, you can make a request of the following form:http://<analysis url>/JoinFeatures/jobs/<jobId>
Accessing results
When the status of the job request is esriJobSucceded, you can access the results of the analysis by making a request of the following form:
http://<analysis url>/JoinFeatures/jobs/<jobId>/results/outputLayer?token=<your token>&f=json
Parameter | Description |
---|---|
outputLayer | The outputLayer will have the same geometry as the targetLayer. The targetLayer will inherit all the attributes of the joined joinLayer. If a JoinOneToOne is applied, the output will have a Count attribute, which is the number of features that match the join conditions. If a summaryFields parameter is specified in the task request, the layer will have additional attributes for each requested summary. For example, if you request the following:
The result polygon features will have two attributes, Sum_Total_Sales and Mean_Total_Sales, to contain the calculated values. If a JoinOneToMany is 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.
See Feature Output for more information about how the result layer or collection is accessed. |