Intro to CatalogLayer

This sample demonstrates how to create and add a CatalogLayer to 3D SceneView. The CatalogLayer points to different portal items and services, helping you to organize and manage your data. It also makes it simpler for users to find information. Instead of manually gathering and adding each dataset separately in your map, you can create a CatalogLayer, a centralized reference point for all the data you need.

CatalogLayer has two types of subLayers which can be accessed via the footprintLayer and the dynamicGroupLayer properties. These two subLayers are grouped under the catalog layer, which manages their settings. Every catalog item (layer) in the CatalogLayer has a footprint stored in the footprintLayer. A footprint is a polygon feature that envelopes the item's features, rasters, and so forth. The dynamicGroupLayer dynamically updates to display catalog items (layers) in the current view. By default, it draws up to 10 layers at a time.

The catalog layer is initialized as shown below when the application loads:

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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
          // Create a new CatalogLayer instance from a portal item
          const layer = new CatalogLayer({
            portalItem: {
              id: "487cc66d305145d3b67fed383456af48",
              portal: {
                url: "https://jsapi.maps.arcgis.com/"
              }
            }
          });

The CatalogLayerList widget provides a way to display and interact with CatalogLayers. It displays a catalog layer's dynamic group layer. The catalog layer list will be displayed as an expandable ListItem in the LayerList widget. This property is set when a catalog layer's dynamic group layer is expanded in the LayerList.

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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
          // create a new LayerList widget and add catalogOptions to display and interact with CatalogLayers
          const layerList = new LayerList({
            catalogOptions: {
              selectionMode: "single"
            },
            // create a listItemCreatedFunction that adds an "add-layer" action to each catalog layer list item
            listItemCreatedFunction: (event) => {
              if (event.item.layer.type === "catalog") {
                event.item.open = true;
              }

              if (catalogUtils.isLayerFromCatalog(event.item.layer)) {
                event.item.actionsSections = [
                  [
                    {
                      title: "Add layer to map",
                      icon: "add-layer",
                      id: "add-layer"
                    }
                  ]
                ];
              }
            },
            visibilityAppearance: "checkbox",
            view
          });
          view.ui.add(layerList, "top-right");

Once the layer of interest is located in the catalog layer list, it can be add to the map, by clicking the Add layer to map button next to the layer. This action creates a new instance of a layer for the given layer in the dynamicGroupLayer based on its footprint feature. The instance of the footprint feature associated with the layer can be obtained by calling the CatalogLayer's createFootprintFromLayer() method. Then the footprint feature is used to create a new instance of the layer inside the footprint by calling the CatalogLayer's createLayerFromFootprint() method.

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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
          // Listen for the trigger-action event on the CatalogLayerListViewModel
          // and add layers from the catalog to the map when the "add-layer" action is triggered.
          // To correctly add a layer to the map, you must create a footprint from the layer
          // and then create a new layer from the footprint.
          reactiveUtils.on(
            () => layerList.catalogLayerList,
            "trigger-action",
            async (event) => {
              if (event.action.id === "add-layer") {
                // Get the parent catalog layer
                const parentCatalogLayer = catalogUtils.getCatalogLayerForLayer(event.item.layer);
                // Get the footprint from the parent catalog layer
                const footprint = parentCatalogLayer.createFootprintFromLayer(event.item.layer);
                // Get the layer from the footprint
                const layerFromFootprint = await parentCatalogLayer.createLayerFromFootprint(footprint);
                // Add the layer to the map
                map.add(layerFromFootprint);
              }
            }
          );

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