A TypeScript library that transpiles Vega expressions to OpenLayers array-based expression format. v1.1.1 (latest), stable release. Key differentiator: bridges Vega-Lite/Vega visualization specs with OpenLayers map styling by converting conditional logic, math/string/array functions, and member access (e.g., datum.field) into OpenLayers expressions like ['case', ['>', ['get', 'value'], 100], 'red', 'blue']. Ideal for OpenLayers users who prefer Vega's concise JavaScript-like syntax.
npm install vega2olNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Transpile a Vega conditional expression to OpenLayers format and apply to a style object.
Check the documentation for a list of supported functions. Use only supported functionality or manually translate complex expressions.
Ensure your Vega expression is valid per Vega specification; avoid trailing commas or invalid operators.
Use the returned array directly in OpenLayers style objects; do not call JSON.stringify() unless you intend to send it as data.
Use only datum.fieldName pattern; OpenLayers expressions use ['get', 'x'] to access feature attributes. Ensure your feature has the expected property keys.
Ensure the package is installed: npm install vega2ol. Use ESM import syntax: import { vega2ol } from 'vega2ol'.Use only supported functions: floor, ceil, round, abs, sqrt, pow, log, exp, sin, cos, tan, min, max, tostring, upper, lower, substring, length, indexof, slice, type, isvalid, isnumber, isstring, isboolean.
Remove trailing semicolons and ensure valid Vega expression syntax. For example, use datum.x > 5 ? 'a' : 'b' without semicolons.
Change import statement to import { vega2ol } from 'vega2ol'.