Skip to content

Scalars

Number producers wired into other nodes’ In<T> fields through an @node reference.

3 ops: expr, math, zoom.

Ops with no demo image below produce no visible result on their own — they feed other nodes rather than paint.

Evaluate a MapLibre expression once per tile (the tile’s zoom is in the context) and emit the result as a Scalar — feed it to any node’s scalar field via @node. Use for zoom curves (interpolate/step/legacy {stops}); per-feature expressions belong on the consuming node’s *-expr fields instead.

Field Type Required Description
expr yes A raw MapLibre expression producing type (e.g. [“interpolate”, [“linear”], [“zoom”], 13, 1, 15, 0]).
type number | color | bool no The scalar type the expression must produce (build-time typechecked).

Arithmetic over scalar numbers. Operands accept literals, $param references, and @node scalar ports. Unary fns use a; binary a b; clamp(a, b=lo, c=hi), lerp(a, b, c=t).

Field Type Required Description
a number | $param | @node yes
b number | $param | @node no
c number | $param | @node no
fn abs | neg | floor | ceil | round | sqrt | add | sub | mul | div | mod | min | max | pow | clamp | lerp yes

The current tile’s zoom level as a scalar number. Combine with math for zoom-dependent styling.

Takes no fields beyond op.

Map renders on this site are made fromOpenStreetMap data viaProtomaps (© OpenStreetMap contributors), elevation from Re:Earth Terrain,Mapterhorn andEGM2008 (NGA), and aerial imagery from GSI Japan(© 国土地理院). The painterly styles use CC0 brushes byDavid Revoy.