- 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 a 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 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 which the joinLayer features will be joined. 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 features. 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 relationship 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 value of sum is specified, 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. No summary statistics are 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 parameter is only available when the joinOperation parameter value is JoinOneToOne. The default value is false (inner join). 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 value 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 will be removed from analysis and output. rename specifies that a field will 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) | Specifies 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 value are near the joinFeatures value. This is only applied if Near or NearGeodesic is the selected spatialRelationship value. 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 | FeetInt | FeetUS | Miles | MilesInt | MilesUS | NauticalMiles | NauticalMilesInt | NauticalMilesUS | Yards | YardsInt | YardsUS REST examples
|
temporalRelationship (Optional) | Specifies the temporal relationship used to temporally join features. Values: Equals | Intersects | During | Contains | Finishes | FinishedBy | Meets | MetBy | Overlaps | OverlappedBy | Starts | StartedBy | Near | NearBefore | NearAfter 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 values are temporally near the joinFeatures values. This is only applied if Near, NearBefore, or NearAfter is specified for 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 | FeetInt | FeetUS | Miles | MilesInt | MilesUS | NauticalMiles | NauticalMilesInt | NauticalMilesUS | Yards | YardsInt | YardsUS REST examples
|
includeDistance (Optional) | This parameter is available at ArcGIS GeoAnalytics Server 11.2 or later. Specifies whether or not to include the spatial distance and/or temporal difference calculated between target and join features when joinOperation is JoinOneToMany. The spatial distance between target and join features will be included in the result when spatialRelationship is Near or NearGeodesic. The temporal difference (or time gap) between target and join features will be included in the result when temporalRelationship is Near, NearBefore, or NearAfter. The default is false. REST examples
|
distanceUnit (Optional) | This parameter is available at ArcGIS GeoAnalytics Server 11.2 or later. Specifies the unit of measure that will be used for distance values in the result. The default is Meters. Values: Meters | Kilometers | Feet | FeetInt | FeetUS | Miles | MilesInt | MilesUS | NauticalMiles | NauticalMilesInt | NauticalMilesUS | Yards | YardsInt | YardsUS REST examples
|
attributeRelationship (Optional) | A target field, relationship, and join field used to join equal attributes. You can join strings that are equal without comparing casing or trailing and leading 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. This should always be used with a spatial, temporal, or field attribute relationship, or a combination of the three. For example, to apply a join to a dataset for only those features in which health_spending is greater than 20 percent of income, and apply a join condition of $target['health_spending'] > ($join['income'] * .20) using the health_spending field 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:
|
f | The response format. The default response format is html. Values: html | json |
Example usage
The following 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 Check 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 value will be the same geometry as the targetLayer value. The targetLayer value will inherit all the attributes of the joined joinLayer value. If JoinOneToOne was applied, the output value will have a Count attribute, which is the number of features that matched the join conditions. By default, it will calculate all statistics for each field in the joinLayer value. If JoinOneToMany was applied, the output value 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. |