Configuring the popup of a VoxelLayer

This sample shows how to configure the popup of a VoxelLayer using the popupTemplate.

You can use VoxelLayer.fields to list all available fixed fields and the voxel variables. A VoxelLayer always has the fixed fields Voxel.Position and Voxel.CurrentVariable. The Voxel.CurrentVariable is the voxel variable currently being displayed. A VoxelLayer will have additional fixed fields depending on the voxel's volume. If the dataset has Z coordinates, the Voxel.Depth field is added and if the dataset has time coordinates, the Voxel.LocalTime and the Voxel.SourceTime fields are added.

You can configure the popup of a VoxelLayer by using the properties fieldInfos and content. The VoxelLayer supports the popup elements: fields, media and text.

The sample code below shows how to define the fields to be displayed within the content.

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
        // Define the fields (or voxel variables) to be displayed
        const contentFieldInfo = [
          {
            fieldName: "lithok",
            label: "Most likely lithological class",
            visible: true
          },
          {
            fieldName: "strat",
            label: "Geological unit",
            visible: true
          },
          {
            fieldName: "Voxel.Depth",
            label: "Depth (in meters)"
          }
        ];

The code below shows how to add text, fields and media in the popup's content.

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
        // Create a popupTemplate
        const voxelPopupTemplate = {
          title: "GeoTOP v1.6",
          content: [
            {
              type: "text",
              text: "Current Variable: {Voxel.CurrentVariable}"
            },
            // The fields to be displayed in the popup's content
            {
              type: "fields",
              fieldInfos: contentFieldInfo,
              title: "<span style='font-size:13px;'>Voxel Position {Voxel.Position}:</span>"
            },
            // Adding a pie chart by using the element media
            {
              type: "media",
              title:
                "<div style='margin-bottom:5px'>Probability distribution of lithological class</div>" +
                probabilityTitle,
              mediaInfos: [
                {
                  type: "pie-chart",
                  value: {
                    fields: probabilityFields, // An array of fields
                    colors: probabilityColors // An array of colors
                  },
                  caption:
                    "<div>Click <a href='https://www.dinoloket.nl/en/detailing-the-upper-layers-with-geotop' target='_blank'>here</a> to know more about the GeoTOP model</div>"
                }
              ]
            },
            // Adding a bar chart by using the element media
            {
              type: "media",
              title:
                "<div style='margin-bottom:5px'>Model Uncertainty</div><div style='font-size:11px'><span style='width:10px;height:10px;display:inline-block;background-color:rgb(50, 115, 168)'></span><span>&nbsp;Geological unit</span></div><div style='font-size:11px'><span style='width:10px;height:10px;display:inline-block;background-color:rgb(219, 132, 81)'></span><span>&nbsp;Lithological class</span></div>",
              mediaInfos: [
                {
                  type: "bar-chart",
                  value: {
                    fields: ["onz_ls", "onz_lk"],
                    colors: [
                      [50, 115, 168, 1],
                      [219, 132, 81, 1]
                    ]
                  },
                  caption: "<div style='margin-top:-20px;font-size:11px'>0% very certain to 100% very uncertain</div>"
                }
              ]
            },
            {
              type: "text",
              text: "<strong>Data by:</strong> <a href='https://www.dinoloket.nl/en/modelbestanden-aanvragen/netcdf'>TNO - Geological Survey of the Netherlands</a>"
            }
          ],
          // Change the labels of the fields used in the charts
          fieldInfos: [
            {
              fieldName: "onz_ls",
              label: "Geological Unit",
              visible: true
            },
            {
              fieldName: "onz_lk",
              label: "Lithological class",
              visible: true
            },
            {
              fieldName: "kans_1",
              label: "Organic material (peat)",
              visible: true
            },
            {
              fieldName: "kans_2",
              label: "Clay",
              visible: true
            },
            {
              fieldName: "kans_3",
              label: "Clayey sand, sandy clay and loam",
              visible: true
            },
            {
              fieldName: "kans_5",
              label: "Fine sand",
              visible: true
            },
            {
              fieldName: "kans_6",
              label: "Medium sand",
              visible: true
            },
            {
              fieldName: "kans_7",
              label: "Coarse sand",
              visible: true
            },
            {
              fieldName: "kans_8",
              label: "Gravel",
              visible: true
            },
            {
              fieldName: "kans_9",
              label: "Shells",
              visible: true
            }
          ]
        };

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