ArcGIS API for JavaScript
Go to Latest version (official documentation)
ArcGIS Web API JavaScript API 4.4 Sample Code

ArcGIS API for JavaScript

Home Guide API Reference Sample Code Forum

Get Started

Overview

Latest Samples

WMTSLayer
Select WMTS sublayer
WMSLayer
Generate data-driven visualization of unique values
Generate continuous color visualization for 3D buildings
Reference Arcade expressions in PopupTemplate
PopupTemplate with promise
Highlight point features
Highlight SceneLayer
Point styles for cities
Using callout lines with labels
Coloring options for textured buildings
Intensity color modulation
Zoom to extent of features
Disable panning on the view
Disable rotation on the view
Disable scroll-zooming on the view
Disable all zooming on the view
Custom Tile Layer
Custom Dynamic Layer
Custom Lerc Layer
Custom Blend Layer
Custom ElevationLayer - Exaggerating elevation
Custom ElevationLayer - Thematic data as elevation
Swap view from 2D to 3D
Draw polygon for spatial query
Measure while drawing
Print widget vector tiles

Mapping and Views

Get started with MapView (2D)
Get started with SceneView (3D)
Load a basic web map
Load a basic web scene
Save a web scene
Web scene - slides
Create a local scene
SceneView - goTo()
View padding
Create a custom basemap
Swap web maps in the same view
Swap view from 2D to 3D

Layers

Get started with layers
Create layer from portal item
VectorTileLayer
IntegratedMeshLayer
StreamLayer
CSVLayer
OpenStreetMapLayer
WebTileLayer
WMSLayer
WMTSLayer
Select WMTS sublayer
GeoRSSLayer

FeatureLayer

Get started with FeatureLayer
Drawing improvements
Created from array of graphics
FeatureLayerView - query
Highlight point features

SceneLayer

Get started with SceneLayer
Realistic buildings
Coloring options for textured buildings
Point geometries
Filter and query
SceneLayerView - query
Highlight SceneLayer

MapImageLayer

Get started with MapImageLayer
Toggle sublayer visibility
Set definition expressions on sublayers
Set renderers on sublayers
Label sublayer features
Create dynamic map layers
Dynamic data layer with table join
Dynamic data layer with query table
Dynamic data layer with raster data

ImageryLayer

Get started with ImageryLayer
Client side pixel filter
Server side raster function
Client side rendering rules
Raster attribute table

PointCloudLayer

Get started with PointCloudLayer
Toggle visualizations
Change point size and density
Intensity color modulation

Custom Layers

Custom Tile Layer
Custom Dynamic Layer
Custom Lerc Layer
Custom Blend Layer
Custom ElevationLayer - Exaggerating elevation
Custom ElevationLayer - Thematic data as elevation

Visualization

Symbol Playground
Visualize features by unique types
Visualize data with class breaks
Generate data-driven continuous color visualization
Generate data-driven visualization of unique values
Generate continuous color visualization for 3D buildings
Data-driven continuous color
Data-driven continuous size
Data-driven extrusion
Multivariate visualizations (3D)
Create a custom visualization using Arcade
Visualize features with realistic WebStyleSymbols
Point styles for cities
Using callout lines with labels

Popups

Get started with popups
Get started with PopupTemplate
Dock popup positions
Multiple popup elements
Reference Arcade expressions in PopupTemplate
PopupTemplate with functions
PopupTemplate with promise
Popup actions
Custom popup actions per feature

Editing

FeatureLayer applyEdits

Graphics

Get started with graphics
Add graphics to a SceneView

Searching

Search widget
Search widget with multiple sources
Query features from a FeatureLayer
SceneLayer - query a linked FeatureLayer
QueryTask
FindTask
IdentifyTask

Analysis

GeometryEngine - geodesic buffers
Geoprocessing - viewshed analysis
Geoprocessing - hotspot analysis
RouteTask
Query Elevation (points)
Query Elevation (lines)

Widgets

Get started with widgets
BasemapGallery widget
LayerList widget
LayerList widget with actions
Legend widget
Locate button
Print widget
Print widget vector tiles
Track current location
Track widget simulation
Expand widget
Using the view's UI
Responsive widgets

Widgets (Advanced)

Create a custom widget
Custom Recenter widget
Using widgets with Angular
Using widgets with React
Using widgets with Riot
Custom widgets with Vue

More 3D

Toggle ground elevation
Look around camera position
Realistic environment settings
SceneView - environment settings
Elevation offset
ElevationLayer
Satellites in 3D view

Workflows

Get started with Workflow Manager

Other

Draw polygon for spatial query
Measure while drawing
Request data from a remote server
Access ArcGIS Online items via OAuth
Chaining promises
Access features with click events
Synchronize MapView and SceneView
Calcite Maps and Bootstrap
Using Esri Icon Fonts
Watch for changes
Zoom to extent of features
Drag and drop portal items
Disable panning on the view
Disable rotation on the view
Disable scroll-zooming on the view
Disable all zooming on the view
Back to Top
Back to Top

MapImageLayer - dynamic data layer with table join

This device does not support 3D.

View the system requirements for more information.

Explore in the sandboxJS BinView live

This sample demonstrates how to add a sublayer from a joined table data source in a MapImageLayer. This is useful for scenarios when you want to access and visualize data from a non-geographic table containing records that correspond to geometries in a map service sublayer.

The table must exist in a registered dynamic workspace in your Map Server. In this sample, we create a MapImageLayer from a map service containing census data in various jurisdictions. An "ancestry" table was published in a registered workspace, which contains the total number of people in each U.S. state who can trace ancestry to a number of different origins. That data is made available to the view by creating a dynamic layer with a table join. To join the table to the states map service layer you must do the following.

First, construct the MapImageLayer with one sublayer. Since the sublayer will be dynamically created from data not visible in the services directory we need to specify the source of the data. In this case it is a joined table.

source: {
  type: "data-layer",
  dataSource: {
    type: "join-table"
  }
}

Then we need to define the sources of the join: a left table and a right table. Typically the left table will be the table containing the geometries. In this case, it is a map service layer viewable in the services directory. Since it has a layer ID of 3, we need to indicate that in the object for the leftTableSource.

source: {
  type: "data-layer",
  dataSource: {
    type: "join-table",
    leftTableSource: {
      type: "map-layer",
      mapLayerId: 3
    }
  }
}

The rightTableSource is the table containing ancestry numbers for each state. Since this isn't a map service layer, we should indicate it as a data layer with a table data source since it is a single table. The table data source must indicate the workspace ID where the table is located and the table's name.

source: {
  type: "data-layer",
  dataSource: {
    type: "join-table",
    leftTableSource: {
      type: "map-layer",
      mapLayerId: 3
    },
    rightTableSource: {
      type: "data-layer",
      dataSource: {
        type: "table",
        workspaceId: "CensusFileGDBWorkspaceID",
        dataSourceName: "ancestry"
      }
    }
  }
}

Because the rightTableSource is another data layer, you can create a nested table join by setting the dataSource of that object to be another table join.

To complete this join operation, however, you must provide the primary key, or field name, from the left table and the foreign key, or field name, from the right table. This matches the records from the non-geographic ancestry table to the map service layer containing geometries.

Finally, you must specify the type of the join. In this case, it is a left outer join so we can retain records that don't match in the map service layer. The final source object should look like the following in the context of the MapImageLayer:

var layer = new MapImageLayer({
  url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer",
  sublayers: [{
    // This ID does not relate to a service layer ID. It can be
    // anything you want it to be.
    id: 0,
    renderer: renderer,
    opacity: 0.75,
    source: {
      type: "data-layer",
      dataSource: {
        type: "join-table",
        leftTableSource: {
          type: "map-layer",
          mapLayerId: 3
        },
        rightTableSource: {
          type: "data-layer",
          dataSource: {
            type: "table",
            workspaceId: "CensusFileGDBWorkspaceID",
            dataSourceName: "ancestry"
          }
        },
        leftTableKey: "STATE_NAME",
        rightTableKey: "State",
        joinType: "left-outer-join"
      }
    }
  }]
});

You can view this dynamic join in the services directory by accessing the request to the server via the Network traffic in your browser's developer tools. View this table join and note the fields from both tables present in the directory. You can query the dynamic layer as you would any other layer.

When setting renderers or popups on the layer, you must prefix field values by the origin table name. Since we're visualizing the percentage of the population with Norwegian ancestry, we would reference fields in the following manner in the context of the renderer:

var renderer = new ClassBreaksRenderer({
  field: "ancestry.Norwegian",
  normalizationField: "states.POP2007",
  normalizationType: "field",
  classBreakInfos: [ ... ]
});
Tags

MapImageLayer,dynamic,layer,dynamicmaplayer,dynamicdatalayer,table join,join,table source,2D,MapView,sublayer,4.1

5 results for Sample Code:"table join"

Tagstable, join
layers-dynamicdatalayer-table-join

MapImageLayer - dynamic data layer with table join

layers-dynamicdatalayer-query-table

MapImageLayer - dynamic data layer with query table

layers-mapimagelayer-sublayers

MapImageLayer - Toggle sublayer visibility

widgets-layerlist

LayerList widget

widgets-layerlist-actions

LayerList widget with actions

TitleSample
MapImageLayer - dynamic data layer with table joinExplore in the sandboxSandboxJS BinView live
MapImageLayer - dynamic data layer with query tableExplore in the sandboxSandboxJS BinView live
MapImageLayer - Toggle sublayer visibilityExplore in the sandboxSandboxJS BinView live
LayerList widgetExplore in the sandboxSandboxJS BinView live
LayerList widget with actionsExplore in the sandboxSandboxJS BinView live

There were no match results from your search criteria.

Feedback on this topic?
ArcGIS for Developers
  • Home
  • Features
  • Documentation
  • Support
  • Pricing
  • Startups
  • Blog
ArcGIS Platform
  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace
About Esri
  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit

Copyright © 2017 Esri. All rights reserved. | Privacy | Terms of use | Plain English | FAQ