@honua/sdk-js/expr — Honua expression builder.
@honua/sdk-js/expr
A small, typed DSL that compiles to the MapLibre-style style/filter expression shape. Use it to build runtime style expressions, layer filters, and Honua-side projections without hand-rolling JSON arrays.
import { get, eq, all, gt, interpolate, linear, zoom, rgb } from "@honua/sdk-js/expr";// Filter: STATUS = 'ACTIVE' AND POPULATION > 10000const filter = all(eq(get("STATUS"), "ACTIVE"), gt(get("POPULATION"), 10000));// Paint expression: interpolate point color by zoomconst color = interpolate(linear(), zoom(), 8, rgb(70, 130, 180), 14, rgb(220, 20, 60)); Copy
import { get, eq, all, gt, interpolate, linear, zoom, rgb } from "@honua/sdk-js/expr";// Filter: STATUS = 'ACTIVE' AND POPULATION > 10000const filter = all(eq(get("STATUS"), "ACTIVE"), gt(get("POPULATION"), 10000));// Paint expression: interpolate point color by zoomconst color = interpolate(linear(), zoom(), 8, rgb(70, 130, 180), 14, rgb(220, 20, 60));
import { expr, eq, get } from "@honua/sdk-js/expr";const isActive = eq(get("STATUS"), "ACTIVE");const json = expr(isActive); // ["==", ["get", "STATUS"], "ACTIVE"]map.setFilter("parcels", json); Copy
import { expr, eq, get } from "@honua/sdk-js/expr";const isActive = eq(get("STATUS"), "ACTIVE");const json = expr(isActive); // ["==", ["get", "STATUS"], "ACTIVE"]map.setFilter("parcels", json);
@honua/sdk-js/expr— Honua expression builder.A small, typed DSL that compiles to the MapLibre-style style/filter expression shape. Use it to build runtime style expressions, layer filters, and Honua-side projections without hand-rolling JSON arrays.
Example
Example: Render to a JSON expression