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 | $param 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), smoothstep(a=edge0, b=edge1, c=x). log is the natural logarithm; angles are in radians; atan2(a=y, b=x); step(a=edge, b=x) is 0 below the edge and 1 from it on; fract is a - floor(a); sign is -1, 0 or 1.

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 | fract | sign | sqrt | exp | log | log2 | log10 | sin | cos | tan | asin | acos | atan | add | sub | mul | div | mod | min | max | pow | atan2 | step | clamp | lerp | smoothstep | $param 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.