@nika-js/onlymap 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/onlymap.code-snippets +13 -0
- package/LICENSE.md +4 -0
- package/README.md +30 -7
- package/THIRD-PARTY-LICENSES.md +7874 -0
- package/dist/{Arrow.dom-7AXne1TU.js → Arrow.dom-BNjbQ9jb.js} +23 -23
- package/dist/LercDecode.es-CVmNpXBp.js +303 -0
- package/dist/assets/LercDecode.es-BJb2dZu5.js +305 -0
- package/dist/assets/__vite-browser-external-DDArsqdc.js +29 -0
- package/dist/assets/lerc-wasm.wasm +0 -0
- package/dist/assets/lzw-BY5a_5nb.js +83 -0
- package/dist/assets/worker-DtIrTJB7.js +305 -0
- package/dist/assets/zstd-QGAv3PMm.js +383 -0
- package/dist/{basemap-BdvB-SHy.js → basemap-BSb-g03Z.js} +5729 -5684
- package/dist/basemap-registry.d.ts +10 -0
- package/dist/basemap.d.ts +23 -0
- package/dist/color.d.ts +9 -0
- package/dist/{convert-arrow-schema-CvZ3cT5m.js → convert-arrow-schema-DrAihRf9.js} +31 -31
- package/dist/ctx.d.ts +3 -0
- package/dist/deck.d.ts +28 -0
- package/dist/deck.js +16 -0
- package/dist/elements/om-map.d.ts +29 -0
- package/dist/html-data.d.ts +2 -2
- package/dist/index-CIEkseeV.js +3108 -0
- package/dist/index-D67FynN5.js +594 -0
- package/dist/{index-CJOMgp8k.js → index-QSkZjzIL.js} +4 -4
- package/dist/index-WeMwLoaQ.js +1446 -0
- package/dist/{index-BxzDKZpu.js → index-lV5eG2Xt.js} +22439 -21347
- package/dist/index.d.ts +13 -0
- package/dist/ir-snapshot.d.ts +2 -0
- package/dist/ir.d.ts +10 -0
- package/dist/layer-registry.d.ts +15 -1
- package/dist/legend-spec.d.ts +66 -0
- package/dist/lerc-DJzRIT6z.js +30 -0
- package/dist/lerc-wasm.wasm +0 -0
- package/dist/lzw-BY5a_5nb.js +83 -0
- package/dist/mgrs-BY9bIvp4.js +799 -0
- package/dist/onlymapjs.css +1 -1
- package/dist/onlymapjs.js +55 -35
- package/dist/programmatic.d.ts +35 -0
- package/dist/raster-BKf1dx54.js +8843 -0
- package/dist/raster.d.ts +61 -0
- package/dist/react/om-layer.d.ts +2 -0
- package/dist/react.js +18 -16
- package/dist/{recordbatch-HRu0SMKp.js → recordbatch-Bpc0uxFn.js} +200 -200
- package/dist/runtime-core.d.ts +73 -1
- package/dist/scene-lighting.d.ts +83 -0
- package/dist/selection.d.ts +1 -1
- package/dist/snapshot.d.ts +14 -0
- package/dist/{table-accessors-DBjWgN0C.js → table-accessors-CYWTzpQI.js} +71 -76
- package/dist/terrain.d.ts +113 -0
- package/dist/version.d.ts +1 -1
- package/dist/zstd-jXobGRcq.js +14 -0
- package/docs/custom-layers.md +99 -0
- package/llms.txt +5 -5
- package/onlymapjs.html-data.json +163 -29
- package/package.json +35 -15
- package/skills/onlymapjs/SKILL.md +3 -1
- package/skills/onlymapjs/references/syntax.md +53 -3
- package/dist/index-BVQ0s1Zh.js +0 -1457
- package/dist/index-CvBHiOGD.js +0 -605
- package/dist/index-Vc8QfNEf.js +0 -3907
- package/dist/onlymapjs.umd.cjs +0 -8634
|
@@ -120,6 +120,19 @@
|
|
|
120
120
|
]
|
|
121
121
|
},
|
|
122
122
|
|
|
123
|
+
"!raster": {
|
|
124
|
+
"scope": "html",
|
|
125
|
+
"prefix": "!raster",
|
|
126
|
+
"description": "COGLayer — GeoTIFF/COG raster (src streams by Range request; set min/max for float data)",
|
|
127
|
+
"body": [
|
|
128
|
+
"<om-layer id=\"${1:dem}\" type=\"COGLayer\"",
|
|
129
|
+
" src=\"${2:../data/elevation.tif}\"",
|
|
130
|
+
" label=\"${3:Elevation}\"",
|
|
131
|
+
" min=\"${4:0}\" max=\"${5:1900}\" colormap=\"${6|viridis,gray,plasma,inferno,magma,cividis,rdylgn,rdbu,spectral,terrain,jet,turbo|}\"",
|
|
132
|
+
" opacity=\"0.85\"></om-layer>$0"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
|
|
123
136
|
"!overlay": {
|
|
124
137
|
"scope": "html",
|
|
125
138
|
"prefix": "!overlay",
|
package/LICENSE.md
CHANGED
|
@@ -141,3 +141,7 @@ This Agreement, together with any applicable Order Form, is the entire agreement
|
|
|
141
141
|
## 20. Contact
|
|
142
142
|
|
|
143
143
|
For licensing questions or requests for permissions beyond this Agreement, contact Licensor through the official repository, npm package page, website, or other distribution channel for the Software.
|
|
144
|
+
|
|
145
|
+
## 21. Third-Party Software
|
|
146
|
+
|
|
147
|
+
The Software's distributed bundle includes open-source components that are not governed by this Agreement; each is licensed under its own permissive terms (MIT, ISC, BSD, Apache-2.0, or similar). The complete list of those components and the full text of their licenses is provided in the accompanying THIRD-PARTY-LICENSES.md file. Nothing in this Agreement limits any rights granted by those licenses to their respective components.
|
package/README.md
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
# OnlyMapJS
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[](https://www.npmjs.com/package/@nika-js/onlymap)
|
|
8
|
+
[](https://www.npmjs.com/package/@nika-js/onlymap)
|
|
9
|
+
[](LICENSE.md)
|
|
10
|
+
[](https://docs.nikaplanet.com/onlymap/overview)
|
|
11
|
+
|
|
12
|
+
**Interactive WebGL maps from plain HTML.** OnlyMapJS is a declarative mapping library built on [deck.gl](https://deck.gl), written in TypeScript, with first-class HTML and React APIs. Write a manifest — layers, widgets, popups, behaviors as custom elements — and it drives deck.gl underneath: rendering, GeoJSON/CSV/Arrow data loading, live updates, GPU picking, MapLibre basemaps, and UI, with no build step and no imperative glue code. If you've wanted a declarative deck.gl wrapper — for a geospatial dashboard, a React mapping component, or a single-file HTML map — that's the entire premise.
|
|
8
13
|
|
|
9
14
|
```html
|
|
10
15
|
<script type="module" src="https://esm.sh/@nika-js/onlymap"></script>
|
|
@@ -32,6 +37,22 @@ It's also designed to be written **by AI agents**: HTML is a reliable generation
|
|
|
32
37
|
|
|
33
38
|
> ⚠️ **Status: v0.2.** Proprietary — free for non-commercial use with attribution; commercial licensing terms are in [LICENSE.md](LICENSE.md). APIs may still move before 1.0.
|
|
34
39
|
|
|
40
|
+
## Why not deck.gl directly?
|
|
41
|
+
|
|
42
|
+
deck.gl is the best WebGL data-visualization engine there is — and OnlyMapJS is built on it, not against it. What it replaces is everything *around* deck.gl that every project rebuilds by hand:
|
|
43
|
+
|
|
44
|
+
| | Raw deck.gl | OnlyMapJS |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| Setup | `new Deck({...})`, canvas + basemap sync wiring | one `<om-map>` element (or `<OmMap>` in React) |
|
|
47
|
+
| State | your reducers/stores drive `setProps` | the manifest **is** the state — edit an attribute, the map reconciles; undo/redo built in |
|
|
48
|
+
| Data loading | fetch + parse + reload yourself | `data="…"` — GeoJSON, CSV, Arrow/GeoArrow, Shapefile, KML, WebSocket streams, polled REST; GeoTIFF/COG rasters via `type="COGLayer"` |
|
|
49
|
+
| Accessors | JS functions + `updateTriggers` bookkeeping | `get-*` expressions; update triggers derived automatically |
|
|
50
|
+
| UI | build legends/popups/filters from scratch | built-in widgets, overlays, behaviors — declarative |
|
|
51
|
+
| Testing | mock WebGL or ship untested | `OmMap.validate`, IR snapshots, headless behavioral harness |
|
|
52
|
+
| Escape hatch | — | every deck.gl prop still passes through; custom layers register by name |
|
|
53
|
+
|
|
54
|
+
If you're comparing React mapping libraries: the React adapter (`@nika-js/onlymap/react`) gives you typed `<OmLayer>` components over the same core, so React owns state and deck.gl's `updateTriggers` gymnastics disappear. And when you need raw deck.gl behavior, every kebab-case attribute maps 1:1 to the underlying prop — it's a wrapper, not a wall.
|
|
55
|
+
|
|
35
56
|
## Install
|
|
36
57
|
|
|
37
58
|
```bash
|
|
@@ -44,9 +65,9 @@ Or with no build step at all, straight from a CDN:
|
|
|
44
65
|
<script type="module" src="https://esm.sh/@nika-js/onlymap"></script>
|
|
45
66
|
```
|
|
46
67
|
|
|
47
|
-
Then `npx @nika-js/onlymap init` wires up VS Code IntelliSense and `!`-prefixed manifest snippets for your project. The library ships with
|
|
68
|
+
Then `npx @nika-js/onlymap init` wires up VS Code IntelliSense and `!`-prefixed manifest snippets for your project. The library ships with 451 unit/behavioral tests and 27 Playwright GPU tests.
|
|
48
69
|
|
|
49
|
-
The [examples](https://github.com/NikaGeospatial/onlymapjs/tree/main/examples) are the best tour: widgets, behaviors & overlays, basemaps, columnar/Arrow data, manual drawing, 3D models, a live WebSocket ship feed, and a polled driver fleet.
|
|
70
|
+
The [examples](https://github.com/NikaGeospatial/onlymapjs/tree/main/examples) are the best tour: widgets, behaviors & overlays, basemaps, columnar/Arrow data, manual drawing, 3D models, scene lighting (with the native lighting widget), DEM terrain, a live WebSocket ship feed, and a polled driver fleet.
|
|
50
71
|
|
|
51
72
|
## The manifest
|
|
52
73
|
|
|
@@ -56,7 +77,7 @@ A handful of elements, one rule: **attributes are kebab-case versions of deck.gl
|
|
|
56
77
|
|---|---|
|
|
57
78
|
| `<om-map>` | The map. `center`, `zoom`, `pitch`, `bearing`; `basemap` takes a free preset (`positron`, `liberty`, `dark-matter`, `osm`, …), a style URL, or `"none"` (standalone canvas) — and switches **live**; `validate` for a live on-page error panel. |
|
|
58
79
|
| `<om-layer>` | Any of **33 layer types** by name — all of deck.gl's core, geo, aggregation, and mesh layers (Scatterplot, GeoJson, Arc, Path, Heatmap, Hexagon, Trips, Tile, Tile3D, Scenegraph, …) plus the built-in `PopupLayer` for WebGL badges/labels at scale. `id` required; `label`/`color` feed the legend. |
|
|
59
|
-
| `<om-widget>` | UI panels. Built-ins: `legend
|
|
80
|
+
| `<om-widget>` | UI panels. Built-ins: `legend` (symbology-aware: color scales render as gradient ramps or class ranges, categorical ternaries as discrete palettes), `layer-switcher`, `basemap-switcher`, `lighting`, `zoom-controls`, `undo-redo`, `scale-bar`, `attribution`, `filter`, `draw`, `vega-lite` (live charts). Or write your own inline with HTML + a `<script type="om/widget">`. Themeable from plain page CSS via custom properties: `om-map { --om-widget-bg: #111827; --om-widget-fg: #f9fafb; }` (also `-muted`, `-border`, `-hover-bg`, `-accent`). |
|
|
60
81
|
| `<om-overlay>` | Rich HTML anchored to a map location — a static `anchor="[lng, lat]"`, the current selection, or a feature's own geometry via `anchor-layer`/`anchor-feature-id`. `{{field}}` interpolates the picked feature, HTML-escaped by default. |
|
|
61
82
|
| `<om-behavior>` | Declarative interactions: `on="click|hover|drag|load|data-loaded"` → a named action. |
|
|
62
83
|
| `<om-story>` | A storyboard: `<om-step>` children fire actions on a timeline. Controlled by the `player` widget, behaviors, or `storyEl.play()/pause()/seek()`. |
|
|
@@ -86,6 +107,7 @@ Built-ins: `scale()` (types: `sequential`, `diverging`, `threshold`, `sqrt`, `lo
|
|
|
86
107
|
| **CSV / TSV** | `data="./quakes.csv"` | parsed to typed columns (lazy ~48 KB chunk); numbers auto-typed, quoted fields intact |
|
|
87
108
|
| **Shapefile** | `data="./countries.shp"` | geometry + `.dbf` attributes joined into GeoJSON features (sidecars fetched with your auth config) |
|
|
88
109
|
| **KML** | `data="./tour.kml"` | placemarks → GeoJSON features; other formats plug in via `OmMap.registerFormat` |
|
|
110
|
+
| **GeoTIFF / COG raster** | `<om-layer type="COGLayer" src="./dem.tif" min="0" max="1900" colormap="viridis">` | Cloud-Optimized GeoTIFFs stream tiles by Range request (lazy chunk); min/max restretch + colormap swaps are GPU uniforms, nodata → transparent, legend ramp derives automatically; plain 8-bit RGB COGs need no attributes at all |
|
|
89
111
|
| **WebSocket stream** | `data="wss://feed" key="id" flush="250ms" source="myFormat"` | upsert-by-key, burst coalescing, auto-reconnect; decode any format via `OmMap.registerSource` |
|
|
90
112
|
| **Polled REST snapshot** | `data="/api/fleet.json" refresh="5s"` | full-snapshot replace per poll; outages keep the last good data |
|
|
91
113
|
| **Draw store** | `data="draw:sketch"` | live in-memory GeoJSON feature store written by `<om-widget type="draw" target="sketch">` |
|
|
@@ -191,13 +213,14 @@ Plus `OmMap.snapshotIR(html)` to lock down what a manifest *means* in a snapshot
|
|
|
191
213
|
|
|
192
214
|
## 3D
|
|
193
215
|
|
|
194
|
-
`ScenegraphLayer` instances glTF/GLB models at coordinates (no three.js, no loader wiring), `Tile3DLayer` consumes OGC 3D Tiles, and the camera tilts via `pitch`/`bearing` attributes. Converting IFC/CAD upstream: [docs/3d-assets.md](docs/3d-assets.md).
|
|
216
|
+
`ScenegraphLayer` instances glTF/GLB models at coordinates (no three.js, no loader wiring), `Tile3DLayer` consumes OGC 3D Tiles, `GeoJsonLayer` extrudes polygons (`extruded get-elevation="$height"`), and the camera tilts via `pitch`/`bearing` attributes. Terrain is one attribute: `<om-map terrain="terrarium">` raises a real DEM surface (keyless AWS tiles; `maptiler-terrain` keyed; or a bring-your-own `{z}/{x}/{y}` DEM URL + `terrain-decoder`), geographic layers drape onto it automatically (per-layer `terrain="drape|offset|off"` overrides; 3D models sit ON the surface), `terrain-exaggeration` scales the relief, and `terrain-texture` drapes imagery. Terrain replaces an active basemap while on (flat canvas vs raised surface) and restores it when off. Scene lighting is declarative: `<om-map lighting="daylight">` (presets `daylight`/`studio`/`flat`/`custom`, tuned via `lighting-ambient`, `lighting-sun`, `lighting-sun-azimuth`/`-elevation`, or `lighting-sun-date` for a solar-position sun) — attribute-backed, so lighting changes are undoable and story-steppable via the `set-lighting` action. `<om-widget type="lighting">` gives users native preset radios + tuning sliders over the same attributes. Converting IFC/CAD upstream: [docs/3d-assets.md](docs/3d-assets.md).
|
|
195
217
|
|
|
196
218
|
## Programmatic surface
|
|
197
219
|
|
|
198
220
|
- **`OmMap.*`** — `validate`, `snapshotIR`, `registerLayer`, `registerWidget`, `registerAction`, `registerSource`, `registerFormat`, `registerBasemap`, `configureBasemap`, `configureData`, `configureTelemetry`, `configureLicense`, `getLayerSchema`
|
|
199
|
-
-
|
|
200
|
-
-
|
|
221
|
+
- **`@nika-js/onlymap/deck`** — the bundled deck.gl classes (`CompositeLayer`, `TileLayer`, …) for building custom layer types: shims must extend the same class hierarchy the core renders with, not a second installed deck.gl copy. Recipe: [docs/custom-layers.md](docs/custom-layers.md)
|
|
222
|
+
- **On a `<om-map>` element** — `ready` (promise), `flyTo(coords, zoom?)`, `setLayerVisible(id, bool)`, `getLayers()`, `emit(action, payload)`, `snapshot(opts?)` (canvas-only PNG of basemap + layers at device pixels — DOM widgets/overlays and provider attribution are NOT captured, so exports must render credits themselves; `{as: "blob"}` for files, default dataURL); the `om-view-changed` event fires once the camera settles (debounced; `detail` = `{longitude, latitude, zoom, pitch, bearing}`) — the camera-persistence hook; `document.querySelector("om-map")` is fully typed
|
|
223
|
+
- **`MapController`** — the framework-grade programmatic front-end (typed `LayerDescriptor`s → the same reconcile core, no DOM manifest): `setLayers`, `watch`, `emit`, camera methods, `injectPick`, `ready`, `snapshot`, an `onViewChange` option (the `om-view-changed` twin). The React adapter rides it; usable directly from vanilla TS or other frameworks
|
|
201
224
|
- **Testing** — `mountForTest`, and imports are SSR-safe (importing in Node/jsdom never touches browser globals)
|
|
202
225
|
|
|
203
226
|
## Free tier & licensing
|