effects

Coverage discs

Coverage discs are world-anchored circles of influence — a soft radial fill, an optional crisp boundary ring, and an optional animated radar pulse. They are ideal for showing a range around a node: cell-tower signal, a blast/impact radius, a delivery catchment, a sensor footprint.

Each disc anchors to a graph node (or an explicit world position) and tracks it across layout, geo-placement, and dimming. See the signal-coverage scenario for the full example (real OpenCelliD cell ranges over Stockholm).

Two ways to draw discs

Imperative — api.coverage:

api.coverage.set(stations.map(s => ({
  anchorNodeId: s.id,
  radiusKm: s.rangeKm,        // true ground km, resolved for you
  latitude: s.lat,            // needed for the km→world conversion
  fillColor: [0.2, 0.9, 0.4],
  fillOpacity: 0.12,
  ringColor: [0.2, 0.9, 0.4],
  ringOpacity: 0.85,
  pulse: { speed: 0.4, rings: 2 },   // omit for a static disc
})));

api.coverage.clear();          // remove all (or pass a nodeId for one)

Declarative — <CoverageLayer> as a child of <GraphCanvas>:

import { GraphCanvas, CoverageLayer } from '@kineviz/gl';

<GraphCanvas container={el} apiRef={apiRef} nodeCloud edgeCloud map={mapConfig}>
  <CoverageLayer items={discs} />
</GraphCanvas>

The declarative items are CoverageItems (radius already in world units); the imperative api.coverage accepts the richer CoverageSpec that also takes radiusKm + latitude and resolves them for you.

Radius: world units vs real km

A disc radius is ultimately in world (scene) units, but on a map you almost always know the radius in kilometres. api.coverage lets you give either:

Field Meaning
radius Radius directly in world units (passthrough).
radiusKm True ground radius in km. Resolved via api.map.groundKmToWorld using latitude.
latitude Latitude for the Mercator correction when radiusKm is used (default 0).

Web Mercator inflates ground distance toward the poles, so latitude matters: a 2 km disc in Stockholm covers fewer world units than 2 km at the equator. Supply the disc's latitude and the conversion stays accurate.

Give either radius or radiusKm. A spec with neither resolves to radius 0 (an invisible disc) and logs a warning.

Disc options

interface CoverageItem {
  anchorNodeId?: string;                  // node the disc follows
  position?: [number, number, number];    // explicit world position (if no anchor)
  radius: number;                          // world units (api.coverage also takes radiusKm)
  fillColor: [number, number, number];     // 0..1 rgb
  fillOpacity?: number;                    // default 0.25 — interior bloom; also scales the pulse
  falloff?: number;                        // default 2 — radial falloff exponent
  ringColor?: [number, number, number];    // default = fillColor
  ringWidth?: number;                      // default 0.04 — fraction of the radius
  ringOpacity?: number;                    // default 0.8 — independent of fillOpacity
  pulse?: { speed?: number; rings?: number }; // radar ping; omit to disable
  azimuthDeg?: number;                      // sector centre bearing (deg CW from N); omit = full disc
  beamWidthDeg?: number;                    // wedge width in deg; default 360 = full disc
  innerRadius?: number;                     // annular gap as a fraction of radius; default 0
}

Key points:

  • fillOpacity is the master fill dial — it fades the interior bloom (and the pulse) so a labelled basemap shows through. Keep it low (0.1–0.2) over maps.
  • ringOpacity is independent, so you can fade the fill to near-invisible while keeping a crisp coverage boundary.
  • falloff controls how quickly the fill weakens toward the edge — higher = a tighter hot center.
  • pulse adds an expanding radar ping; speed sets the cadence and rings how many concurrent rings radiate outward. Omit the whole object for a calm, static disc.

Directional sectors (wedges)

A disc is just a 360° wedge. Give beamWidthDeg < 360 and an azimuthDeg and the same item draws an annular sector instead — ideal for cell-tower sectors, antenna lobes, radar arcs, or any directional footprint.

// One base station, 3 sectors at 0/120/240°, ~130° beam (they overlap = handover).
api.coverage.set([0, 120, 240].map((az, i) => ({
  key: `${site.id}#${i}`,        // distinct key so wedges sharing an anchor don't collapse
  anchorNodeId: site.id,          // all 3 share the node → clicking it selects all 3
  radiusKm: site.sectors[i].rangeKm,
  latitude: site.lat,
  azimuthDeg: az,                 // bearing, degrees clockwise from north
  beamWidthDeg: 130,              // < 360 → wedge; 360 (or omit) → full disc
  fillColor: [0.3, 0.66, 1.0],
  fillOpacity: 0.16,
})));
  • azimuthDeg — the wedge's centre bearing, degrees clockwise from north.
  • beamWidthDeg — angular width. 360 (the default) is the classic full disc, so existing disc code is unchanged; the −3 dB antenna beam is ~65°, but real coverage is wider (~130°), so adjacent sectors overlap.
  • innerRadius — a fraction (0..1) that hollows the wedge into an annular ring (a dead-zone near the tower); default 0.
  • Selection — the dashed radius spoke follows azimuthDeg, so a selected base station shows one spoke per sector, each out to its own radius.
  • Sharing an anchor — give each wedge a distinct key (see api.coverage); otherwise wedges with the same anchorNodeId collapse to one entry.

See the cell-tower sectors scenario for real OpenCelliD LTE sectors over Kuala Lumpur.

Anchoring & selection

Discs re-resolve their center every frame, so they track a node through force layout, geo-placement, and camera moves. Discs also follow their anchor node's opacity — click-dim or focus+context an anchor and its disc dims with it.

The selected anchor's disc is marked with a dashed radius spoke, so the disc you're inspecting stands out from its overlapping neighbors.

Recipe: real coverage on a map

// Color by reach; fade the fill so the basemap reads through; keep rings crisp.
function reachColor(km: number): [number, number, number] {
  if (km >= 2.5) return [0.2, 0.9, 0.4];   // wide  → green
  if (km >= 1.0) return [1.0, 0.8, 0.2];   // mid   → yellow
  return [1.0, 0.3, 0.3];                   // short → red
}

api.coverage.set(stations.map(s => ({
  anchorNodeId: s.id,
  radiusKm: s.rangeKm,
  latitude: s.lat,
  fillColor: reachColor(s.rangeKm),
  fillOpacity: 0.1,
  falloff: 2,
  ringColor: reachColor(s.rangeKm),
  ringWidth: 0.05,
  ringOpacity: 0.85,
  pulse: { speed: 0.4, rings: 2 },
})));

See also