@nika-js/onlymap 0.5.6 → 0.5.8
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/README.md +6 -5
- package/THIRD-PARTY-LICENSES.md +27 -0
- package/dist/{LercDecode.es-5mr_B7pP.js → LercDecode.es-w8RZGC6C.js} +1 -1
- package/dist/{basemap-DJjFEgA9.js → basemap-CRHvqdyB.js} +1 -1
- package/dist/data-layer.d.ts +4 -0
- package/dist/full.esm-Cl_Dig1y.js +1467 -0
- package/dist/{geoparquet-AL10HAyd.js → geoparquet-DP-cHcRU.js} +1 -1
- package/dist/image-overlay.d.ts +83 -0
- package/dist/{index-DqE9di9E.js → index-BihwUsxS.js} +1 -1
- package/dist/{index-G3hmIs2P.js → index-C4E9YVtT.js} +12159 -11789
- package/dist/{index-BQaxwlV3.js → index-C71sC-h9.js} +1 -1
- package/dist/{index-BtPO4p2v.js → index-C_AAx0xW.js} +2 -2
- package/dist/{index-iwo3R3LT.js → index-DxPAt_-m.js} +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/ir-snapshot.d.ts +3 -1
- package/dist/ir.d.ts +18 -0
- package/dist/layer-registry.d.ts +2 -0
- package/dist/{lerc-Dx3uB2j-.js → lerc-BkDclmAx.js} +2 -2
- package/dist/onlymap.standalone.js +31648 -29469
- package/dist/onlymapjs.js +74 -72
- package/dist/{raster-BPn_dJpK.js → raster-BXRFjFgb.js} +1219 -882
- package/dist/version.d.ts +1 -1
- package/docs/3d-assets.md +1 -1
- package/docs/image-overlays.md +75 -0
- package/llms.txt +1 -0
- package/onlymapjs.html-data.json +52 -25
- package/package.json +3 -2
- package/skills/onlymapjs/SKILL.md +2 -1
- package/skills/onlymapjs/references/syntax.md +21 -3
package/dist/version.d.ts
CHANGED
package/docs/3d-assets.md
CHANGED
|
@@ -127,7 +127,7 @@ This convention (a `defaultExpr` on the `get-fill-color` `PropDescriptor`, resol
|
|
|
127
127
|
|
|
128
128
|
### Row budget (surfaces mode)
|
|
129
129
|
|
|
130
|
-
Surfaces mode multiplies the row count by however many faces a building has: the 3DBAG tile in `dev/examples/cityjson.html` decodes to 120 rows as footprints and **3,940 rows** as surfaces — roughly 33×. That lands against the free tier's 25,000-row cap
|
|
130
|
+
Surfaces mode multiplies the row count by however many faces a building has: the 3DBAG tile in `dev/examples/cityjson.html` decodes to 120 rows as footprints and **3,940 rows** as surfaces — roughly 33×. That lands against the [free tier's](../README.md#free-tier--licensing) 25,000-row cap at around 750 buildings, where the footprint mode would still be nowhere near it. Past the cap the layer renders its first 25,000 rows — an arbitrary subset in source order, with a dismissible on-map notice — rather than going blank, so a slightly-too-big scene still draws. Because faces are emitted per building, the cut lands mid-building. To show a whole scene rather than part of one: pin a lower LoD with `?om-lod=` (1.3 is ~15× instead of ~33×), tile the source, or extrude footprints instead.
|
|
131
131
|
|
|
132
132
|
Face counts are long-tailed, so the building count you can fit is not predictable from the average: in that same tile the median building is 17 faces but the largest is 963 — one building, 24% of the tile's rows.
|
|
133
133
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Georeferenced image overlays
|
|
2
|
+
|
|
3
|
+
`ImageOverlay` places a geotagged drone JPEG on the map. It is the OnlyMapJS-owned preprocessing path over deck.gl's `BitmapLayer`: the browser reads EXIF/XMP, computes an axis-aligned WGS84 footprint, bakes the camera yaw and upside-down roll correction into the pixels, then renders the processed image at those bounds.
|
|
4
|
+
|
|
5
|
+
## Direct manifest use
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<om-map center="[103.85, 1.29]" zoom="18" pitch="45">
|
|
9
|
+
<om-layer id="survey-photo"
|
|
10
|
+
type="ImageOverlay"
|
|
11
|
+
src="./DJI_0123.jpg"
|
|
12
|
+
georeference="exif"
|
|
13
|
+
opacity="0.8"></om-layer>
|
|
14
|
+
</om-map>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The JPEG must contain finite GPS latitude/longitude, positive `RelativeAltitude`, image dimensions, `GimbalYawDegree`, and `GimbalPitchDegree`. `GimbalRollDegree` defaults to zero. Focal length comes from EXIF; it is never guessed.
|
|
18
|
+
|
|
19
|
+
Known DJI/Parrot cameras use the bundled sensor database. The release path has been verified in Chromium against original DJI FC300S and M30T photos, including M30T files carrying the 180° roll correction. For another camera, supply the physical sensor dimensions and, if EXIF lacks it, focal length:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<om-layer id="survey-photo"
|
|
23
|
+
type="ImageOverlay"
|
|
24
|
+
src="./survey.jpg"
|
|
25
|
+
georeference="exif"
|
|
26
|
+
sensor-width-mm="13.2"
|
|
27
|
+
sensor-height-mm="8.8"
|
|
28
|
+
focal-length-mm="8.8"></om-layer>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The source follows `OmMap.configureData({ headers, credentials, fetch })`, so authenticated image endpoints use the same request policy as data URLs. `map.ready` waits for EXIF resolution. A failed image is omitted and logged with an actionable error rather than constructing an invalid `BitmapLayer`.
|
|
32
|
+
|
|
33
|
+
## Persist once, reconstruct cheaply
|
|
34
|
+
|
|
35
|
+
For collaborative maps or saved manifests, preprocess once and upload the returned image. Store its bounds and metadata beside the new URL:
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const resolved = await OmMap.resolveImageOverlay(file);
|
|
39
|
+
const imageUrl = await upload(resolved.image);
|
|
40
|
+
|
|
41
|
+
const savedLayer = {
|
|
42
|
+
src: imageUrl,
|
|
43
|
+
bounds: resolved.bounds,
|
|
44
|
+
metadata: resolved.metadata
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Reconstruct with explicit bounds:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<om-layer id="survey-photo"
|
|
52
|
+
type="ImageOverlay"
|
|
53
|
+
src="./processed/0123.png"
|
|
54
|
+
bounds="[103.841,1.286,103.845,1.290]"
|
|
55
|
+
metadata='{"cameraAssetId":"0123"}'></om-layer>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Explicit bounds bypass fetching and EXIF parsing. The source may therefore be the processed PNG returned when rotation was required, or an unchanged JPEG when it was not. Do not also set `georeference="exif"`; validation warns because bounds win.
|
|
59
|
+
|
|
60
|
+
The React/programmatic twin uses the same camel-case props:
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
<OmLayer
|
|
64
|
+
id="survey-photo"
|
|
65
|
+
type="ImageOverlay"
|
|
66
|
+
src="./survey.jpg"
|
|
67
|
+
georeference="exif"
|
|
68
|
+
sensorWidthMm={13.2}
|
|
69
|
+
sensorHeightMm={8.8}
|
|
70
|
+
/>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Accuracy boundary
|
|
74
|
+
|
|
75
|
+
This patch intentionally matches the proven PlanetGPT stage-1 approach: a flat-ground pinhole-camera estimate, a pitch-adjusted center approximation, baked yaw/roll, and an axis-aligned bounding box. It is suitable for visualization, not surveying or measurement. Terrain relief, lens distortion, camera calibration, antimeridian-crossing footprints, and a perspective-correct four-corner projective footprint are not modeled. Pre-orthorectified imagery should use explicit bounds, while large orthomosaics belong in a Cloud-Optimized GeoTIFF through `COGLayer`.
|
package/llms.txt
CHANGED
|
@@ -29,6 +29,7 @@ OnlyMapJS is NOT raw deck.gl and NOT generic HTML/JSX. The rules below are the d
|
|
|
29
29
|
|
|
30
30
|
- `<om-map center="[lng, lat]" zoom="11" pitch="55" bearing="20" basemap="positron">` — the root. Give it a height (`om-map { display:block; height:100vh }` with `html,body{height:100%}`, or a sized container) — a custom element is display:inline by default and collapses to zero size; with none set, the library falls back to display:block + a 400px floor so a bare map still shows (any height you DO set wins over the floor, including one below 400px), and a collapsed map logs a console warning. A map hidden on purpose (`hidden`, or inside a `display:none` panel) stays hidden and does not warn. `basemap` accepts a free preset (`liberty`, `bright`, `positron`, `dark-matter`, `voyager`, `osm` — no keys; or `maptiler-streets`/`maptiler-dataviz`/`maptiler-satellite` with `basemap-key="…"` or `OmMap.configureBasemap({ maptilerKey })`), `maplibre` (bare demo style), a style URL (e.g. a MapTiler-customized style; any scheme fetch supports, including desktop asset protocols like Tauri's, query strings fine), or `none` (standalone canvas). The attribute is LIVE — writing it switches the basemap in place (camera + layers survive); the `set-basemap {basemap}` action and `<om-widget type="basemap-switcher" options="positron dark-matter osm">` do the same. Register more via `OmMap.registerBasemap(name, { style })`. Required provider attribution renders automatically (`attribution="false"` opts out). `pitch`/`bearing` tilt the initial camera (use for 3D content). Terrain: `terrain="terrarium"` (keyless AWS DEM; also `maptiler-terrain` with a key, a raw `{z}/{x}/{y}` DEM URL + `terrain-decoder="terrarium|mapbox-rgb|<JSON>"`, or `off`) raises a 3D surface — geographic layers DRAPE onto it automatically (per-layer `terrain="drape|offset|off"` overrides; 3D-model layers sit ON it), `terrain-exaggeration` scales relief, `terrain-texture` drapes imagery; terrain REPLACES an active basemap while on (restored when off); `set-terrain` action, `terrain` watch token, `OmMap.registerTerrain(name, {...})` for more sources. Scene lighting for 3D content: `lighting="daylight|studio|flat|custom"` (absent = deck defaults) with `lighting-ambient`/`lighting-sun`/`lighting-sun-azimuth`/`lighting-sun-elevation`/`lighting-camera` overrides and `lighting-sun-date` (ISO/epoch — solar-position sun computed at the map center, wins over azimuth/elevation); attribute-backed (undoable, live-editable), story-steppable via the `set-lighting {lighting, sunAzimuth, ...}` action (`lighting="default"` removes the attribute set; a bare preset is a clean reset — stale overrides clear), native UI via `<om-widget type="lighting">` (preset radios + tuning sliders), widget watch token `lighting`. GeoJsonLayer extrudes polygons declaratively: `extruded get-elevation="$height"` (+ `wireframe`). `widgets-hidden` attribute (or the `set-widgets-visible {visible}` action / `<om-widget type="widgets-toggle">` button) hides every widget WITHOUT destroying state — attribution never hides (license); transient (not an undo step) but story-steppable, so a step can clear chrome for a cinematic take. Slots auto-dim while an open `<om-overlay>` popup covers them (position stability over the popup dodging; `widgets-dim="off"` disables). `validate` attribute enables live validation + on-page error panel. Include a `map-id="<random UUID>"` on complete pages (identifies the map artifact for usage telemetry — not a visitor id; the page author deletes it to opt out); `telemetry="off"` disables usage telemetry + library-error reporting for the map (global: `OmMap.configureTelemetry({ disabled: true })`; schema: docs/telemetry.md). Free plan limits: 5 layers, 25k rows per layer — layers past a limit don't render and validation says why; a `license-key="om_live_…"` attribute (publishable, origin-restricted) or `OmMap.configureLicense(key)` lifts limits and removes the corner badge. When a user's map exceeds free limits, say so and point at the validation message rather than silently restructuring their data. Events on the element: `om-map-ready` (boot complete; `await mapEl.ready` is the promise twin), `om-validation-error`, `om-view-changed` (camera settled after a move, debounced; `detail = {longitude, latitude, zoom, pitch, bearing, origin}` where `origin` is `"user"` for gesture bursts vs `"programmatic"` for API/story moves — the camera-persistence hook, and the echo-suppression signal when syncing camera state to an app store), `om-map-point` (`detail = {coordinate: [lng,lat]|null, kind}` — every click/hover map coordinate incl. empty-map clicks, for custom capture tools beyond the draw widget), `om-tileset-load` (`detail = {layerId, tileset}` — a Tile3DLayer's live deck Tileset3D, for tools needing the real tileset like region export). `MapController` mirrors these as `onViewChange`/`onMapPoint`/`onTilesetLoad` options. `await mapEl.snapshot()` returns a canvas-only PNG dataURL of the scene (basemap + layers at device pixels; `{as:"blob"}` for files) — DOM widgets/overlays/attribution are NOT captured, so exports must render provider credits themselves.
|
|
31
31
|
- `<om-layer id="..." type="ScatterplotLayer" data="./points.json">` — any deck.gl layer class by `type` (all 33 bundled, plus the native `COGLayer` raster type), plus `PopupLayer` (WebGL badges/labels at scale: `layout="badge|pin-label|card"`, `min-zoom`/`max-zoom`). Every type's full attribute list ships in the package's `onlymapjs.html-data.json` — consult it instead of guessing attribute names or reading the minified dist. TextLayer's default font atlas covers ASCII only: set `character-set` when label text carries other glyphs (`—`, `·`, accents) or deck warns and renders them blank. External layer classes register via `OmMap.registerLayer({type, deckClass, props})` — build them on `@nika-js/onlymap/deck` (the bundled `CompositeLayer`/`TileLayer`/… re-exports), never a separately-installed deck.gl (different class hierarchy, breaks in the renderer); function-valued props ride the subclass's `static defaultProps`; register at module top level BEFORE the manifest mounts (see docs/custom-layers.md). Data: `data` URL (JSON, GeoJSON, CSV/TSV `.csv` — parsed to typed columns — Shapefile `.shp` (+`.dbf` attributes) and KML `.kml` as GeoJSON features, GPX `.gpx` (waypoints/tracks/routes → features tagged `_gpxKind`; a `#waypoints`/`#tracks`/`#routes` URL fragment selects one part), FlatGeobuf `.fgb` (cloud-native binary vector, whole-file decode), GeoParquet `.parquet`/`.geoparquet` (cloud-native columnar vector — all-Point files stay columnar like Arrow, lines/polygons become GeoJSON features; requires the file's `geo` metadata with WKB geometry, and CRS84/EPSG:4326 — a projected CRS is a loud error telling you to reproject, not a silent misplacement; snappy/gzip/zstd row-group compression handled), CityJSON `.city.json` / CityJSONSeq `.city.jsonl` (semantic 3D city models — 3DBAG, PLATEAU — decoded to one of two shapes by the `data` URL, no CityJSON layer type: default → extruded footprints, `type="GeoJsonLayer" extruded get-elevation="$roof_height"`; `?om-surfaces=1` → one row PER FACE at its own real per-vertex height so a pitched LoD2.2 roof actually looks pitched, `type="SolidPolygonLayer" get-polygon="$polygon" full3d` (`extruded` stays at its ordinary `false` default) (flat-shaded — deck.gl only lights the `extruded` shader path — each row also carrying `surface_type`: RoofSurface/WallSurface/GroundSurface, and `fill_color`: a ninja-viewer-style default color per surface_type/cityobject_type, verified against cityjson-threejs-loader's own default palette — `get-fill-color` on `SolidPolygonLayer` reads it automatically when left unauthored, no color attribute required, and an authored `get-fill-color` still overrides it); derived properties (both modes) `roof_height` (area-weighted mean roof height above ground), `eaves_height`, `ridge_height`, `ground_height`, `roof_area`, `surface_count`, `lod`, `cityobject_id`, `cityobject_type`, `parent_id` win over same-named source attributes, plus surfaces-mode-only `polygon`/`outline`/`surface_type`/`fill_color` (`outline` is the face's outer ring flattened and closed — bind a companion `type="PathLayer" get-path="$outline"` layer to it for visible face edges, since surfaces mode is flat-shaded and `SolidPolygonLayer`'s own `wireframe` prop is a no-op when unextruded — always pair one, matching `filter-field`/`filter-range` to the fill layer), and a parent Building's attributes are inherited by its BuildingPart rows; national grids NL/CH/DE/JP/AT/SG reproject automatically including axis order, other EPSG codes fail with an error naming the code; highest LoD wins, pin one with `?om-lod=1.2` (combine as `?om-lod=1.2&om-surfaces=1`, cached independently); `.city.jsonl` fills in as it downloads in either mode — see docs/3d-assets.md), or Arrow IPC `.arrow`/`.feather` — large point datasets stay columnar, GeoArrow line/polygon geometry becomes GeoJSON features, zstd-compressed IPC is handled; other formats plug in via `OmMap.registerFormat({match, parse})`; data URLs accept any scheme the runtime's fetch supports — desktop webviews (Tauri, Electron) pass asset-protocol URLs straight in), inline `<script type="application/json">` (row arrays or column-oriented `{"columns": {"lon": [...], "lat": [...]}}`; must be a DIRECT child of the `<om-layer>`, and when present it wins — omit the `data` attribute), or `wss://` streaming (`key="mmsi"` upserts entities in place, `flush="250ms"` coalesces bursts, `source="name"` selects a `OmMap.registerSource` decoder plugin), or a polled REST snapshot (`refresh="5s"` re-fetches and replaces — for live endpoints that return the full current state). TILED layers: a `{z}/{x}/{y}` `data` template is deck's tile URL for `TileLayer`/`MVTLayer` (NOT rows) — passed through to deck verbatim, never fetched/parsed, so `<om-layer type="TileLayer" data="…/{z}/{x}/{y}.png">` works (raster gets a built-in BitmapLayer sublayer) and `type="MVTLayer" data="…/{z}/{x}/{y}.pbf"` self-renders vector tiles with `get-*` accessors applying to each decoded feature's properties; a tiled layer has no local rows so `ctx.data`/`ctx.stats`/`filter-*` don't apply. Authenticated endpoints: call `OmMap.configureData({ headers: {...} })` in a script — never put tokens in attributes. `$field` accessors work identically on all of them — never write column-index code yourself. One columnar restriction: the `js` full-JS opt-in is not allowed on Arrow/columnar layers (validation will tell you; use `$field` accessors instead). For 3D models use `type="ScenegraphLayer"` with `scenegraph="./model.glb"` (required) and `get-orientation="[0, $heading, 90]"` — the roll of 90 stands Y-up glTF models upright; see docs/3d-assets.md. GeoTIFF/COG rasters use `type="COGLayer"` with `src="./dem.tif"` (NOT `data` — rasters stream tiles by Range request, they are not parsed rows): `min`/`max` set the rescale window (default 0–255; ALWAYS set them for float/16-bit data like DEMs), `colormap` picks a bundled ramp for single-band sources (gray, viridis, plasma, inferno, magma, cividis, rdylgn, rdbu, spectral, terrain, jet, turbo), `nodata` overrides the source sentinel (renders transparent); plain 8-bit RGB COGs need no styling attributes; restretch/recolor are GPU uniforms (no refetch) and the legend ramp derives from colormap+min/max automatically. Sources must be Cloud-Optimized (`gdal_translate -of COG` otherwise).
|
|
32
|
+
- Geotagged drone JPEGs are the library-owned `ImageOverlay` type, not row `data` and not a raw `BitmapLayer`: `<om-layer type="ImageOverlay" src="./photo.jpg" georeference="exif">`. It reads GPS/relative altitude/camera/focal length plus DJI gimbal metadata through the configured fetch policy, waits before `ready`, bakes yaw/roll, and computes visualization-grade flat-ground bounds. Unknown cameras need `sensor-width-mm` + `sensor-height-mm` (and `focal-length-mm` when EXIF lacks it). For collaborative/saved maps call `OmMap.resolveImageOverlay(fileOrUrl)`, upload its returned `image`, then reconstruct using `src` + the returned explicit `bounds` (no EXIF fetch). Use `COGLayer` for large orthomosaics; see docs/image-overlays.md.
|
|
32
33
|
- `<om-widget type="legend|layer-switcher|basemap-switcher|lighting|zoom-controls|undo-redo|scale-bar|attribution|filter|vega-lite|measure" position="bottom-end">` — static UI panels. `position` takes one of 8 managed slots (logical, RTL-aware: `top-start|top-center|top-end|center-start|center-end|bottom-start|bottom-center|bottom-end`; legacy corners `top-left` etc. alias) — same-slot widgets stack with flush edges and a shared gap (never overlap); provider attribution joins `bottom-end` and the license badge joins `bottom-start` as in-flow members, so required chrome never covers a widget; `order="1"` orders within a slot; adjacent compact button widgets (zoom-controls, undo-redo, widgets-toggle) auto-merge into ONE control group with dividers (`cluster="false"` opts a widget out); `position="manual"` renders a plain block you place with your own CSS (even outside the map). At map widths ≤640px managed widgets auto-fold into one accessible drawer per map side; `fold="never"` exempts an essential widget, `widgets-fold="off"` opts the map out, `--om-widget-fold-breakpoint` changes the threshold. Layout tokens on `<om-map>`: `widget-style="gap:10 opacity:0.9 inset:16"` (keys inset/gap/inset-x/-y/gap-x/-y/opacity/radius/size, px except opacity) or the `--om-widget-inset-x/-y/-gap-x/-gap-y/-opacity/-radius/-fold-breakpoint` custom properties. Built-ins are themeable from page CSS via custom properties (they inherit through the shadow root): `om-map { --om-widget-bg: #111827; --om-widget-fg: #f9fafb; }` — full set: `--om-widget-bg/-fg/-muted/-border/-hover-bg/-accent`; scope to a single widget with an `om-widget[type=legend]` selector instead. `measure` is a geodesic ruler: `modes="distance area"` (default both), `units="metric|imperial|nautical"` — click the map to place points, live per-segment + total labels render on the map, and it dispatches an `om-measure` event (`detail = {mode, units, totalMeters, segments, areaMeters2, perimeterMeters, poleWarning}`); it reuses the draw capture stack (measure/draw mutually exclusive) and its geometry is ephemeral (never saved, not an undo step). `scale-bar` now takes the same `units`. No `type` + HTML + `<script type="om/widget">` = custom widget with `ctx` (`ctx.layers`, `ctx.data(id)`, `ctx.dataInViewport(id)`, `ctx.stats(id, field)`, `ctx.viewport`, `ctx.selection`, `ctx.emit(action, payload)`), `this.watch = ['data:<layerId>', 'viewport', 'selection', 'layers', 'history', 'basemap']` (`layers` also fires on visibility/filter changes; `basemap` on basemap switches; `history` on undo/redo availability), `this.$(sel)`, `vegaEmbed`/`d3` as globals.
|
|
33
34
|
- Custom-widget event emission (the #1 custom-widget bug — a widget that renders but does nothing): a widget DRIVES the map ONLY by EMITTING a registered action; it never mutates the map or dispatches its own `CustomEvent`. Two ways: (1) declarative `data-emit="<action>"` + `data-*` payload keys on an element (fires on click, or change for form controls whose `.value` is auto-added; `data-*` values are STRINGS — use `ctx.emit` for numeric/array payloads like a slider's range); (2) `ctx.emit(action, payload)` for typed payloads, wired INSIDE `render` (so `ctx` is in scope) by assigning `.oninput`/`.onclick` — e.g. a day slider: `this.render = (ctx) => { this.$("#day").oninput = e => ctx.emit("filter-layer", { layer: "quakes", field: "day", range: [+e.target.value, +e.target.value] }); }`. Actions + payloads: `filter-layer {layer, field?, range:[min,max]}`, `toggle-layer {layer, visible?}`, `fly-to {center:[lng,lat], zoom?, duration?}`, `zoom-to-feature {layer, featureId}`, `set-basemap {basemap}`, `highlight-feature {layer, featureId}`, `show-overlay`/`hide-overlay {target}`, `story-play`/`story-pause`/`story-seek {story, t?}`, `undo`/`redo`, `zoom-in`/`zoom-out`, `set-widgets-visible {visible}`; register more with `OmMap.registerAction(name, handler)`. NEVER inline `onclick=`/`oninput=` — `ctx` isn't a global and CSP blocks them, so it silently fires nothing (validation errors on it). For a plain value/time slider prefer the built-in `<om-widget type="filter" layer=… field=…>` — it wires `filter-layer` for you; hand-author only for bespoke UI.
|
|
34
35
|
- `<om-overlay id="..." anchor-from="selection">` — rich geo-anchored HTML (≤ ~20 per map). Anchors: `anchor="[lng, lat]"` (static), `anchor-from="selection"` (follows picks), or `anchor-layer="regions" anchor-feature-id="mission"` (anchored to a feature's own geometry — bbox center — no coordinates in markup; `{{field}}` interpolates that feature's attributes). `{{field}}` interpolates the picked feature HTML-escaped; `{{{field}}}` is raw (avoid). For labels on many features use `PopupLayer`, not overlays.
|
package/onlymapjs.html-data.json
CHANGED
|
@@ -281,6 +281,9 @@
|
|
|
281
281
|
{
|
|
282
282
|
"name": "IconLayer"
|
|
283
283
|
},
|
|
284
|
+
{
|
|
285
|
+
"name": "ImageOverlay"
|
|
286
|
+
},
|
|
284
287
|
{
|
|
285
288
|
"name": "LineLayer"
|
|
286
289
|
},
|
|
@@ -886,7 +889,55 @@
|
|
|
886
889
|
},
|
|
887
890
|
{
|
|
888
891
|
"name": "src",
|
|
889
|
-
"description": "deck.gl
|
|
892
|
+
"description": "deck.gl src."
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
"name": "georeference",
|
|
896
|
+
"description": "deck.gl georeference."
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
"name": "sensor-width-mm",
|
|
900
|
+
"description": "deck.gl sensorWidthMm."
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
"name": "sensor-height-mm",
|
|
904
|
+
"description": "deck.gl sensorHeightMm."
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
"name": "focal-length-mm",
|
|
908
|
+
"description": "deck.gl focalLengthMm."
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
"name": "bounds",
|
|
912
|
+
"description": "deck.gl bounds."
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"name": "metadata",
|
|
916
|
+
"description": "deck.gl metadata."
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"name": "depth-test",
|
|
920
|
+
"description": "deck.gl parameters.depthTest."
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
"name": "image",
|
|
924
|
+
"description": "deck.gl image."
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
"name": "desaturate",
|
|
928
|
+
"description": "deck.gl desaturate."
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"name": "transparent-color",
|
|
932
|
+
"description": "deck.gl transparentColor."
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
"name": "tint-color",
|
|
936
|
+
"description": "deck.gl tintColor."
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
"name": "texture-parameters",
|
|
940
|
+
"description": "deck.gl textureParameters."
|
|
890
941
|
},
|
|
891
942
|
{
|
|
892
943
|
"name": "min",
|
|
@@ -956,34 +1007,10 @@
|
|
|
956
1007
|
"name": "width-max-pixels",
|
|
957
1008
|
"description": "deck.gl widthMaxPixels."
|
|
958
1009
|
},
|
|
959
|
-
{
|
|
960
|
-
"name": "image",
|
|
961
|
-
"description": "deck.gl image."
|
|
962
|
-
},
|
|
963
|
-
{
|
|
964
|
-
"name": "bounds",
|
|
965
|
-
"description": "deck.gl bounds."
|
|
966
|
-
},
|
|
967
1010
|
{
|
|
968
1011
|
"name": "_image-coordinate-system",
|
|
969
1012
|
"description": "deck.gl _imageCoordinateSystem."
|
|
970
1013
|
},
|
|
971
|
-
{
|
|
972
|
-
"name": "desaturate",
|
|
973
|
-
"description": "deck.gl desaturate."
|
|
974
|
-
},
|
|
975
|
-
{
|
|
976
|
-
"name": "transparent-color",
|
|
977
|
-
"description": "deck.gl transparentColor."
|
|
978
|
-
},
|
|
979
|
-
{
|
|
980
|
-
"name": "tint-color",
|
|
981
|
-
"description": "deck.gl tintColor."
|
|
982
|
-
},
|
|
983
|
-
{
|
|
984
|
-
"name": "texture-parameters",
|
|
985
|
-
"description": "deck.gl textureParameters."
|
|
986
|
-
},
|
|
987
1014
|
{
|
|
988
1015
|
"name": "disk-resolution",
|
|
989
1016
|
"description": "deck.gl diskResolution."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nika-js/onlymap",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Declarative deck.gl maps for HTML and React — interactive WebGL mapping with GeoJSON/CSV/Arrow data, MapLibre basemaps, widgets, popups, and live streams from a custom-element manifest or typed React components. TypeScript, no build step.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"publishConfig": {
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
],
|
|
107
107
|
"scripts": {
|
|
108
108
|
"dev": "vite",
|
|
109
|
-
"build": "npm run typecheck && npm run gen:licenses && vite build && vite build --config vite.react.config.ts && vite build --config vite.deck.config.ts && vite build --config vite.standalone.config.ts && npm run build:types",
|
|
109
|
+
"build": "npm run typecheck && npm run gen:licenses && vite build && vite build --config vite.react.config.ts && vite build --config vite.deck.config.ts && vite build --config vite.standalone.config.ts && node dev/assert-bundle-cdn-safe.mjs && npm run build:types",
|
|
110
110
|
"build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
111
111
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.e2e.json --noEmit && tsc -p cloud/workers/telemetry/tsconfig.json",
|
|
112
112
|
"test": "vitest run",
|
|
@@ -150,6 +150,7 @@
|
|
|
150
150
|
"d3-color": "^3.1.0",
|
|
151
151
|
"d3-interpolate": "^3.0.1",
|
|
152
152
|
"d3-scale": "^4.0.2",
|
|
153
|
+
"exifr": "^7.1.3",
|
|
153
154
|
"flatgeobuf": "^4.4.0",
|
|
154
155
|
"fzstd": "^0.1.1",
|
|
155
156
|
"happy-dom": "^20.10.6",
|
|
@@ -23,7 +23,7 @@ Use OnlyMapJS as a declarative HTML map library. Write custom elements such as `
|
|
|
23
23
|
</script>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
For no-build CDN pages, use the single-file standalone bundle from a raw-file CDN — `https://unpkg.com/@nika-js/onlymap@0.5.
|
|
26
|
+
For no-build CDN pages, use the single-file standalone bundle from a raw-file CDN — `https://unpkg.com/@nika-js/onlymap@0.5.8` (the bare package URL serves `dist/onlymap.standalone.js`) — plus `<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.5.8/dist/onlymapjs.css">`. Never a rebundling CDN (esm.sh, skypack): re-bundling duplicates the deck.gl/luma.gl runtime and every layer fails shader compilation.
|
|
27
27
|
|
|
28
28
|
## React Projects
|
|
29
29
|
|
|
@@ -72,6 +72,7 @@ Load the smallest reference needed for the task:
|
|
|
72
72
|
- Keep mobile chrome usable -> rely on the default map-width auto-fold into per-side drawers; mark only essential controls `fold="never"`. Use `widgets-fold="off"` only when the user explicitly wants fixed wide-layout chrome.
|
|
73
73
|
- Group adjacent map buttons (zoom + undo + toggle into one control group) -> just place compact button widgets in the same `position` slot; they auto-cluster. `cluster="false"` opts one out. Do NOT build a wrapper widget.
|
|
74
74
|
- GeoTIFF/COG raster (DEM, satellite imagery, NDVI) -> `<om-layer type="COGLayer" src="…tif">` with `min`/`max`/`colormap` for single-band data (see syntax.md — `src`, not `data`).
|
|
75
|
+
- Geotagged drone JPEG -> `<om-layer type="ImageOverlay" src="…jpg" georeference="exif">`; for saved/collaborative maps persist the processed image and reconstruct with explicit `bounds` (see syntax.md; this is visualization-grade, not orthorectification).
|
|
75
76
|
- CityJSON/CityJSONSeq per-face surfaces mode (`?om-surfaces=1`) -> always pair the `SolidPolygonLayer` with a companion `<om-layer type="PathLayer">` using `get-path="$outline"` to make roof/wall edges visible. This mode is unlit and `SolidPolygonLayer`'s own `wireframe` prop does nothing here (deck only builds wireframe geometry when `extruded: true`); the `PathLayer` is the only way to see face edges. Give it the same `filter-field`/`filter-range` as the fill layer so filtered-out buildings' outlines disappear too. See syntax.md.
|
|
76
77
|
- Live entity updates -> `wss://` stream with `key` and optional `source` decoder.
|
|
77
78
|
- REST snapshot that changes over time -> `refresh="5s"`.
|
|
@@ -16,8 +16,8 @@ Vite/npm project:
|
|
|
16
16
|
Static CDN page (raw-file CDNs only — unpkg/jsDelivr; never esm.sh or another rebundling CDN, which duplicates the WebGL runtime and breaks layer shaders):
|
|
17
17
|
|
|
18
18
|
```html
|
|
19
|
-
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.5.
|
|
20
|
-
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.5.
|
|
19
|
+
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.5.8/dist/onlymapjs.css">
|
|
20
|
+
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.5.8"></script>
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Always include `onlymapjs.css` — it carries the MapLibre basemap styles and the no-JS fallback rules (`<om-fallback>` / default banner). For the fallback to work in script-disabled previews it must load without JavaScript: a real `<link rel="stylesheet">` or inlined `<style>` on no-build pages (a bundler-emitted stylesheet is fine in npm projects).
|
|
@@ -130,7 +130,7 @@ For an epoch-millisecond filter, format the built-in widget's numeric labels dec
|
|
|
130
130
|
|
|
131
131
|
Use the `type` value exactly:
|
|
132
132
|
|
|
133
|
-
`A5Layer`, `ArcLayer`, `BitmapLayer`, `COGLayer`, `ColumnLayer`, `ContourLayer`, `GeoJsonLayer`, `GeohashLayer`, `GreatCircleLayer`, `GridCellLayer`, `GridLayer`, `H3ClusterLayer`, `H3HexagonLayer`, `HeatmapLayer`, `HexagonLayer`, `IconLayer`, `LineLayer`, `MVTLayer`, `PathLayer`, `PointCloudLayer`, `PolygonLayer`, `PopupLayer`, `QuadkeyLayer`, `S2Layer`, `ScatterplotLayer`, `ScenegraphLayer`, `ScreenGridLayer`, `SimpleMeshLayer`, `SolidPolygonLayer`, `TerrainLayer`, `TextLayer`, `Tile3DLayer`, `TileLayer`, `TripsLayer`.
|
|
133
|
+
`A5Layer`, `ArcLayer`, `BitmapLayer`, `COGLayer`, `ColumnLayer`, `ContourLayer`, `GeoJsonLayer`, `GeohashLayer`, `GreatCircleLayer`, `GridCellLayer`, `GridLayer`, `H3ClusterLayer`, `H3HexagonLayer`, `HeatmapLayer`, `HexagonLayer`, `IconLayer`, `ImageOverlay`, `LineLayer`, `MVTLayer`, `PathLayer`, `PointCloudLayer`, `PolygonLayer`, `PopupLayer`, `QuadkeyLayer`, `S2Layer`, `ScatterplotLayer`, `ScenegraphLayer`, `ScreenGridLayer`, `SimpleMeshLayer`, `SolidPolygonLayer`, `TerrainLayer`, `TextLayer`, `Tile3DLayer`, `TileLayer`, `TripsLayer`.
|
|
134
134
|
|
|
135
135
|
Common choices:
|
|
136
136
|
|
|
@@ -141,6 +141,7 @@ Common choices:
|
|
|
141
141
|
- Tiles: `TileLayer`, `MVTLayer`, `Tile3DLayer`.
|
|
142
142
|
- 3D models: `ScenegraphLayer`, `SimpleMeshLayer`, `PointCloudLayer`, `Tile3DLayer`.
|
|
143
143
|
- GeoTIFF/COG rasters: `COGLayer`.
|
|
144
|
+
- Geotagged drone JPEGs: `ImageOverlay`.
|
|
144
145
|
|
|
145
146
|
|
|
146
147
|
|
|
@@ -159,6 +160,23 @@ Common choices:
|
|
|
159
160
|
- Plain 8-bit RGB COGs (satellite truecolor) need no styling attributes at all.
|
|
160
161
|
- Restretch/recolor (min/max/colormap edits) are GPU uniform updates — tiles are not refetched. The legend widget renders the colormap ramp automatically when `colormap` + `min`/`max` are authored.
|
|
161
162
|
|
|
163
|
+
### ImageOverlay (drone JPEG)
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<om-layer id="photo" type="ImageOverlay"
|
|
167
|
+
src="./DJI_0123.jpg" georeference="exif"
|
|
168
|
+
opacity="0.8"></om-layer>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- `src` (required) — a JPEG with GPS/relative-altitude/camera/focal-length EXIF and DJI gimbal XMP.
|
|
172
|
+
- `georeference="exif"` — fetches through `OmMap.configureData`, computes a flat-ground WGS84 footprint, and bakes yaw/roll into the pixels. `map.ready` waits for it.
|
|
173
|
+
- Verified camera paths include DJI FC300S and M30T, including M30T JPEGs carrying a 180° gimbal-roll correction.
|
|
174
|
+
- Unknown camera: supply `sensor-width-mm` + `sensor-height-mm` together. If EXIF lacks focal length, also supply `focal-length-mm`. Values are physical millimetres and must be positive.
|
|
175
|
+
- Persisted/preprocessed form: omit `georeference` and set `bounds="[west,south,east,north]"`; `src` may be the processed PNG. Optional JSON `metadata` passes through. Explicit bounds perform no EXIF fetch.
|
|
176
|
+
- `depth-test` defaults false. `opacity`, `visible`, and `pickable` behave like other layers.
|
|
177
|
+
- The public `await OmMap.resolveImageOverlay(fileOrUrl, options?)` returns `{image, bounds, metadata}` for upload/persistence.
|
|
178
|
+
- Visualization-grade only: no terrain, lens-distortion, calibration, or perspective-correct four-corner orthorectification. Use `COGLayer` for large orthomosaics.
|
|
179
|
+
|
|
162
180
|
External layer classes become manifest types via `OmMap.registerLayer({type, deckClass, props})`. Build them on `@nika-js/onlymap/deck` (the bundled `CompositeLayer`/`TileLayer`/… re-exports — a separately-installed deck.gl is a different class hierarchy and breaks in the renderer); function-valued props ride the subclass's `static defaultProps`; register at module top level before the manifest mounts. Full recipe: docs/custom-layers.md.
|
|
163
181
|
|
|
164
182
|
### Data Sources
|