Thematic visualization with realistic 3D symbols

This sample demonstrates how to visualize 2D point features based on real-world measurements in a 3D SceneView. The layer in this app contains point data representing tree locations. This data has multiple fields for measurements of each tree, and we'll use them to create symbols that represent the real-world sizes and shapes of each tree in relation to other map features, regardless of scale. In this case, we'll use a SimpleRenderer with three size visual variables and one color visual variable to model the size and shape of each tree based as it exists in the real world.

Prior to completing the following steps, you should be familiar with views, Map, and FeatureLayer. If necessary, complete the following tutorials first:

1. Create a SimpleRenderer for trees

Create a SimpleRenderer and set a default symbol on the symbol property of the renderer. In this case, we'll create a WebStyleSymbol depicting a realistic tree. ArcGIS Online provides many realistic 3D symbols out of the box. In this case we select a generic tree from the EsriRealisticTreesStyle style group. We also assign the visual variables that will be explained in the next step.

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
      const renderer = {
        type: "simple", // autocasts as new SimpleRenderer()
        symbol: {
          type: "web-style", // autocasts as new WebStyleSymbol()
          styleName: "EsriRealisticTreesStyle",
          name: "Other",
        },
        label: "tree",
        visualVariables: visualVariables, // set the visualVariables defined separately
      };

To read more in depth about WebStyleSymbols and their relationship to PointSymbol3D, see the Visualize features with realistic WebStyleSymbols sample.

2. Set visual variables on the renderer

When defining the size of any WebStyleSymbol or ObjectSymbol3DLayer, there are three axes that need to be considered: height (z-axis), width (diameter in east-west axis), and depth (diameter in north-south axis). Each of them can be based on a separate field value that is set with a separate size visual variable. If the values of each axis are equal, then only one size visual variable is required with axis set to "all".

The tree data has three fields storing its respective dimensions: Height (height in feet), Width_EW (diameter in feet from east to west), and Width_NS (diameter in feet from north to south). Since these values differ for each tree, the symbols will better show the varying shapes of the trees.

Adding a color visual variable to the tree representation can make it even more insightful. Since the data contains carbon storage information for each tree, we'll assign each tree a color ranging from pale yellow to a deeper green based on the amount of carbon storage measured and recorded in the data. This same concept is discussed in the Scale feature sizes based on real world sizes (2D) sample.

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
      const visualVariables = [
        {
          type: "size",
          axis: "height", // specify which axis to apply the data values to
          field: "Height", // tree height in feet
          valueUnit: "feet",
        },
        {
          type: "size",
          axis: "width", // specify which axis to apply the data values to
          field: "Width_EW", // tree diameter in feet from east to west
          valueUnit: "feet",
        },
        {
          type: "size",
          axis: "depth", // specify which axis to apply the data values to
          field: "Width_NS", // tree diameter in feet from north to south
          valueUnit: "feet",
        },
        {
          type: "color",
          field: "C_Storage", // Carbon storage
          stops: [
            {
              value: 0,
              color: "#f7fcb9",
            }, // features with zero carbon
            {
              value: 10000,
              color: "#31a354",
            }, // features with 10000 carbon
          ],
          legendOptions: {
            title: "Carbon Storage",
          },
        },
      ];

3. Apply the renderer to the layer

Once the renderer is defined, you can set it on the layer and the view will automatically update. Click the sandbox button above to see the full code of this app.

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
      // Construct the layer and set the renderer and popupTemplate on it
      const treesLayer = new FeatureLayer({
        url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0",
        renderer: renderer, // set the renderer defined earlier
        outFields: ["*"],
        popupTemplate: {
          // autocasts as new PopupTemplate()
          title: "{Cmn_Name}",
          content:
            "<i>{Sci_Name}</i><br>" +
            "This tree is in {Condition} condition and is {Height} feet in height.",
        },
      });
Image preview of related sample Realistic WebStyleSymbols

Realistic WebStyleSymbols

Visualize features with realistic WebStyleSymbols

Image preview of related sample Scale feature sizes based on real world sizes (2D)

Scale feature sizes based on real world sizes (2D)

Scale feature sizes based on real world sizes (2D)

Image preview of related sample Extrude building footprints based on real world heights

Extrude building footprints based on real world heights

Extrude building footprints based on real world heights

Image preview of related sample Data-driven continuous color

Data-driven continuous color

Data-driven continuous color

Image preview of related sample Data-driven continuous size

Data-driven continuous size

Data-driven continuous size

Image preview of related sample Data-driven extrusion

Data-driven extrusion

Data-driven extrusion

Image preview of related sample Thematic multivariate visualization (2D)

Thematic multivariate visualization (2D)

Thematic multivariate visualization (2D)

Image preview of related sample Thematic multivariate visualization (3D)

Thematic multivariate visualization (3D)

Thematic multivariate visualization (3D)

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