Skip to content

GeoMap

Defined in: map/geo-map.ts:74

  • BaseEngine

new GeoMap(host, opts): GeoMap

Defined in: map/geo-map.ts:86

HTMLElement

GeoMapOptions

GeoMap

BaseEngine.constructor

clearStyle(name, ids?): this

Defined in: map/base-engine.ts:976

Remove overrides (all of the layer’s when ids is omitted) and restore base styles.

string

string | number | readonly (string | number)[]

this

BaseEngine.clearStyle


destroy(): void

Defined in: map/base-engine.ts:1678

void

BaseEngine.destroy


disableInteraction(): this

Defined in: map/base-engine.ts:1226

Detach the current pan/zoom or rotation interaction (no-op if none).

this

BaseEngine.disableInteraction


enableRotation(opts?): this

Defined in: map/geo-map.ts:290

Drag to trackball-rotate a spherical projection; wheel to scale it. Re-projects on the CPU per frame and pushes the result to whatever backend is live, so every backend (canvas, svg, webgl) renders the identical crisp vector geometry. Layers flagged hideOnInteraction are hidden mid-gesture so dense data needn’t re-project per frame. (A GPU-side shader-projected globe — no per-frame CPU reprojection — is a possible future optimization; the backend retains dormant globe-rendering support.)

RotationOptions = {}

this


enableZoom(extent?, onTransform?): this

Defined in: map/geo-map.ts:271

One entry point for both projection kinds: a spherical (azimuthal) projection gets versor rotation (drag) + wheel-zoom bounded by extent; a flat projection gets d3-zoom affine pan/zoom. extent sets the zoom limits for both. Backend-agnostic: every backend renders the same per-frame-reprojected geometry, so a backend swap needs no re-dispatch (the interaction listeners and projection state are unaffected by it).

[number, number] = ...

(t) => void

this

BaseEngine.enableZoom


highlight(name, idOrIds, style?): this

Defined in: map/base-engine.ts:1069

Highlight one drawable / a set of drawables of name by drawing them into a tiny internal overlay layer on top (inheriting the source’s clipTo/sizeMode) — the base layer’s buffers are untouched, so the per-change cost is tessellating the highlighted items only. styleOrDraw falls back to the layer’s hover option, then to the default white outline. null clears.

The draw-fn overload is generic over the layer’s datum type D (caller-asserted, like select’s predicate) so a custom highlight draw sees a typed datum.

string

string | number | readonly (string | number)[] | null

HighlightStyle

this

BaseEngine.highlight

highlight<D>(name, idOrIds, draw): this

Defined in: map/base-engine.ts:1070

Highlight one drawable / a set of drawables of name by drawing them into a tiny internal overlay layer on top (inheriting the source’s clipTo/sizeMode) — the base layer’s buffers are untouched, so the per-change cost is tessellating the highlighted items only. styleOrDraw falls back to the layer’s hover option, then to the default white outline. null clears.

The draw-fn overload is generic over the layer’s datum type D (caller-asserted, like select’s predicate) so a custom highlight draw sees a typed datum.

D = unknown

string

string | number | readonly (string | number)[] | null

HighlightDraw<D>

this

BaseEngine.highlight


labels(data): this

Defined in: map/geo-map.ts:101

Show engine-owned text labels (#223): supply the data and d3-style accessors, and the engine measures each label’s text once, then places + culls collisions and re-places them on every pan/zoom (no manual overlay, transform callback, or text-metric estimates). anchorOf returns a PROJECTED point — e.g. projection(feature.geometry.coordinates) (return null to skip a feature off the globe). Rendered by the active backend — an HTML overlay on WebGL, native <text>/fillText on SVG/Canvas so labels survive toSVG()/toPNG() export. Pass false to remove; re-call to rebuild after the projection changes.

false

this

labels<D>(data, opts): this

Defined in: map/geo-map.ts:102

Show engine-owned text labels (#223): supply the data and d3-style accessors, and the engine measures each label’s text once, then places + culls collisions and re-places them on every pan/zoom (no manual overlay, transform callback, or text-metric estimates). anchorOf returns a PROJECTED point — e.g. projection(feature.geometry.coordinates) (return null to skip a feature off the globe). Rendered by the active backend — an HTML overlay on WebGL, native <text>/fillText on SVG/Canvas so labels survive toSVG()/toPNG() export. Pass false to remove; re-call to rebuild after the projection changes.

D

readonly D[]

DataLabelOptions<D>

this


layer<F>(name, features, opts?): LayerHandle<F>

Defined in: map/geo-map.ts:168

Declare (or re-declare) a named layer of GeoJSON features, projected once through the map’s projection and retained so every backend re-renders the same crisp vector geometry. features may be a single Feature/geometry, an array of them, or — only with passThrough: true — a callback re-invoked each repaint (the uncapped, non-pickable streaming path). Re-declaring an existing name replaces the layer and resets its interaction/style state. Returns a LayerHandle for appending data and per-layer styling. (Wind exterior polygon rings clockwise in [lon, lat] — see the project docs.)

F extends GeoInput

the feature/datum type carried through to accessors and hit results.

string

F | readonly F[] | (() => readonly F[])

LayerOptions<F> = {}

LayerHandle<F>


on(event, cb): this

Defined in: map/base-engine.ts:1598

"click" | "hover"

(hit, ev) => void

this

BaseEngine.on

on(event, cb): this

Defined in: map/base-engine.ts:1599

"select"

(selected, ev?) => void

this

BaseEngine.on


pick(x, y, exact?): HoverHit | null

Defined in: map/base-engine.ts:1618

number

number

boolean = true

HoverHit | null

BaseEngine.pick


recolor(name): this

Defined in: map/base-engine.ts:949

string

this

BaseEngine.recolor


render(): this

Defined in: map/base-engine.ts:1673

this

BaseEngine.render


select(name, set): this

Defined in: map/base-engine.ts:1006

Select a set of drawables: style members with the layer’s selection.selected (default: keep base style) and the complement with selection.others (default { opacity: 0.3 }). One O(n) compose + one styles-only push — click-time cost only, nothing per frame. null clears. NOTE: selection rewrites the layer’s whole override map, so it replaces earlier setStyle overrides (one table, last write wins) — and select(null) restores plain base styles.

Also updates the managed selection set and fires on("select") with ev = undefined (programmatic — no PointerEvent), so callers can observe programmatic selection the same way they observe gesture selection.

The predicate overload is generic over the layer’s datum type D — annotate the parameter ((d: MyDatum) => …) or pass select<MyDatum>(…) to get a typed datum, mirroring d3-selection’s caller-asserted datum generics. Prefer the layer handle’s LayerHandle.select, which already knows D from registration.

string

readonly (string | number)[] | null

this

BaseEngine.select

select<D>(name, predicate): this

Defined in: map/base-engine.ts:1007

Select a set of drawables: style members with the layer’s selection.selected (default: keep base style) and the complement with selection.others (default { opacity: 0.3 }). One O(n) compose + one styles-only push — click-time cost only, nothing per frame. null clears. NOTE: selection rewrites the layer’s whole override map, so it replaces earlier setStyle overrides (one table, last write wins) — and select(null) restores plain base styles.

Also updates the managed selection set and fires on("select") with ev = undefined (programmatic — no PointerEvent), so callers can observe programmatic selection the same way they observe gesture selection.

The predicate overload is generic over the layer’s datum type D — annotate the parameter ((d: MyDatum) => …) or pass select<MyDatum>(…) to get a typed datum, mirroring d3-selection’s caller-asserted datum generics. Prefer the layer handle’s LayerHandle.select, which already knows D from registration.

D = unknown

string

(d, i) => boolean

this

BaseEngine.select


selection(): HoverHit[]

Defined in: map/base-engine.ts:2069

Flatten the retained selection into HoverHit[], resolving datums + members() via the layer’s Scene spec or its interactive lane (so a selected aggregate’s leaf ids are reachable, #105 N7c-2).

HoverHit[]

BaseEngine.selection


setBackend(type): this

Defined in: map/base-engine.ts:1219

BackendType

this

BaseEngine.setBackend


setClip(name, clipTo?): this

Defined in: map/base-engine.ts:1204

string

string

this

BaseEngine.setClip


setProjection(projection): this

Defined in: map/geo-map.ts:255

Swap the projection on the existing map: re-project every layer once and reset the affine view to identity (the caller fits the new projection).

GeoProjection

this


setSize(width, height): this

Defined in: map/base-engine.ts:487

Resize the engine in place to a new CSS size (px) — no teardown. Resizes the live backend, runs the subclass onResize hook (e.g. GeoMap refits its projection), then re-renders and repaints pass-through layers. Layers, view transform, and interaction state are preserved. A no-op when the size is unchanged or either axis is zero (a collapsed/hidden layout). In responsive modes the ResizeObserver calls this automatically; callers in fixed mode use it to apply a new explicit size without recreating the engine.

number

number

this

BaseEngine.setSize


setStyle(name, ids, override): this

Defined in: map/base-engine.ts:963

Override the style of one drawable or a set (replaces any previous override for those ids — last write wins). O(ids) compose + one styles-only push.

string

string | number | readonly (string | number)[]

StyleOverride

this

BaseEngine.setStyle


setTransform(t): this

Defined in: map/base-engine.ts:1267

ViewTransform

this

BaseEngine.setTransform


toPNG(): string

Defined in: map/base-engine.ts:1677

string

BaseEngine.toPNG


toSVG(): string

Defined in: map/base-engine.ts:1676

string

BaseEngine.toSVG


whenReady(): Promise<void>

Defined in: map/base-engine.ts:507

Promise<void>

BaseEngine.whenReady