Skip to content

groupRings

groupRings(subpaths): RingGroup[]

Defined in: core/rings.ts:55

Group a flat list of closed rings into filled polygons with holes.

PathRecorder emits independent subpaths and discards which ring is an outer boundary vs. a hole, so we recover it here: process rings largest-first; a ring is a hole of the smallest already-seen outer that geometrically contains it, otherwise it starts a new outer. Open or degenerate (<3 vertex) subpaths are skipped — a fill needs a closed ring.

Limitation: single-level nesting only (no hole-within-hole islands). This covers grid cells (one ring each) and typical country polygons.

readonly Subpath[]

RingGroup[]