Data-driven extrusion

This sample demonstrates how to apply a size visual variable to extrude features thematically based on a numeric field value. The same basic principles of working with size visual variables reviewed in the Visualize features thematically with a continuous size ramp sample also apply to 3D thematic visualizations.

However, when working with volumetric symbol layers such as ExtrudeSymbol3DLayer, PathSymbol3DLayer, and ObjectSymbol3DLayer size values are always expressed in real-world units (meters).

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
const renderer = {
  type: "simple", // autocasts as new SimpleRenderer()
  symbol: {
    type: "polygon-3d", // autocasts as new PolygonSymbol3D()
    symbolLayers: [{ type: "extrude" }] // autocasts as new ExtrudeSymbol3DLayer()
  },
  label: "% population in poverty by county",
  visualVariables: [
    {
      type: "size", // indicates this is a size visual variable
      field: "POP_POVERTY", // total population in poverty
      normalizationField: "TOTPOP_CY", // total population
      stops: [
        {
          value: 0.1, // features where < 10% of the pop in poverty
          size: 10000 // will be extruded by this height in meters
        },
        {
          value: 0.5, // features where > 50% of the pop in poverty
          size: 500000 // will be extruded by this height in meters
        }
      ]
    },
    {
      type: "color",
      field: "POP_POVERTY",
      normalizationField: "TOTPOP_CY",
      stops: [
        {
          value: 0.1,
          color: "#FFFCD4"
        },
        {
          value: 0.35,
          color: [153, 83, 41]
        }
      ]
    }
  ]
};

In 3D, attempting to distinguish features of varying sizes from various distances can be problematic. Because of perspective, it is difficult to perceive spatial size differences between features. For that reason it is a good idea to add a color visual variable for the same field when extruding features thematically.

Additional visualization samples and resources

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