@nika-js/onlymap 0.5.3 → 0.5.7
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 +20 -7
- package/THIRD-PARTY-LICENSES.md +120 -0
- package/dist/{Arrow.dom-BNjbQ9jb.js → Arrow.dom-BFGShwSA.js} +854 -1427
- package/dist/{LercDecode.es-S6KKhkuA.js → LercDecode.es-Bp2rG98n.js} +1 -1
- package/dist/{basemap-BSCq9hHZ.js → basemap-CfOA0HWY.js} +1 -1
- package/dist/builder-CqJZRFaq.js +580 -0
- package/dist/data-layer.d.ts +4 -0
- package/dist/date-format.d.ts +18 -0
- package/dist/flatgeobuf-Cx0IwxhV.js +6332 -0
- package/dist/full.esm-Cl_Dig1y.js +1467 -0
- package/dist/geoparquet-kW7KUrwB.js +35 -0
- package/dist/geoparquet.d.ts +33 -0
- package/dist/image-overlay.d.ts +83 -0
- package/dist/{index-BCgjJcZn.js → index-BLy1eTWe.js} +1 -1
- package/dist/index-BYbMtNVH.js +2301 -0
- package/dist/{index-BoAq5XsU.js → index-CUKgoX_E.js} +13291 -12728
- package/dist/index-CgPV7QlM.js +4019 -0
- package/dist/{index-D1swbykc.js → index-CnY_rdB8.js} +1 -1
- package/dist/{index-DfNGlG_k.js → index-MRS7UAHr.js} +1 -1
- package/dist/{index-BTcRCrfX.js → index-wZ6n6ggy.js} +2 -2
- 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-n0GaWEmL.js → lerc-DWbkmLYR.js} +2 -2
- package/dist/onlymap.standalone.js +59664 -44945
- package/dist/onlymapjs.js +76 -74
- package/dist/{raster-DO-Ex2Lb.js → raster-5jEwGISN.js} +2 -2
- package/dist/validation.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/docs/3d-assets.md +1 -1
- package/docs/image-overlays.md +75 -0
- package/llms.txt +7 -4
- package/onlymapjs.html-data.json +147 -86
- package/package.json +5 -1
- package/skills/onlymapjs/SKILL.md +4 -1
- package/skills/onlymapjs/references/syntax.md +120 -19
- package/skills/onlymapjs/references/testing.md +11 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { r as p, n as d } from "./index-CUKgoX_E.js";
|
|
2
|
+
function g(t) {
|
|
3
|
+
if (t == null) return !0;
|
|
4
|
+
const e = t, n = e.id?.code;
|
|
5
|
+
return n != null ? n === 84 || n === 4326 || n === "CRS84" || n === "4326" : typeof e.name == "string" && /^\s*(ogc:)?(wgs\s*84|crs\s*84|wgs84)\s*$/i.test(e.name);
|
|
6
|
+
}
|
|
7
|
+
function y(t) {
|
|
8
|
+
const e = t;
|
|
9
|
+
return typeof e?.name == "string" && e.name ? `"${e.name}"` : e?.id?.code != null ? `${e.id.authority ?? "?"}:${e.id.code}` : "a non-CRS84 CRS";
|
|
10
|
+
}
|
|
11
|
+
function h(t, e, n) {
|
|
12
|
+
const o = e.primary_column;
|
|
13
|
+
if (!o)
|
|
14
|
+
throw new Error(`data="${n}": GeoParquet "geo" metadata names no primary_column — can't tell which column is geometry.`);
|
|
15
|
+
const c = e.columns?.[o]?.crs;
|
|
16
|
+
if (!g(c))
|
|
17
|
+
throw new Error(
|
|
18
|
+
`data="${n}": GeoParquet CRS ${y(c)} isn't CRS84/EPSG:4326 — reprojection isn't supported yet (deck.gl renders lng/lat). Reproject first, e.g. ogr2ogr -t_srs EPSG:4326 out.parquet in.parquet.`
|
|
19
|
+
);
|
|
20
|
+
if (t.length === 0)
|
|
21
|
+
return console.warn(`[onlymapjs] data="${n}": GeoParquet has no rows — empty layer.`), [];
|
|
22
|
+
const u = t.map((r) => r[o]);
|
|
23
|
+
if (u.every((r) => r != null && r.type === "Point")) {
|
|
24
|
+
const r = t.map(({ [o]: i, ...m }) => m), a = p(r), s = u.map((i) => i.coordinates ?? void 0);
|
|
25
|
+
return { length: t.length, columns: { ...a?.columns ?? {}, [o]: s } };
|
|
26
|
+
}
|
|
27
|
+
const l = t.map(({ [o]: r, ...a }) => {
|
|
28
|
+
const s = a.id;
|
|
29
|
+
return { type: "Feature", ...s != null ? { id: s } : {}, geometry: r ?? null, properties: a };
|
|
30
|
+
});
|
|
31
|
+
return d({ type: "FeatureCollection", features: l });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
h as geoParquetToLayerData
|
|
35
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoParquet (spec: issue #14). Decodes with hyparquet — a pure-JS, zero-dep
|
|
3
|
+
* Parquet reader — plus hyparquet-compressors for snappy/gzip/zstd (its zstd
|
|
4
|
+
* IS the same `fzstd` the Arrow path already bundles; no second codec ships).
|
|
5
|
+
* hyparquet reads the GeoParquet `geo` file metadata and decodes the WKB
|
|
6
|
+
* primary geometry column to GeoJSON geometry itself, so no WKB decoder is
|
|
7
|
+
* ours to maintain.
|
|
8
|
+
*
|
|
9
|
+
* What IS ours: `geo` metadata validation, a CRS84 guard (deck.gl renders in
|
|
10
|
+
* lng/lat — a projected file would land in the ocean, so a non-CRS84 CRS is a
|
|
11
|
+
* loud structured error until the reprojection workstream lands, NOT a silent
|
|
12
|
+
* skip the way GL does it), and the Arrow geometry rule from
|
|
13
|
+
* `arrowTableToLayerData` — all-Point tables transpose to columnar (zero row
|
|
14
|
+
* materialization on the render path), while lines/polygons/mixed become
|
|
15
|
+
* GeoJSON feature rows that every geometry consumer speaks.
|
|
16
|
+
*/
|
|
17
|
+
import type { LayerData } from "./ir";
|
|
18
|
+
/** The parsed GeoParquet `geo` file-metadata value (a JSON string in key_value_metadata). */
|
|
19
|
+
export interface GeoParquetMetadata {
|
|
20
|
+
primary_column?: string;
|
|
21
|
+
columns?: Record<string, {
|
|
22
|
+
encoding?: string;
|
|
23
|
+
geometry_types?: string[];
|
|
24
|
+
crs?: unknown;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* hyparquet rows (geometry already decoded to GeoJSON) → LayerData, applying
|
|
29
|
+
* the CRS guard and the Arrow all-Point-columnar / lines-polys-feature-rows
|
|
30
|
+
* split. `rows` is consumed after the geo-metadata gate in data-layer's
|
|
31
|
+
* PARQUET_FORMAT.
|
|
32
|
+
*/
|
|
33
|
+
export declare function geoParquetToLayerData(rows: Record<string, unknown>[], geo: GeoParquetMetadata, url: string): LayerData;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { LayerAssetState } from "./ir";
|
|
2
|
+
export type ImageBounds = [west: number, south: number, east: number, north: number];
|
|
3
|
+
export interface DroneExifData {
|
|
4
|
+
latitude: number;
|
|
5
|
+
longitude: number;
|
|
6
|
+
RelativeAltitude: number;
|
|
7
|
+
ExifImageWidth: number;
|
|
8
|
+
ExifImageHeight: number;
|
|
9
|
+
GimbalYawDegree: number;
|
|
10
|
+
GimbalPitchDegree: number;
|
|
11
|
+
GimbalRollDegree: number;
|
|
12
|
+
FocalLength?: number;
|
|
13
|
+
Make?: string;
|
|
14
|
+
Model?: string;
|
|
15
|
+
GPSAltitude?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DroneImageMetadata {
|
|
18
|
+
/** Normalized source metadata. GPS remains the camera position, not the pitch-adjusted footprint center. */
|
|
19
|
+
exifData: DroneExifData;
|
|
20
|
+
sourceCenter: [longitude: number, latitude: number];
|
|
21
|
+
adjustedCenter: [longitude: number, latitude: number];
|
|
22
|
+
gsdX: number;
|
|
23
|
+
gsdY: number;
|
|
24
|
+
fovDegrees: number;
|
|
25
|
+
sensorWidthMm: number;
|
|
26
|
+
sensorHeightMm: number;
|
|
27
|
+
nonNadir: boolean;
|
|
28
|
+
pixelRotationDegrees: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ResolveImageOverlayOptions {
|
|
31
|
+
/** Manual camera overrides for models absent from the bundled database. Width and height must be supplied together. */
|
|
32
|
+
sensorWidthMm?: number;
|
|
33
|
+
sensorHeightMm?: number;
|
|
34
|
+
/** Overrides EXIF FocalLength. No guessed focal-length fallback is used. */
|
|
35
|
+
focalLengthMm?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ResolvedImageOverlay {
|
|
38
|
+
/** Original JPEG when no pixel transform was needed; otherwise a transparency-preserving PNG. */
|
|
39
|
+
image: Blob;
|
|
40
|
+
bounds: ImageBounds;
|
|
41
|
+
metadata: DroneImageMetadata;
|
|
42
|
+
}
|
|
43
|
+
export interface DroneSensorDimensions {
|
|
44
|
+
widthMm: number;
|
|
45
|
+
heightMm: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* PlanetGPT's stage-1 camera roster. Pixel pitch was present in its tuple but
|
|
49
|
+
* never participates in FOV/GSD, so this contract retains only used values.
|
|
50
|
+
*/
|
|
51
|
+
export declare const DRONE_SENSOR_DATABASE: Readonly<Record<string, DroneSensorDimensions>>;
|
|
52
|
+
/** Normalize exifr's permissive output into the serializable contract used by all later stages. */
|
|
53
|
+
export declare function normalizeDroneExif(rawValue: unknown): DroneExifData;
|
|
54
|
+
export declare function determineDroneFovDegrees(exif: DroneExifData, options?: ResolveImageOverlayOptions): {
|
|
55
|
+
fovDegrees: number;
|
|
56
|
+
sensor: DroneSensorDimensions;
|
|
57
|
+
focalLengthMm: number;
|
|
58
|
+
};
|
|
59
|
+
/** PlanetGPT-compatible non-nadir center approximation. */
|
|
60
|
+
export declare function adjustCenterForPitch(latitude: number, longitude: number, altitude: number, pitch: number, yaw: number): {
|
|
61
|
+
latitude: number;
|
|
62
|
+
longitude: number;
|
|
63
|
+
};
|
|
64
|
+
/** PlanetGPT-compatible yaw-expanded, north-aligned WGS84 footprint. */
|
|
65
|
+
export declare function calculateDroneFootprint(latitude: number, longitude: number, altitude: number, yaw: number, imageWidth: number, imageHeight: number, diagonalFovDegrees: number): {
|
|
66
|
+
bounds: ImageBounds;
|
|
67
|
+
gsdX: number;
|
|
68
|
+
gsdY: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Public one-shot resolver. Hosts with persistence upload `image`, store
|
|
72
|
+
* `bounds` + `metadata`, and reconstruct later with explicit bounds so
|
|
73
|
+
* collaborators/reloads never re-read EXIF.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveImageOverlay(input: string | Blob, options?: ResolveImageOverlayOptions): Promise<ResolvedImageOverlay>;
|
|
76
|
+
/**
|
|
77
|
+
* Shared synchronous IR bridge for DOM and programmatic front ends. It starts
|
|
78
|
+
* one async resolution, returns a pending placeholder, and asks every waiting
|
|
79
|
+
* map/controller to reconcile once the cached result settles.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveImageOverlayProps(props: Record<string, unknown>, onLoaded: () => void, snapshot?: boolean): LayerAssetState;
|
|
82
|
+
/** @internal Test isolation; URL caches otherwise intentionally live for the page, like Data Layer URL caches. */
|
|
83
|
+
export declare function resetImageOverlayCacheForTests(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ak as Bt, ax as Xt, ay as Yt, az as Us } from "./index-CUKgoX_E.js";
|
|
2
2
|
import { w as gs, t as Hs, f as Ws, m as Qs } from "./mgrs-BY9bIvp4.js";
|
|
3
3
|
import { c as Xs } from "./convert-arrow-schema-DrAihRf9.js";
|
|
4
4
|
import { y as Ys, A as bt, a as Ks, z as Vs, R as Zs } from "./recordbatch-Bpc0uxFn.js";
|