Optionalopts: { colorBy?: string; colorScale?: ColorScale } = {}
OptionalcolorBy?: stringthe feature property whose value the scale reads
OptionalcolorScale?: ColorScalevalue → colour for colorBy
the vector handle.
Convenience = sources[0].
Has an op been applied that the last render() has not drawn yet?
The owning FimMap.
This layer's settings knobs. Lazily built; subclasses override
_makeSettings() to supply Raster/Vector knobs. Mutating a knob (layer.set({...}))
emits the effect event (restyle/recomputed) and re-renders when live.
Adopt a handle the provider REPLACED (Google recreates ground overlays to restack them).
Strict CRS precondition: every source Dataset whose native CRS the active provider CANNOT render blocks the render with an actionable error, AND emits a host event so the app can react (toast, or auto-reproject as an app-tier policy). Mechanism here; policy in the host — the engine never silently reprojects.
The provider-specific draw step. Base is a no-op (headless layers render via a binder).
Optionalopts: any
carries the resolved mode.
Does this layer have at least one listener for evt? Lets the map dispatch skip uninterested layers.
Resolve the render update mode. An explicit 'in-place'/'recreate' wins; 'auto' asks provider CAPABILITY (does it expose setRasterImageUrl?) + layer TYPE (does this layer render a swappable raster image?). Vector layers and providers without in-place swap fall back to recreate.
The style handed to the provider. With a ColorScale + colorBy attached this is a per-feature
FUNCTION — each feature's properties[colorBy] goes through the scale — merged over whatever
flat style setStyle()/render({style}) set, so an explicit strokeWidth still applies. With
no scale (or no colorBy) it is just that flat style, exactly as before.
A feature whose property is missing or non-numeric is coloured by the scale's missingColor
when one is set, and otherwise keeps the base style — never a value from the ramp, since
"no data for this feature" must not be able to look like a real reading.
Does this layer render a swappable raster image (the in-place-capable case)? RasterLayer overrides.
Downslope compass bearing.
Crop to a bbox.
Compute this layer's render-ready result. Default: force the primary source Dataset into its
decoded grid/features and memoize it on this.result. Subclasses override to align+reduce.
Optionalopts: any = {}"Hot-modify": derive new sources FROM the current ones and swap them in. Because the derived Dataset shares memoized ancestors with the old, only the changed tail recomputes — a cheap live tweak (e.g. re-classify with a new threshold) versus a cold source swap. Sugar over setSources.
Fire evt. Listeners receive { ...payload, layer: this }.
The event goes to TWO places, so these two subscriptions see the same event:
layer.on('rendered') — this ONE layer's lifecycle (per-object subscription) fim.on('userRaster:rendered') — ANY layer of that type on this map (per-map subscription)
The per-map form is derived from the per-layer one by forwarding under ${type}:${evt}, so a new
layer type gets it with no extra wiring.
Forwarding is skipped when the layer has no type (nothing to namespace with) or no owning map.
Subsystems that emit on the map bus directly (velocity/ensemble/depth emit their own
*:activated names) are unaffected — those are distinct event names, so nothing double-fires.
Optionalpayload: any = {}The first feature whose geometry contains the point (polygons with holes; points within a small epsilon), or null. Drives a marker/feature info window.
Fit the map to this layer's Dataset bounds, via the provider.
Read current settings.
The display read-model, derived from the ColorScale (null until one is attached) — so a vector layer coloured by a property gets the same legend a raster does.
Feature statistics over this layer's GeoJSON — counts by geometry type, total area/length, bbox.
Computed from the SOURCE (dataset.data), not from the provider's overlay handle, so it works
on every provider and before/without a render.
Remove the vector overlay from the map (the provider contract has no vector "invisible" primitive
short of removing it). The base Layer.hide() only flips .visible — that alone doesn't touch
anything the provider drew, so the features stayed visible on the map through it. show() rebuilds
via addVector — the same remove-then-recreate shape setStyle() already uses. Chainable.
True if the point falls inside any feature geometry.
Pixels outside polygon (or inside, with {invert:true}) become noData.
Optionalopts: anyNOT chainable, on purpose. rasterize changes a Dataset's kind (vector → raster), and this
layer draws the kind it was built for — returning this would leave a VectorLayer pointing at a
raster it cannot draw. Do it on the Dataset and add the result as its own layer.
Remap pixel values by rules or a callback.
Optionalopts: anyCollapse a selection axis to one grid.
Optionalop: stringOptionalopts: anyTear down render, emit 'removed', then unregister from the owning FimMap. Subclasses
super.remove() last. If a _teardown hook was assigned (transitional: user-file Layers built
inline in floodExtent carry their google.maps teardown here instead of in a dedicated
subclass), it runs once before the event. 'removed' fires SYNCHRONOUSLY here — a subscriber
(the tools panel) reacts now, not on google.maps' later onRemove() frame, which is what makes
layer switches deterministic instead of racing.
Draw this layer's Dataset on the map via the owning FimMap's provider.
Optionalopts: { style?: any } = {}
provider-native style (e.g. google.maps.Data style)
Resample onto an explicit target grid (does not reproject).
Optionalopts: anyPoint the layer back at the sources it held before its first op. Async and atomic, like any source swap — a live layer re-renders. A no-op if nothing has been applied.
Optionalopts: any = {}
{ render?: 'auto'|'in-place'|'recreate' }
Resolve one selection-axis entry (the scenario-slider op).
Optionalopts: anyTHE way to change how this layer looks. Sync and chainable — returns the layer.
layer.set({ palette: 'viridis', continuous: true, opacity: 0.8 });
Raster knobs: palette, continuous, colorScale, noData, opacity, hover.
Vector knobs: color, opacity, useFileColors, hover.
This is the single path for changing a layer's appearance. layer.colorScale stays readable,
and ColorScale keeps its own set() for building a scale before you hand it over.
A knob that needs a redraw (only noData) redraws; await layer.settled() if you need to know
it finished.
Replace this layer's source Datasets and, if the layer is already live, re-render. Immutable data
means "the data changed" == "point at a new Dataset" — never mutate. Drives the FimMap's Dataset
ref-count (acquire the new before releasing the old, so a Dataset shared with another layer is not
evicted mid-swap). opts.render chooses the update mechanism (see render()).
ATOMIC: if the re-render throws (e.g. the new sources have an unrenderable CRS, or a materializer
fetch fails), the swap is rolled back — sources/result revert to their previous values, the
new sources' ref-count acquire is undone, and the error rethrows. What's actually on screen never
changed either way (a failed render draws nothing new), so this keeps the layer's own state
truthful to that: either the swap fully succeeded, or the layer is left exactly as it was before
the call — never pointing at broken new sources with the working old ones already let go.
Restyle: merge a neutral style patch and re-render (remove + re-add — the provider contract has no in-place setVectorStyle).
Resolves once any redraw kicked off by set() has finished.
Re-add the vector overlay to the map at its last style. Chainable.
A plain, structured-cloneable DESCRIPTION of this layer — its type, its sources, and the display state needed to rebuild an equivalent one, e.g. on a different map or provider:
map2.addLayer(layer1.toSpec());
This is deliberately a COPY, not a handle. addLayer(spec) builds a NEW ColorScale from the
description, so the two layers diverge rather than silently sharing mutable colour state —
which is exactly the question a clone() API cannot answer for the caller. The layer's id
and its event subscribers are not carried either.
sources are the live Dataset objects (free values, safe to share and already decoded). To
persist a spec instead of transferring it in-page, swap them for ds.toRecord().
StaticregisterStatictypesEvery type addLayer can currently construct — built-ins plus anything a host registered.
REGISTRY KEYS, not layer.type values (see getLayerTypes).
the base Layer options, plus: