Join features

A join analysis resulting in a new layer that contains an additional field for average home value within census blocks.

What is a join analysis?

A join analysis is the process of combining the attributes from one feature dataset to another based on spatial and/or attribute relationships. The join data can be a feature layer or table. To execute the analysis, use the spatial analysis service and the JoinFeatures operation.

join features

When features are joined, you can use the attributes to calculate statistics, classify the data, show additional data in popups, or visualize the data using renderers.

Real-world examples of this analysis include the following:

  • Joining a table of flood data to a feature layer of county boundaries to visualize affected counties.
  • Joining the attributes of a land use data with zoning data to see discrepencies between zoning and use for each parcel.
  • Combining valve inspection records to fire hydrant locations to determine which hydrants are due for inspection.

How to perform a join analysis

  1. Review the parameters for the JoinFeatures operation.
  2. Send a request to get the spatial analysis service URL.
  3. Execute a job request with the following URL and parameters:
    • URL: https://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer/JoinFeatures/submitJob
    • Parameters:
      • inputLayer: The point, line, polygon, or table hosted feature layer that will have attributes from the joinLayer parameter appended to its table.
      • joinLayer: The point, line, polygon, or table hosted feature layer that will be joined to the targetLayer parameter.
      • 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.
      • outputName: A string representing the name of the hosted feature layer to reutrn with the results.
  4. Check the status.
  5. Get the output layer results.

To see examples using ArcGIS API for Python, ArcGIS REST JS, and the ArcGIS REST API, go to Examples below.

URL request

Use dark colors for code blocksCopy
 
1
http://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer/JoinFeatures/SubmitJob?<parameters>

Required parameters

NameDescriptionExamples
fThe format of the data returnedf=json f=pjson
tokenAn OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<ACCESS_TOKEN>
targetLayerThe point, line, polygon, or table layer that will have attributes from the joinLayer parameter appended to its table.{"url": <SERVICE_URL>, "filter": <where clause>}
joinLayerThe point, line, polygon, or table layer that will be joined to the targetLayer parameter.{"url": <SERVICE_URL>, "filter": <where clause>}

Key parameters

NameDescriptionExamples
attributeRelationshipDefines 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.[{"targetField":"county","operator":"equal","joinField":"Area_Name"}]
joinOperationA string representing the type of join (JoinOneToOne or JoinOneToMany) that will be applied."joinType":"inner"
outputNameA string representing the name of the hosted feature layer to return with the results. NOTE: If you do not include this parameter, the results are returned as a feature collection (JSON).{"serviceProperties": {"name": "<SERVICE_NAME>"}}

Examples

Join attributes from a table

This example uses the JoinFeatures operation to visualize counties with the highest recreation acreages. A feature table of recreation area values is joined to a polygon hosted feature layer by matching the Area_Name field values present in both feature layers.

In the analysis, the targetLayer value is the North Carolina regions hosted feature layer. The joinLayer value is the North Carolina resources table. The attributes of the joinLayer are appended to the targetLayer based on the values provided in the attributeRelationship parameter.

Join analysis joining a state recreation area table to polygon regions in North Carolina.

APIs

ArcGIS REST JSArcGIS REST JSArcGIS API for Python
Expand
Use dark colors for code blocksCopy
                                                                          
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  const operationUrl = `${analysisUrl}/JoinFeatures/submitJob`;

  const params = {

    targetLayer: {
      url:
        "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/nc_regions/FeatureServer/0",
    },
    joinLayer: {
      url:
        "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/nc_resource_table/FeatureServer/0",
    },
    joinOperation: "joinOneToOne",
    attributeRelationShip: [
      { targetField: "county", operator: "equal", joinField: "Area_Name" },
    ],
    outputName: { serviceProperties: { name: "Join features spatial result" } }, //Outputs results as a hosted feature layer.

  };

  const jobReq = await Job.submitJob({
    url: operationUrl,
    params: params,
    authentication: auth,
  });

  // listen to the status event to get updates every time the job status is checked.
  jobReq.on(JOB_STATUSES.Status, jobInfo => {
    console.log(jobInfo.status);
  });

  // get all the results, this will start monitoring and trigger events
  const jobResp = await jobReq.getAllResults();

Service requests

Request
HTTPHTTPcURL
Use dark colors for code blocksCopy
     
1
2
3
4
5
POST arcgis.com/sharing/rest/portals/self HTTP/1.1
Content-Type: application/x-www-form-urlencoded

&f=json
&token=<ACCESS_TOKEN>
Response (JSON)
Use dark colors for code blocksCopy
           
1
2
3
4
5
6
7
8
9
10
11
{
  "helperServices": {
    // Other parameters
    "analysis": {
      "url": "https://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer"
    },
    "geoenrichment": {
      "url": "https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer"
    }
  }
}

Join attributes from a feature layer

This example uses the JoinFeatures operation to join home value data to census blocks. The attributes of the points that intersect with the polygons are joined, allowing you to visualize the census blocks by the average home value (AVGVAL_CY) field.

In the analysis, the targetLayer value is the Census Blocks hosted feature layer. The joinLayer is the San Francisco housing data hosted feature layer. The spatialRelationship parameter is set to intersects.

Join analysis joining average home values from a census centroid layer to census blocks in San Francisco.

APIs

ArcGIS REST JSArcGIS REST JSArcGIS API for Python
Expand
Use dark colors for code blocksCopy
                                                                          
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  const operationUrl = `${analysisUrl}/JoinFeatures/submitJob`;

  const params = {

    targetLayer: {
      url:
        "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Census_blocks_within_San_Francisco/FeatureServer/0",
    },
    joinLayer: {
      url:
        "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Centroids_for_San_Francisco_housing/FeatureServer/0",
      filter: "AVGVAL_CY > 0",
    },
    joinOperation: "joinOneToOne",
    joinType: "inner",
    spatialRelationship: "intersects",
    outputName: { serviceProperties: { name: "Join features result" } }, //Outputs results as a hosted feature layer.

  };

  const jobReq = await Job.submitJob({
    url: operationUrl,
    params: params,
    authentication: auth,
  });

  // listen to the status event to get updates every time the job status is checked.
  jobReq.on(JOB_STATUSES.Status, jobInfo => {
    console.log(jobInfo.status);
  });

  // get all the results, this will start monitoring and trigger events
  const jobResp = await jobReq.getAllResults();

Service requests

Request
HTTPHTTPcURL
Use dark colors for code blocksCopy
     
1
2
3
4
5
POST arcgis.com/sharing/rest/portals/self HTTP/1.1
Content-Type: application/x-www-form-urlencoded

&f=json
&token=<ACCESS_TOKEN>
Response (JSON)
Use dark colors for code blocksCopy
           
1
2
3
4
5
6
7
8
9
10
11
{
  "helperServices": {
    // Other parameters
    "analysis": {
      "url": "https://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer"
    },
    "geoenrichment": {
      "url": "https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer"
    }
  }
}

Tutorials

Learn how to perform related analyses interactively with Map Viewer and programmatically with ArcGIS API for Python, ArcGIS REST JS, and ArcGIS REST API.

Services

Spatial analysis service

Process spatial datasets to discover relationships and patterns.

API support

Full supportPartial supportNo support
  • 1. Access with geoprocessing task
  • 2. Access via ArcGIS REST JS

Tools

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.