Overview
OnlyMap JS (@nika-js/onlymap) turns a handful of HTML custom elements into a full interactive WebGL map. You declare layers, widgets, popups, interactions, and even guided tours as markup; the library owns rendering, data loading, live updates, picking, and validation. There is no imperative deck.gl setup, no shader code, and no build step — a single HTML file is a complete map application.
It is also designed to be written by AI agents: HTML is a reliable generation target, the package ships an agent skill and an llms.txt, and OmMap.validate() returns structured errors with actionable fixes — a real authoring feedback loop.
Install
npx @nika-js/onlymap init— wires VS Code IntelliSense for everyom-*element and attribute, plus!-prefixed manifest snippets (!starter,!map, …).npx -y skills add NikaGeospatial/onlymapjs --skill onlymapjs— installs the OnlyMap authoring skill into coding agents (Claude Code, Cursor, Codex), so they write correct manifests on the first pass.
Key Features
Declarative Everything
- 33 deck.gl layer types by name: Scatterplot, GeoJson, Arc, Path, Heatmap, Hexagon, Trips, Tile, Tile3D, Scenegraph, and more — plus a built-in
PopupLayerfor WebGL labels and badges at scale. - Live manifest: the markup is the state. Change an attribute — from a widget, a behavior, a script, or devtools — and the map reconciles automatically.
- Built-in undo/redo: layer toggles, filter changes, basemap switches, element edits, and drawn sketches are all undoable (
<om-widget type="undo-redo">, or just Cmd/Ctrl-Z).
Data That Stays Fresh
- Formats: JSON/GeoJSON, CSV/TSV, Apache Arrow and GeoArrow (columnar fast path, zstd IPC), Shapefile with
.dbfattributes, KML — heavy parsers lazy-load on first use. - Live sources: WebSocket streams with upsert-by-key and burst coalescing, and polled REST snapshots via
refresh="5s". - Private endpoints:
OmMap.configureData({ headers, credentials, fetch })keeps credentials out of markup by design.
Application UI Without an App Framework
- Widgets: legend, layer switcher, basemap switcher, zoom controls, undo/redo, scale bar, GPU filter sliders, live Vega-Lite charts, a drawing toolbar — or custom widgets with a typed runtime context (
ctx.data,ctx.stats,ctx.viewport,ctx.emit). - Overlays and behaviors: rich HTML popups anchored to map coordinates or picked features, and declarative
on="click|hover|drag|load"interactions — no event-handler code. - Map stories: guided tours as
<om-story>steps that fire the same actions behaviors use, with a player widget and deterministic scrubbing.
Built for Verification
OmMap.validate(html)returns structured errors, each with a concrete fix; a live on-page error panel is one attribute away (validate).- Headless test harness:
mountForTestruns full behavioral tests (picks, widgets, overlays, real projection math) in jsdom/happy-dom with no WebGL. - React adapter:
@nika-js/onlymap/reactprovides<OmMap>,<OmLayer>,<OmWidget>,<OmOverlay>, and a typeduseOmMap()hook over the same core — React owns state, the library never fights the virtual DOM.
Roadmap
Globe projection, Mapbox GL basemaps, depth-interleaved 3D compositing, vertex editing for drawn geometries, SSE transport, multi-field filters, and stories/draw as React components are designed but not yet shipped. The README’s “Not implemented yet” section is kept honest release by release.Resources
- npm:
@nika-js/onlymap - GitHub (docs, examples, llms.txt): NikaGeospatial/onlymapjs
- Product page: nikaplanet.com/onlymap