@nika-js/onlymap 0.5.3 → 0.5.6
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 +16 -4
- package/THIRD-PARTY-LICENSES.md +93 -0
- package/dist/{Arrow.dom-BNjbQ9jb.js → Arrow.dom-BFGShwSA.js} +854 -1427
- package/dist/{LercDecode.es-S6KKhkuA.js → LercDecode.es-5mr_B7pP.js} +1 -1
- package/dist/{basemap-BSCq9hHZ.js → basemap-DJjFEgA9.js} +1 -1
- package/dist/builder-CqJZRFaq.js +580 -0
- package/dist/date-format.d.ts +18 -0
- package/dist/flatgeobuf-Cx0IwxhV.js +6332 -0
- package/dist/geoparquet-AL10HAyd.js +35 -0
- package/dist/geoparquet.d.ts +33 -0
- package/dist/{index-DfNGlG_k.js → index-BQaxwlV3.js} +1 -1
- package/dist/index-BYbMtNVH.js +2301 -0
- package/dist/{index-BTcRCrfX.js → index-BtPO4p2v.js} +2 -2
- package/dist/index-CgPV7QlM.js +4019 -0
- package/dist/{index-BCgjJcZn.js → index-DqE9di9E.js} +1 -1
- package/dist/{index-BoAq5XsU.js → index-G3hmIs2P.js} +11389 -11196
- package/dist/{index-D1swbykc.js → index-iwo3R3LT.js} +1 -1
- package/dist/{lerc-n0GaWEmL.js → lerc-Dx3uB2j-.js} +2 -2
- package/dist/onlymap.standalone.js +57118 -44241
- package/dist/onlymapjs.js +28 -28
- package/dist/{raster-DO-Ex2Lb.js → raster-BPn_dJpK.js} +2 -2
- package/dist/validation.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/llms.txt +6 -4
- package/onlymapjs.html-data.json +95 -61
- package/package.json +4 -1
- package/skills/onlymapjs/SKILL.md +3 -1
- package/skills/onlymapjs/references/syntax.md +101 -18
- package/skills/onlymapjs/references/testing.md +11 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { r as p, n as d } from "./index-G3hmIs2P.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;
|