GeoMap
Defined in: map/geo-map.ts:74
Extends
Section titled “Extends”BaseEngine
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GeoMap(
host,opts):GeoMap
Defined in: map/geo-map.ts:86
Parameters
Section titled “Parameters”HTMLElement
Returns
Section titled “Returns”GeoMap
Overrides
Section titled “Overrides”BaseEngine.constructor
Methods
Section titled “Methods”clearStyle()
Section titled “clearStyle()”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.
Parameters
Section titled “Parameters”string
string | number | readonly (string | number)[]
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.clearStyle
destroy()
Section titled “destroy()”destroy():
void
Defined in: map/base-engine.ts:1678
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseEngine.destroy
disableInteraction()
Section titled “disableInteraction()”disableInteraction():
this
Defined in: map/base-engine.ts:1226
Detach the current pan/zoom or rotation interaction (no-op if none).
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.disableInteraction
enableRotation()
Section titled “enableRotation()”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.)
Parameters
Section titled “Parameters”RotationOptions = {}
Returns
Section titled “Returns”this
enableZoom()
Section titled “enableZoom()”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).
Parameters
Section titled “Parameters”extent?
Section titled “extent?”[number, number] = ...
onTransform?
Section titled “onTransform?”(t) => void
Returns
Section titled “Returns”this
Overrides
Section titled “Overrides”BaseEngine.enableZoom
highlight()
Section titled “highlight()”Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”string
idOrIds
Section titled “idOrIds”string | number | readonly (string | number)[] | null
style?
Section titled “style?”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.highlight
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”D = unknown
Parameters
Section titled “Parameters”string
idOrIds
Section titled “idOrIds”string | number | readonly (string | number)[] | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.highlight
labels()
Section titled “labels()”Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”false
Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”D
Parameters
Section titled “Parameters”readonly D[]
Returns
Section titled “Returns”this
layer()
Section titled “layer()”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.)
Type Parameters
Section titled “Type Parameters”F extends GeoInput
the feature/datum type carried through to accessors and hit results.
Parameters
Section titled “Parameters”string
features
Section titled “features”F | readonly F[] | (() => readonly F[])
LayerOptions<F> = {}
Returns
Section titled “Returns”LayerHandle<F>
Call Signature
Section titled “Call Signature”on(
event,cb):this
Defined in: map/base-engine.ts:1598
Parameters
Section titled “Parameters”"click" | "hover"
(hit, ev) => void
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.on
Call Signature
Section titled “Call Signature”on(
event,cb):this
Defined in: map/base-engine.ts:1599
Parameters
Section titled “Parameters”"select"
(selected, ev?) => void
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.on
pick()
Section titled “pick()”pick(
x,y,exact?):HoverHit|null
Defined in: map/base-engine.ts:1618
Parameters
Section titled “Parameters”number
number
exact?
Section titled “exact?”boolean = true
Returns
Section titled “Returns”HoverHit | null
Inherited from
Section titled “Inherited from”BaseEngine.pick
recolor()
Section titled “recolor()”recolor(
name):this
Defined in: map/base-engine.ts:949
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.recolor
render()
Section titled “render()”render():
this
Defined in: map/base-engine.ts:1673
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.render
select()
Section titled “select()”Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”string
readonly (string | number)[] | null
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.select
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”D = unknown
Parameters
Section titled “Parameters”string
predicate
Section titled “predicate”(d, i) => boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.select
selection()
Section titled “selection()”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).
Returns
Section titled “Returns”HoverHit[]
Inherited from
Section titled “Inherited from”BaseEngine.selection
setBackend()
Section titled “setBackend()”setBackend(
type):this
Defined in: map/base-engine.ts:1219
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setBackend
setClip()
Section titled “setClip()”setClip(
name,clipTo?):this
Defined in: map/base-engine.ts:1204
Parameters
Section titled “Parameters”string
clipTo?
Section titled “clipTo?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setClip
setProjection()
Section titled “setProjection()”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).
Parameters
Section titled “Parameters”projection
Section titled “projection”GeoProjection
Returns
Section titled “Returns”this
setSize()
Section titled “setSize()”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.
Parameters
Section titled “Parameters”number
height
Section titled “height”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setSize
setStyle()
Section titled “setStyle()”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.
Parameters
Section titled “Parameters”string
string | number | readonly (string | number)[]
override
Section titled “override”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setStyle
setTransform()
Section titled “setTransform()”setTransform(
t):this
Defined in: map/base-engine.ts:1267
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseEngine.setTransform
toPNG()
Section titled “toPNG()”toPNG():
string
Defined in: map/base-engine.ts:1677
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”BaseEngine.toPNG
toSVG()
Section titled “toSVG()”toSVG():
string
Defined in: map/base-engine.ts:1676
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”BaseEngine.toSVG
whenReady()
Section titled “whenReady()”whenReady():
Promise<void>
Defined in: map/base-engine.ts:507
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”BaseEngine.whenReady