Module 13 - Symbols: 2D and 3D

Level 3 · Symbology & Arcade · 🟡 · 3 hours · Prereq: Module 12


What you'll build

A symbol gallery: every 2D and 3D symbol type rendered side by side with live controls, so you have a visual reference you can come back to. Plus a symbolFor(geometryType, viewType) helper that picks the right class automatically.


Why this matters

Choosing the wrong symbol class produces one of two failures: an error you can't parse (Invalid symbol type for geometry), or - worse - silence. A SimpleMarkerSymbol on a polygon layer in a SceneView just doesn't draw, and nothing tells you why.

Once you know the matrix, that entire class of bug disappears.


Concepts

1. The compatibility matrix - memorise this

Geometry 2D (MapView) 3D (SceneView)
Point SimpleMarkerSymbol, PictureMarkerSymbol, TextSymbol, CIMSymbol PointSymbol3D
Polyline SimpleLineSymbol, CIMSymbol LineSymbol3D
Polygon SimpleFillSymbol, PictureFillSymbol, CIMSymbol PolygonSymbol3D
Mesh - MeshSymbol3D

2D symbols work in a SceneView in many cases - the SDK draws them as flat billboards. 3D symbols never work in a MapView. When in doubt in 3D, use the 3D symbol.

2. 2D symbols

// Point
{
  type: "simple-marker",
  style: "circle",          // circle | square | cross | x | diamond | triangle | path
  color: [0, 102, 255, 0.9],
  size: 12,                 // points, not pixels - 1pt ≈ 1.33px
  angle: 0,
  xoffset: 0, yoffset: 0,
  outline: { color: "white", width: 1.5, style: "solid" },
}

// Point from an SVG path - any shape you want
{
  type: "simple-marker",
  style: "path",
  path: "M 0,-10 L 6,6 L -6,6 Z",     // an SVG path string
  color: "#e63946",
  size: 18,
  outline: { color: "white", width: 1 },
}

// Point from an image
{
  type: "picture-marker",
  url: "/icons/hospital.png",         // or a data: URI
  width: "24px",
  height: "24px",
  angle: 0,
}

// Line
{
  type: "simple-line",
  color: "#2b5797",
  width: 2,
  style: "solid",           // solid | dash | dot | dash-dot | long-dash | short-dot | none
  cap: "round",             // butt | round | square
  join: "round",            // miter | round | bevel
}

// Polygon
{
  type: "simple-fill",
  style: "solid",           // solid | backward-diagonal | cross | diagonal-cross |
                            // forward-diagonal | horizontal | vertical | none
  color: [0, 102, 255, 0.25],
  outline: { color: "#0066ff", width: 1.5 },
}

// Polygon filled with a repeating image
{
  type: "picture-fill",
  url: "/patterns/wetland.png",
  width: "24px", height: "24px",
  outline: { color: "#3a7", width: 1 },
}

Colour accepts five forms, all equivalent:

color: "red"
color: "#0066ff"
color: "rgba(0, 102, 255, 0.5)"
color: [0, 102, 255]           // rgb, alpha defaults to 1
color: [0, 102, 255, 0.5]      // ← note: alpha is 0-1, but if you use `new Color()`
                               //   with an array, alpha is also 0-1. Some older docs
                               //   show 0-255; that is the Esri JSON REST form, not this.

style: "none" on a fill gives you an outline-only polygon. Useful for boundaries you want visible but not shaded.

3. 3D symbols - a symbol is a container of symbol layers

This is the structural difference and the thing that trips people up.

{
  type: "point-3d",              // the SYMBOL
  symbolLayers: [                // an array of SYMBOL LAYERS
    { type: "icon", ... },
  ],
}

A 3D symbol can stack several layers - an icon and a callout line, or an extrusion and an outline. That's why the array exists.

PointSymbol3D layers

// Flat billboard icon that always faces the camera
{
  type: "point-3d",
  symbolLayers: [{
    type: "icon",
    size: 12,
    resource: { primitive: "circle" },   // circle | square | cross | x | kite | triangle
    material: { color: "#0066ff" },
    outline: { color: "white", size: 1 },
  }],
  verticalOffset: { screenLength: 30, maxWorldLength: 200, minWorldLength: 20 },
  callout: { type: "line", size: 1.5, color: "white",
             border: { color: [50, 50, 50] } },
}

// A real 3D object with real-world dimensions
{
  type: "point-3d",
  symbolLayers: [{
    type: "object",
    resource: { primitive: "cylinder" },  // sphere | cylinder | cube | cone | diamond |
                                          // tetrahedron | inverted-cone
    material: { color: "#ff8c00" },
    width: 8, depth: 8, height: 30,       // METRES
    anchor: "bottom",                     // where the origin sits
  }],
}

// An imported glTF model
{
  type: "point-3d",
  symbolLayers: [{
    type: "object",
    resource: { href: "/models/tree.glb" },
    height: 12,
    anchor: "bottom",
  }],
}

// Text floating in 3D
{
  type: "point-3d",
  symbolLayers: [{
    type: "text",
    text: "Site A",
    material: { color: "white" },
    halo: { color: "#333", size: 1 },
    size: 12,
  }],
}

verticalOffset + callout is the pattern for readable 3D point labels. The symbol floats above the terrain/building at a fixed screen distance, with a leader line back to its real position. Without it, points inside a city model are buried.

LineSymbol3D layers

// Flat ribbon on the ground
{ type: "line-3d", symbolLayers: [{ type: "line", size: 3, material: { color: "#e63946" } }] }

// A real 3D tube - think pipes, cables
{ type: "line-3d", symbolLayers: [{
  type: "path",
  profile: "circle",              // circle | quad
  width: 2, height: 2,            // METRES
  material: { color: "#8a6d3b" },
  cap: "round", join: "round",
  castShadows: true,
}]}

PolygonSymbol3D layers

// Flat fill
{ type: "polygon-3d", symbolLayers: [{ type: "fill",
    material: { color: [0,102,255,0.3] },
    outline: { color: "#0066ff", size: 1.5 } }] }

// Extruded - the classic building block
{ type: "polygon-3d", symbolLayers: [{
    type: "extrude",
    size: 30,                                    // METRES of extrusion
    material: { color: "#c9c9c9" },
    edges: { type: "solid", color: [50,50,50,0.6], size: 1 },
}]}

// Animated water
{ type: "polygon-3d", symbolLayers: [{
    type: "water",
    waveDirection: 260,
    color: "#1b4b6b",
    waveStrength: "moderate",     // calm | rippled | slight | moderate
    waterbodySize: "medium",      // small | medium | large
}]}

MeshSymbol3D

{ type: "mesh-3d", symbolLayers: [{
    type: "fill",
    material: { color: "#d9d9d9", colorMixMode: "replace" },
    edges: { type: "solid", color: [30,30,30,0.5], size: 1 },
}]}

colorMixMode: "multiply" (default, tints the existing texture), "replace" (ignores it), "tint", "none".

4. Edges, not outlines - the 3D rule that saves you an afternoon

On a 3D symbol layer, outline does nothing for extrusions and meshes. You need edges:

// ❌ silently ignored on an extrude layer
{ type: "extrude", size: 30, material: {...}, outline: { color: "black", width: 1 } }

// ✅
{ type: "extrude", size: 30, material: {...},
  edges: { type: "solid", color: [50,50,50,0.6], size: 1 } }

Two edge types:

  • "solid" - clean CAD-like lines
  • "sketch" - hand-drawn, with extensionLength for overshoot

outline is honoured on flat symbol layers (fill on a polygon-3d drawn on the ground, and icon). That inconsistency is why this has its own section.

This repository's symbology editor implements exactly this rule - applyEdgesToRenderer sets edges on fill/extrude layers and outline only on flat 2D symbols, so one UI control covers both. See ContentsPanel.jsx.

5. Units - the other 3D trap

Property Unit
2D size, width points (typographic; ~1.33 px)
icon symbol layer size points - screen size, constant at any zoom
object symbol layer width/depth/height metres - real-world size
extrude size metres
path width/height metres
verticalOffset.screenLength points
verticalOffset.min/maxWorldLength metres

icon scales with the screen; object scales with the world. Zoom out and icons stay the same size while objects shrink. Choosing between them is a design decision:

  • Use icon when the point is a marker (a POI, a sensor reading)
  • Use object when the point represents something with real size (a tree, a lamp post, a wind turbine)

6. CIMSymbol - the escape hatch

Cartographic Information Model symbols support multi-layer 2D symbology with dash patterns, markers along lines, offsets and effects - everything ArcGIS Pro can do.

import CIMSymbol from "@arcgis/core/symbols/CIMSymbol.js";

const oneWayStreet = new CIMSymbol({
  data: {
    type: "CIMSymbolReference",
    symbol: {
      type: "CIMLineSymbol",
      symbolLayers: [
        // Arrow markers placed along the line
        {
          type: "CIMVectorMarker",
          enable: true,
          size: 5,
          markerPlacement: {
            type: "CIMMarkerPlacementAlongLineSameSize",
            endings: "WithMarkers",
            placementTemplate: [20],
          },
          frame: { xmin: -3, ymin: -3, xmax: 3, ymax: 3 },
          markerGraphics: [{
            type: "CIMMarkerGraphic",
            geometry: { rings: [[[-2,-2],[2,0],[-2,2],[-2,-2]]] },
            symbol: { type: "CIMPolygonSymbol", symbolLayers: [
              { type: "CIMSolidFill", enable: true, color: [255,255,255,255] },
            ]},
          }],
        },
        // The line itself, underneath
        {
          type: "CIMSolidStroke",
          enable: true,
          width: 4,
          color: [70, 70, 70, 255],
        },
      ],
    },
  },
});

Verbose, and worth it for arrows on one-way streets, railway hatching, or matching an existing Pro map exactly. Note CIM colours are 0-255 including alpha, unlike the simple symbols. Build them in ArcGIS Pro and export, rather than hand-writing.


Build it - the symbol gallery

Step 1 - Sample geometry

// src/sampleGeometry.js
const CENTRE = [-76.481, 44.231];

/** A grid of points around a centre, for laying out symbol examples. */
export function pointGrid(cols, rows, spacingDegrees = 0.012) {
  const points = [];
  for (let row = 0; row < rows; row++) {
    for (let col = 0; col < cols; col++) {
      points.push({
        type: "point",
        longitude: CENTRE[0] + (col - (cols - 1) / 2) * spacingDegrees,
        latitude:  CENTRE[1] - (row - (rows - 1) / 2) * spacingDegrees * 0.72,
        spatialReference: { wkid: 4326 },
      });
    }
  }
  return points;
}

export function squareAt([lon, lat], sizeDegrees = 0.004) {
  const h = sizeDegrees / 2;
  return {
    type: "polygon",
    rings: [[
      [lon - h, lat - h], [lon + h, lat - h],
      [lon + h, lat + h], [lon - h, lat + h],
      [lon - h, lat - h],                        // closed
    ]],
    spatialReference: { wkid: 4326 },
  };
}

export function lineAt([lon, lat], lengthDegrees = 0.008) {
  return {
    type: "polyline",
    paths: [[[lon - lengthDegrees / 2, lat], [lon + lengthDegrees / 2, lat]]],
    spatialReference: { wkid: 4326 },
  };
}

Step 2 - 2D gallery

// src/gallery2d.js
import Graphic from "@arcgis/core/Graphic.js";
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
import { pointGrid, squareAt, lineAt } from "./sampleGeometry.js";

const MARKER_STYLES = ["circle", "square", "cross", "x", "diamond", "triangle"];
const LINE_STYLES = ["solid", "dash", "dot", "dash-dot", "long-dash", "short-dot"];
const FILL_STYLES = ["solid", "backward-diagonal", "cross", "diagonal-cross",
                     "forward-diagonal", "horizontal"];

export function build2dGallery() {
  const layer = new GraphicsLayer({ title: "2D symbols" });
  const points = pointGrid(6, 3);

  // Row 1 - marker styles
  MARKER_STYLES.forEach((style, i) => {
    layer.add(new Graphic({
      geometry: points[i],
      symbol: {
        type: "simple-marker", style,
        color: "#0066ff", size: 16,
        outline: { color: "white", width: 1.5 },
      },
      attributes: { label: `simple-marker / ${style}` },
      popupTemplate: { title: "{label}" },
    }));
  });

  // Row 2 - line styles
  LINE_STYLES.forEach((style, i) => {
    const p = points[6 + i];
    layer.add(new Graphic({
      geometry: lineAt([p.longitude, p.latitude]),
      symbol: { type: "simple-line", style, color: "#e63946", width: 3 },
      attributes: { label: `simple-line / ${style}` },
      popupTemplate: { title: "{label}" },
    }));
  });

  // Row 3 - fill styles
  FILL_STYLES.forEach((style, i) => {
    const p = points[12 + i];
    layer.add(new Graphic({
      geometry: squareAt([p.longitude, p.latitude]),
      symbol: {
        type: "simple-fill", style,
        color: [0, 102, 255, 0.4],
        outline: { color: "#0066ff", width: 1.5 },
      },
      attributes: { label: `simple-fill / ${style}` },
      popupTemplate: { title: "{label}" },
    }));
  });

  return layer;
}

Step 3 - 3D gallery

// src/gallery3d.js
import Graphic from "@arcgis/core/Graphic.js";
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
import { pointGrid, squareAt } from "./sampleGeometry.js";

const PRIMITIVES = ["sphere", "cylinder", "cube", "cone", "diamond", "tetrahedron"];

export function build3dGallery() {
  const layer = new GraphicsLayer({
    title: "3D symbols",
    // Without this, graphics sit at Z=0 (sea level) and vanish under terrain
    elevationInfo: { mode: "on-the-ground" },
  });

  const points = pointGrid(6, 3);

  // Row 1 - object primitives, sized in METRES
  PRIMITIVES.forEach((primitive, i) => {
    layer.add(new Graphic({
      geometry: points[i],
      symbol: {
        type: "point-3d",
        symbolLayers: [{
          type: "object",
          resource: { primitive },
          material: { color: "#ff8c00" },
          width: 60, depth: 60, height: 120,
          anchor: "bottom",
        }],
      },
      attributes: { label: `object / ${primitive}` },
      popupTemplate: { title: "{label}" },
    }));
  });

  // Row 2 - icons with callouts (screen-sized, always readable)
  ["circle", "square", "cross", "x", "kite", "triangle"].forEach((primitive, i) => {
    layer.add(new Graphic({
      geometry: points[6 + i],
      symbol: {
        type: "point-3d",
        symbolLayers: [{
          type: "icon",
          resource: { primitive },
          material: { color: "#0066ff" },
          size: 16,
          outline: { color: "white", size: 1 },
        }],
        verticalOffset: { screenLength: 40, maxWorldLength: 500, minWorldLength: 20 },
        callout: { type: "line", size: 1.5, color: "white",
                   border: { color: [60, 60, 60] } },
      },
      attributes: { label: `icon / ${primitive} + callout` },
      popupTemplate: { title: "{label}" },
    }));
  });

  // Row 3 - extrusions at different heights, with edges
  [10, 25, 50, 90, 140, 200].forEach((height, i) => {
    const p = points[12 + i];
    layer.add(new Graphic({
      geometry: squareAt([p.longitude, p.latitude], 0.003),
      symbol: {
        type: "polygon-3d",
        symbolLayers: [{
          type: "extrude",
          size: height,
          material: { color: "#b9c4d6" },
          // `edges`, NOT `outline` - outline is ignored on an extrude layer
          edges: { type: "solid", color: [40, 40, 40, 0.6], size: 1 },
        }],
      },
      attributes: { label: `extrude / ${height} m` },
      popupTemplate: { title: "{label}" },
    }));
  });

  return layer;
}

Run both. Put the 2D gallery in a MapView and the 3D one in a SceneView, side by side. Tilt the scene and watch what happens to icon (constant screen size) versus object (shrinks with distance). That single observation is the module.

Step 4 - The helper you'll actually reuse

// src/symbolFor.js

/**
 * Pick a sensible default symbol for a geometry type and view type.
 * Returns a plain object suitable for autocasting.
 *
 * @param {"point"|"multipoint"|"polyline"|"polygon"|"mesh"} geometryType
 * @param {"2d"|"3d"} viewType
 * @param {{color?: string, size?: number, extrudeHeight?: number}} [options]
 */
export function symbolFor(geometryType, viewType, options = {}) {
  const { color = "#0066ff", size = 10, extrudeHeight = null } = options;

  if (viewType === "3d") {
    switch (geometryType) {
      case "point":
      case "multipoint":
        return {
          type: "point-3d",
          symbolLayers: [{
            type: "icon",
            resource: { primitive: "circle" },
            material: { color },
            size,
            outline: { color: "white", size: 1 },
          }],
        };

      case "polyline":
        return {
          type: "line-3d",
          symbolLayers: [{ type: "line", size: Math.max(size / 3, 1), material: { color } }],
        };

      case "polygon":
        return {
          type: "polygon-3d",
          symbolLayers: extrudeHeight
            ? [{ type: "extrude", size: extrudeHeight, material: { color },
                 edges: { type: "solid", color: [50, 50, 50, 0.6], size: 1 } }]
            : [{ type: "fill", material: { color },
                 outline: { color: "white", size: 1 } }],
        };

      case "mesh":
        return {
          type: "mesh-3d",
          symbolLayers: [{ type: "fill", material: { color, colorMixMode: "replace" } }],
        };

      default:
        throw new Error(`No 3D symbol for geometry type "${geometryType}"`);
    }
  }

  switch (geometryType) {
    case "point":
    case "multipoint":
      return { type: "simple-marker", style: "circle", color, size,
               outline: { color: "white", width: 1 } };
    case "polyline":
      return { type: "simple-line", color, width: Math.max(size / 5, 1) };
    case "polygon":
      return { type: "simple-fill", color: withAlpha(color, 0.35),
               outline: { color, width: 1.5 } };
    default:
      throw new Error(`No 2D symbol for geometry type "${geometryType}"`);
  }
}

/** #rrggbb → "rgba(r,g,b,a)". Passes non-hex values through unchanged. */
function withAlpha(hex, alpha) {
  if (typeof hex !== "string" || !hex.startsWith("#") || hex.length !== 7) return hex;
  const r = parseInt(hex.slice(1, 3), 16);
  const g = parseInt(hex.slice(3, 5), 16);
  const b = parseInt(hex.slice(5, 7), 16);
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}

Usage:

const symbol = symbolFor(layer.geometryType, view.type === "3d" ? "3d" : "2d", { color: "#e63946" });

This eliminates a whole category of bug. Anywhere you'd otherwise branch on geometry type, call this instead. Note that smart mapping (Module 16) does the same thing for you and better - this helper is for the cases where you're building a symbol by hand.


How it works

Why 3D symbols have a symbolLayers array

Because real-world symbology is composite. A tree is a trunk and a canopy. A survey marker is a post and a plate. A highlighted building is an extrusion and a glowing outline.

2D solved this with CIMSymbol (also multi-layer). 3D made it the default structure.

Practically, you'll use one layer 90% of the time. The array is there for the other 10%.

Why icon and object scale differently

icon is drawn as a screen-space billboard: the renderer projects the anchor point to screen coordinates and draws a fixed-pixel quad there. Distance doesn't change its size.

object is real geometry in the scene graph, transformed by the same projection matrix as a building. Perspective applies.

That is why icon sizes are in points and object sizes are in metres - different coordinate spaces entirely.

Why outline is ignored on extrusions

An extruded polygon is a solid with faces and edges. "Outline" is a 2D concept - the boundary of a filled region on a plane. A cube has no outline; it has twelve edges.

The renderer implements edges as a separate geometry pass with its own line rasteriser, which is why they're configured separately and why they can have styles (solid, sketch) that a 2D outline can't.

Why colour is 0-1 alpha here and 0-255 in CIM

The simple symbol classes take a Color object, whose a is 0-1 (matching CSS). CIM symbols carry raw Esri JSON, which uses 0-255 for all four channels, matching the REST specification.

They're two different serialisations that happen to sit next to each other in the same API. Nothing to understand - just remember which you're in.


Common mistakes

A 3D symbol in a MapView. Doesn't render. No error.

outline on an extrude or mesh layer. Silently ignored. Use edges.

object sizes in points. An 8-metre-tall cylinder is invisible from 2 km. Object dimensions are metres.

Forgetting elevationInfo on a 3D GraphicsLayer. Graphics sit at Z=0 (sea level) and are underground almost everywhere. Set { mode: "on-the-ground" }.

Expecting PictureMarkerSymbol to accept an SVG file. It wants a raster or a data URI. For vector shapes, use style: "path" with an SVG path string, or a CIMSymbol.

Very large PictureMarkerSymbol images. Each becomes a texture. 200 unique 512×512 icons is 200 textures and a lot of GPU memory. Use a sprite or a path marker.

CIM colours as 0-1 alpha. CIM is 0-255 for all channels.


Exercises

Exercise 13.1 - Extend the gallery

Add rows for:

  1. picture-marker at three sizes
  2. simple-marker with style: "path" - draw a custom pin shape
  3. line-3d with type: "path" at three widths (a pipe network)
  4. polygon-3d with a water symbol layer
  5. mesh-3d with colorMixMode set to each of its four values (needs a SceneLayer)

Exercise 13.2 - Icon vs object, measured

Build two 3D point layers with 500 features each - one icon, one object. Then:

  1. Compare initial render time
  2. Compare frame rate while orbiting (DevTools → Rendering → Frame Rendering Stats)
  3. Zoom from 200 m to 50 km and describe how each behaves
  4. Write a one-paragraph guideline on when to use which

Exercise 13.3 - Match a design

Find a map you admire (a transit map, a newspaper graphic, a game map). Reproduce three of its symbols as precisely as you can with SDK symbols.

Note what you couldn't reproduce and why. That gap is where CIMSymbol lives.

Exercise 13.4 - A symbol builder UI

Build a panel that constructs a symbol from controls - type, style, colour, size, outline - and applies it live to a selected layer, plus a "copy JSON" button emitting the symbol object.

You will use this constantly for the rest of the course.


Checkpoint

  1. What symbol type do you use for a polygon in a SceneView?
  2. Why does outline do nothing on an extruded polygon?
  3. What are the units for an object symbol layer's height? For an icon's size?
  4. Your 3D graphics are invisible even though the layer loaded. What do you check first?
  5. What does verticalOffset + callout solve?
  6. When would you reach for CIMSymbol?
  7. Why does a 3D symbol have a symbolLayers array rather than a single symbol?
  1. PolygonSymbol3D (type: "polygon-3d"), with a fill, extrude or water symbol layer.
  2. An extrusion is a solid with edges, not a filled 2D region with a boundary. Edges are a separate rendering pass configured with the edges property.
  3. object height is metres (real-world). icon size is points (screen-space).
  4. elevationInfo - without { mode: "on-the-ground" } (or a relative mode) graphics sit at Z = 0, which is below ground almost everywhere.
  5. It floats a 3D point symbol above its true position at a fixed screen distance with a leader line back, so markers stay readable instead of being buried inside buildings or terrain.
  6. When you need multi-layer 2D cartography the simple symbols can't express - markers along lines, dash patterns with offsets, railway hatching - or when matching an ArcGIS Pro map exactly.
  7. Because real symbology is composite (trunk + canopy, extrusion + glow). One layer covers most cases; the array covers the rest.

Further reading


Next: Module 14 - Renderers