@nika-js/onlymap 0.12.0 → 0.13.0
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/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/dist/{basemap-CtDse0mW.js → basemap-BxqFTBzX.js} +2 -2
- package/dist/build-D4iI8O9b.js +208 -0
- package/dist/cartograph.js +43 -41
- package/dist/cartograph.standalone.js +3 -1
- package/dist/client-BYFePLZV.js +6878 -0
- package/dist/{geoparquet-BTHYX1ET.js → geoparquet-BV32P0nI.js} +1 -1
- package/dist/{globe-view-KrKNOmVs.js → globe-view-B_X6obse.js} +6 -6
- package/dist/{hillshade-CijRdYyU.js → hillshade-9VS_t-Ks.js} +79 -67
- package/dist/hillshade.d.ts +7 -0
- package/dist/html-data.d.ts +1 -1
- package/dist/{index-21KGElDr.js → index-BR_5FIN1.js} +3 -3
- package/dist/{index-eHYe06mM.js → index-Bct9VWxi.js} +1 -1
- package/dist/index-CbFw6P0B.js +4449 -0
- package/dist/{index-Bfocr1_A.js → index-D3P6Cfbr.js} +38 -38
- package/dist/{index-A45DtXly.js → index-D40H3fpl.js} +54 -54
- package/dist/{index-DoGY-Vgi.js → index-Di1LK4JT.js} +3 -3
- package/dist/{index-DMc81n9B.js → index-IDWDfgTC.js} +33429 -30673
- package/dist/{index-DS6VUGi6.js → index-JewSBOjJ.js} +49 -49
- package/dist/{index-BPa2CC8T.js → index-eSuCj2Bn.js} +42 -42
- package/dist/layer-registry.d.ts +1 -0
- package/dist/{lerc-DjrPALEj.js → lerc-C42a0ISa.js} +1 -1
- package/dist/onlymap.standalone.js +60636 -51605
- package/dist/onlymapjs.js +47 -47
- package/dist/plane-gpu/gpu-layer-types.d.ts +35 -0
- package/dist/plane-gpu/plane-basemap.d.ts +10461 -0
- package/dist/plane-gpu/plane-gpu-view.d.ts +90 -0
- package/dist/plane-gpu/projection-params.d.ts +47 -0
- package/dist/plane-layers.d.ts +2 -0
- package/dist/plane-seam.d.ts +48 -0
- package/dist/plane-tileset.d.ts +23 -2
- package/dist/plane-vector/build.d.ts +107 -0
- package/dist/plane-vector/client.d.ts +18 -0
- package/dist/plane-vector/cut-ends-extension.d.ts +30 -0
- package/dist/plane-vector/plane-mvt-layer.d.ts +10412 -0
- package/dist/plane-vector/tile-cut.d.ts +45 -0
- package/dist/plane-vector/worker.d.ts +15 -0
- package/dist/plane-warp.d.ts +12 -1
- package/dist/{post-process-effect-Be1qa2DD.js → post-process-effect-ktcgAjmv.js} +11 -11
- package/dist/programmatic.d.ts +6 -0
- package/dist/projection.d.ts +51 -0
- package/dist/{raster-zC3qXBrs.js → raster-CIxg_M_1.js} +3 -3
- package/dist/{raster-pipeline-DspBYxwc.js → raster-pipeline-BODPC9vJ.js} +1 -1
- package/dist/react/om-map.d.ts +4 -0
- package/dist/react.js +259 -252
- package/dist/runtime-core.d.ts +84 -2
- package/dist/{text-on-path-D0_URrD2.js → text-on-path-LZL6NfwZ.js} +74 -66
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-DopOhzfY.js → zarr-D19fNIZt.js} +2 -2
- package/docs/cartograph.md +2 -2
- package/docs/cartography.md +59 -3
- package/docs/testing.md +2 -1
- package/llms.txt +2 -2
- package/onlymapjs.attributes.json +1 -0
- package/onlymapjs.html-data.json +15 -1
- package/package.json +3 -2
- package/skills/onlymapjs/SKILL.md +2 -2
- package/skills/onlymapjs/references/syntax.md +7 -6
- package/dist/index-B_Vhebf7.js +0 -4883
package/dist/runtime-core.d.ts
CHANGED
|
@@ -68,6 +68,23 @@ interface RouteResolvedInfo {
|
|
|
68
68
|
export declare function resolveTilePropertyTableIndex(gltf: unknown, featureIdProperty: string): number;
|
|
69
69
|
/** Mapbox presets/protocol URLs aren't implemented — kept maplibre-free so validation/runtime can check without loading the chunk. */
|
|
70
70
|
export declare function isMapboxBasemap(raw: string): boolean;
|
|
71
|
+
/** Which renderer draws a map — see `rendererFor`. */
|
|
72
|
+
export type RendererChoice = {
|
|
73
|
+
kind: "maplibre";
|
|
74
|
+
} | {
|
|
75
|
+
kind: "deck";
|
|
76
|
+
planePreset?: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Which renderer a map runs for its `crs` and `basemap`, decided here and
|
|
80
|
+
* nowhere else: the first mount, a basemap switch and a crs switch all ask
|
|
81
|
+
* this, and remount exactly when the answer's kind changes. MapLibre draws a
|
|
82
|
+
* basemap in Web Mercator; deck draws everything else — including an
|
|
83
|
+
* OpenFreeMap preset on a projected map, which it draws in the plane
|
|
84
|
+
* (docs/design/gpu-projection.md, phase 5). Any other basemap on a projected
|
|
85
|
+
* map is a validation error, and MapLibre draws it as authored.
|
|
86
|
+
*/
|
|
87
|
+
export declare function rendererFor(crs: string | undefined, basemap: string | undefined): RendererChoice;
|
|
71
88
|
export interface InitialView {
|
|
72
89
|
longitude: number;
|
|
73
90
|
latitude: number;
|
|
@@ -325,7 +342,7 @@ export declare class RuntimeCore {
|
|
|
325
342
|
private firstSettleDrawDone;
|
|
326
343
|
private destroyed;
|
|
327
344
|
private viewState;
|
|
328
|
-
/** `<om-map crs>` — set only for a projected map
|
|
345
|
+
/** `<om-map crs>` — set only for a projected map. Live since Step 0 of docs/design/gpu-projection.md: see `setCrs`. */
|
|
329
346
|
private crs?;
|
|
330
347
|
private crsDef?;
|
|
331
348
|
/**
|
|
@@ -336,6 +353,21 @@ export declare class RuntimeCore {
|
|
|
336
353
|
*/
|
|
337
354
|
private globe;
|
|
338
355
|
private globeStandaloneWarned;
|
|
356
|
+
/**
|
|
357
|
+
* GPU projection (docs/design/gpu-projection.md): a plane whose CRS the
|
|
358
|
+
* patched shader implements is drawn by it — layers keep their lng/lat and
|
|
359
|
+
* the view projects them. Decided per plane from its `+proj=` definition;
|
|
360
|
+
* `OmMap.configureCrs({ gpuProjection: false })` turns it off.
|
|
361
|
+
*/
|
|
362
|
+
private readonly planeGpuMemo;
|
|
363
|
+
/**
|
|
364
|
+
* One plane tileset binding per tiled layer (by deck id): deck keeps a
|
|
365
|
+
* layer's first tileset for life, so a live `crs` switch re-points the
|
|
366
|
+
* binding instead of handing deck a new class (plane-tileset.ts).
|
|
367
|
+
*/
|
|
368
|
+
private readonly tilesetBindings;
|
|
369
|
+
/** The tileset class for a tiled layer on `plane`, the same identity for the layer's whole life. */
|
|
370
|
+
private planeTileset;
|
|
339
371
|
/**
|
|
340
372
|
* The projected plane, once its projection has resolved. Null on a Mercator
|
|
341
373
|
* map, and null on a projected one until proj4 lands — which is why the Deck
|
|
@@ -519,6 +551,18 @@ export declare class RuntimeCore {
|
|
|
519
551
|
private currentController;
|
|
520
552
|
private toDeckViewState;
|
|
521
553
|
private fromDeckViewState;
|
|
554
|
+
/**
|
|
555
|
+
* The one deck View a standalone map runs. Planimetric by construction on a
|
|
556
|
+
* plane: no pitch, no bearing, no world copies — a projected plane does not
|
|
557
|
+
* wrap, so the antimeridian seam and `repeat` are Mercator-only concerns.
|
|
558
|
+
*/
|
|
559
|
+
private standaloneView;
|
|
560
|
+
/**
|
|
561
|
+
* The shader uniforms for the current plane, or null when the CPU path
|
|
562
|
+
* draws it — decided once per plane, as `configureCrs({ gpuProjection })`
|
|
563
|
+
* promises, so the view and the layers never disagree about it.
|
|
564
|
+
*/
|
|
565
|
+
private gpuPlane;
|
|
522
566
|
/**
|
|
523
567
|
* The standalone Deck — Mercator by default, orthographic over a projected
|
|
524
568
|
* plane when `this.plane` is set. Split out of `initRenderer` because a
|
|
@@ -860,10 +904,38 @@ export declare class RuntimeCore {
|
|
|
860
904
|
*/
|
|
861
905
|
/** Live `projection` switch (docs/design/globe.md). The basemap path changes in place; nothing re-ingests. */
|
|
862
906
|
setProjection(value: string | null): void;
|
|
907
|
+
/**
|
|
908
|
+
* Live `crs` switch (docs/design/gpu-projection.md, Step 0). The layers'
|
|
909
|
+
* source data stays lng/lat; `plane-layers.ts` memoises its projected copies
|
|
910
|
+
* and accessor wrappers per (source, plane), so a new plane recomputes them
|
|
911
|
+
* on the next build with no refetch, no reparse and no remount: the deck
|
|
912
|
+
* View, controller and camera swap through props, and the camera itself is
|
|
913
|
+
* untouched because `viewState` is always geographic. The new plane's
|
|
914
|
+
* origin is the current centre.
|
|
915
|
+
*
|
|
916
|
+
* A CRS that fails to resolve reports an error and leaves the map as it was
|
|
917
|
+
* — a live switch must not blank a working map. A switch before the first
|
|
918
|
+
* projection has resolved restarts that resolution, so an in-flight answer
|
|
919
|
+
* for the old CRS cannot land.
|
|
920
|
+
*/
|
|
921
|
+
setCrs(crs: string | null, crsDef: string | null): void;
|
|
922
|
+
private crsGeneration;
|
|
923
|
+
/**
|
|
924
|
+
* Swap the plane under a live standalone Deck: view, controller and camera
|
|
925
|
+
* through props (deck activates the new viewport inside that call), then
|
|
926
|
+
* every layer rebuilt against it. The plane ↔ Mercator case gets fresh
|
|
927
|
+
* layer instances through the `#plane` id suffix in buildLayers — see the
|
|
928
|
+
* note there on the polygon tesselator; e2e/live-crs.spec.ts checks a
|
|
929
|
+
* switch raises no deck error.
|
|
930
|
+
*/
|
|
931
|
+
private adoptPlane;
|
|
863
932
|
/** Whether the map is drawing a globe right now — only the basemap path can, so far. */
|
|
864
933
|
isGlobe(): boolean;
|
|
865
934
|
private warnStandaloneGlobe;
|
|
866
935
|
setBasemap(attr: string | null): void;
|
|
936
|
+
private rendererKind;
|
|
937
|
+
/** Rebuild the renderer for `basemap` from the live camera, and hand it the scene. */
|
|
938
|
+
private remountRenderer;
|
|
867
939
|
private teardownRenderer;
|
|
868
940
|
/**
|
|
869
941
|
* Rebuilds every deck.gl Layer instance from the current IR and hands the
|
|
@@ -882,12 +954,20 @@ export declare class RuntimeCore {
|
|
|
882
954
|
* own geography by the plane tileset (deck's own index choice on an
|
|
883
955
|
* orthographic view means nothing in an OSM pyramid) and each is drawn as a
|
|
884
956
|
* subdivided mesh projected per vertex. Memoised per plane so deck sees one
|
|
885
|
-
* `
|
|
957
|
+
* `renderSubLayers` identity, not a restart per frame; the tileset class is
|
|
958
|
+
* the layer's own binding (`planeTileset`).
|
|
886
959
|
*/
|
|
887
960
|
private planeRasterTileProps;
|
|
888
961
|
private readonly planeRasterMemo;
|
|
889
962
|
/** Layer ids already told that clustering does not run on a plane — one warning each, not one per rebuild. */
|
|
890
963
|
private readonly clusterPlaneWarned;
|
|
964
|
+
/**
|
|
965
|
+
* The keyless vector basemap on a projected map (docs/design/gpu-projection.md,
|
|
966
|
+
* phase 5): the OpenFreeMap preset `basemap` names, drawn by the plane's own
|
|
967
|
+
* vector-tile path instead of MapLibre — undefined otherwise. Its tile
|
|
968
|
+
* template arrives from OpenFreeMap's TileJSON.
|
|
969
|
+
*/
|
|
970
|
+
private planeBasemap?;
|
|
891
971
|
/** How long click-to-expand eases (the `flyTo` default is 0 — an instant cut, which reads as a glitch on a bubble the reader just clicked). Reduced-motion users still get the instant move. */
|
|
892
972
|
static readonly CLUSTER_EXPAND_MS = 600;
|
|
893
973
|
/**
|
|
@@ -976,6 +1056,8 @@ export declare class RuntimeCore {
|
|
|
976
1056
|
private isInCartographFrame;
|
|
977
1057
|
/** The basemap's attribution as plain text — empty with no basemap. See MapLibreBasemapAdapter.attributions(). */
|
|
978
1058
|
attributions(): string[];
|
|
1059
|
+
/** Make `name` the plane basemap (or none): a recolour in place when one is already up, so its tile cache survives. */
|
|
1060
|
+
private setPlaneBasemap;
|
|
979
1061
|
/** The CRS this map is projected into, or null for a Web Mercator map. */
|
|
980
1062
|
projectedCrs(): string | null;
|
|
981
1063
|
getViewport(): MapViewport | undefined;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as N, ad as E } from "./index-IDWDfgTC.js";
|
|
2
2
|
const z = Math.PI / 180, O = 45, I = 24, T = /* @__PURE__ */ new Map();
|
|
3
|
-
let
|
|
3
|
+
let P = null;
|
|
4
4
|
function W(e) {
|
|
5
5
|
if (typeof document > "u") return null;
|
|
6
|
-
if (!
|
|
6
|
+
if (!P) {
|
|
7
7
|
const o = document.createElement("canvas");
|
|
8
|
-
o.width = 8, o.height = 8,
|
|
8
|
+
o.width = 8, o.height = 8, P = o.getContext("2d");
|
|
9
9
|
}
|
|
10
|
-
return
|
|
10
|
+
return P && (P.font = e), P;
|
|
11
11
|
}
|
|
12
12
|
function j(e, o, t) {
|
|
13
13
|
const n = `${t} 100px ${o}`;
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
const f =
|
|
14
|
+
let r = T.get(n);
|
|
15
|
+
r || (r = /* @__PURE__ */ new Map(), T.set(n, r));
|
|
16
|
+
const f = r.get(e);
|
|
17
17
|
if (f !== void 0) return f;
|
|
18
18
|
const u = W(n), a = u ? u.measureText(e).width / 100 : 0.6;
|
|
19
|
-
return
|
|
19
|
+
return r.set(e, a), a;
|
|
20
20
|
}
|
|
21
21
|
function k(e) {
|
|
22
22
|
const o = [0];
|
|
@@ -28,9 +28,9 @@ function k(e) {
|
|
|
28
28
|
function w(e, o, t) {
|
|
29
29
|
const { cumulative: n } = o;
|
|
30
30
|
if (e.length < 2) return null;
|
|
31
|
-
let
|
|
32
|
-
for (;
|
|
33
|
-
const f = n[
|
|
31
|
+
let r = 1;
|
|
32
|
+
for (; r < n.length - 1 && n[r] < t; ) r++;
|
|
33
|
+
const f = n[r] - n[r - 1], u = f > 0 ? (t - n[r - 1]) / f : 0, a = e[r - 1], l = e[r];
|
|
34
34
|
return {
|
|
35
35
|
position: [a[0] + (l[0] - a[0]) * u, a[1] + (l[1] - a[1]) * u],
|
|
36
36
|
angle: Math.atan2(-(l[1] - a[1]), l[0] - a[0]) * 180 / Math.PI
|
|
@@ -54,8 +54,8 @@ function L(e) {
|
|
|
54
54
|
}
|
|
55
55
|
return o;
|
|
56
56
|
}
|
|
57
|
-
function G(e, o, t, n,
|
|
58
|
-
let a =
|
|
57
|
+
function G(e, o, t, n, r, f, u) {
|
|
58
|
+
let a = r;
|
|
59
59
|
const l = [];
|
|
60
60
|
for (let g = 0; g < t.length; g++) {
|
|
61
61
|
const c = w(e, o, a + (n[g] - u) / 2);
|
|
@@ -64,65 +64,73 @@ function G(e, o, t, n, i, f, u) {
|
|
|
64
64
|
}
|
|
65
65
|
return l;
|
|
66
66
|
}
|
|
67
|
-
function S(e, o, t, n,
|
|
68
|
-
const l = w(e, o,
|
|
67
|
+
function S(e, o, t, n, r, f, u, a) {
|
|
68
|
+
const l = w(e, o, r), g = w(e, o, r + f);
|
|
69
69
|
if (!l || !g) return [];
|
|
70
|
-
const c = g.position[0] - l.position[0], s = g.position[1] - l.position[1],
|
|
71
|
-
if (!(
|
|
72
|
-
const
|
|
73
|
-
let
|
|
74
|
-
const
|
|
75
|
-
for (let
|
|
76
|
-
const
|
|
77
|
-
|
|
70
|
+
const c = g.position[0] - l.position[0], s = g.position[1] - l.position[1], p = Math.hypot(c, s);
|
|
71
|
+
if (!(p > 0)) return [];
|
|
72
|
+
const x = Math.atan2(-s, c) * 180 / Math.PI, v = c / p, b = s / p;
|
|
73
|
+
let m = 0;
|
|
74
|
+
const d = [];
|
|
75
|
+
for (let i = 0; i < t.length; i++) {
|
|
76
|
+
const h = m + (n[i] - a) / 2, y = Math.min(h, p), A = [l.position[0] + v * y, l.position[1] + b * y];
|
|
77
|
+
d.push({ position: C(A, x, u), angle: x, char: t[i] }), m += n[i];
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return d;
|
|
80
80
|
}
|
|
81
81
|
function F(e, o, t) {
|
|
82
82
|
if (e.length < 2 || !o) return [];
|
|
83
83
|
const n = k(e);
|
|
84
84
|
if (!(n.total > 0)) return [];
|
|
85
|
-
const
|
|
85
|
+
const r = [...o], f = r.map((i) => j(i, t.fontFamily, t.fontWeight) * t.sizePx + t.letterSpacing), u = f.reduce((i, h) => i + h, 0) - t.letterSpacing;
|
|
86
86
|
if (u > n.total) return [];
|
|
87
|
-
const a = n.total - u, l = Number.isFinite(t.maxAngle) ? Math.max(0, t.maxAngle) : O, g = t.orientation === "chord" ? "chord" : "curve", c = (
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
return F(
|
|
87
|
+
const a = n.total - u, l = Number.isFinite(t.maxAngle) ? Math.max(0, t.maxAngle) : O, g = t.orientation === "chord" ? "chord" : "curve", c = (i) => i === "start" ? 0 : i === "end" ? a : a / 2, s = c(t.placement === "auto" ? "middle" : t.placement), p = w(e, n, s), x = w(e, n, s + u);
|
|
88
|
+
if (p && x && x.position[0] < p.position[0]) {
|
|
89
|
+
const i = [...e].reverse();
|
|
90
|
+
return F(i, o, { ...t, placement: D(t.placement), offsetPx: -t.offsetPx });
|
|
91
91
|
}
|
|
92
|
-
const v = (
|
|
92
|
+
const v = (i) => g === "chord" ? S(e, n, r, f, i, u, t.offsetPx, t.letterSpacing) : G(e, n, r, f, i, t.offsetPx, t.letterSpacing);
|
|
93
93
|
if (t.placement !== "auto") {
|
|
94
|
-
const
|
|
95
|
-
if (g === "curve" && L(
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
94
|
+
const i = v(c(t.placement));
|
|
95
|
+
if (g === "curve" && L(i) > l) {
|
|
96
|
+
const h = S(e, n, r, f, c(t.placement), u, t.offsetPx, t.letterSpacing);
|
|
97
|
+
if (h.length) return h;
|
|
98
98
|
}
|
|
99
|
-
return
|
|
99
|
+
return i;
|
|
100
100
|
}
|
|
101
|
-
let
|
|
102
|
-
const
|
|
103
|
-
for (let
|
|
104
|
-
const
|
|
105
|
-
if (!
|
|
106
|
-
const A = L(
|
|
107
|
-
if (A <
|
|
101
|
+
let b = [], m = 1 / 0;
|
|
102
|
+
const d = a > 0 ? I : 1;
|
|
103
|
+
for (let i = 0; i < d; i++) {
|
|
104
|
+
const h = d === 1 ? 0 : a * i / (d - 1), y = v(h);
|
|
105
|
+
if (!y.length) continue;
|
|
106
|
+
const A = L(y);
|
|
107
|
+
if (A < m && (m = A, b = y, A <= l))
|
|
108
108
|
break;
|
|
109
109
|
}
|
|
110
|
-
if (!
|
|
111
|
-
if (g === "curve" &&
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
110
|
+
if (!b.length) return [];
|
|
111
|
+
if (g === "curve" && m > l) {
|
|
112
|
+
const i = S(e, n, r, f, c("middle"), u, t.offsetPx, t.letterSpacing);
|
|
113
|
+
if (i.length) return i;
|
|
114
114
|
}
|
|
115
|
-
return
|
|
115
|
+
return b;
|
|
116
116
|
}
|
|
117
|
-
function M(e, o, t, n,
|
|
118
|
-
if (typeof e != "function") return e ??
|
|
117
|
+
function M(e, o, t, n, r) {
|
|
118
|
+
if (typeof e != "function") return e ?? r;
|
|
119
119
|
try {
|
|
120
120
|
return e(o, { index: t, data: n });
|
|
121
121
|
} catch {
|
|
122
|
-
return
|
|
122
|
+
return r;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
function U(e) {
|
|
126
|
+
const o = (r) => Array.isArray(r) && Number.isFinite(r[0]) && Number.isFinite(r[1]);
|
|
127
|
+
if (e.every(o)) return e;
|
|
128
|
+
let t = [], n = [];
|
|
129
|
+
for (const r of e)
|
|
130
|
+
o(r) ? n.push(r) : n = [], n.length > t.length && (t = n);
|
|
131
|
+
return t;
|
|
132
|
+
}
|
|
133
|
+
class B extends N {
|
|
126
134
|
static layerName = "OmTextOnPathLayer";
|
|
127
135
|
static defaultProps = {
|
|
128
136
|
getPath: { type: "accessor", value: (o) => o.path },
|
|
@@ -160,33 +168,33 @@ class _ extends E {
|
|
|
160
168
|
renderLayers() {
|
|
161
169
|
const o = this.context.viewport;
|
|
162
170
|
if (!o || !o.width) return null;
|
|
163
|
-
const t = Array.isArray(this.props.data) ? this.props.data : [],
|
|
171
|
+
const t = Array.isArray(this.props.data) ? this.props.data : [], r = ["auto", "start", "middle", "end"].includes(this.props.placement) ? this.props.placement : "auto", f = this.props.orientation === "chord" ? "chord" : "curve", u = Number(this.props.maxAngle), a = this.props.fontFamily ?? "sans-serif", l = this.props.fontWeight ?? "normal", g = this.props.maxLabels ?? 2e3, c = [];
|
|
164
172
|
for (let s = 0; s < t.length && c.length < g; s++) {
|
|
165
|
-
const
|
|
166
|
-
if (!
|
|
167
|
-
const
|
|
168
|
-
for (const
|
|
173
|
+
const p = t[s], x = M(this.props.getPath, p, s, t, void 0), v = Array.isArray(x) ? U(x) : void 0, b = String(M(this.props.getText, p, s, t, "") ?? "");
|
|
174
|
+
if (!v || v.length < 2 || !b) continue;
|
|
175
|
+
const m = Number(M(this.props.getSize, p, s, t, 14)) || 14, d = M(this.props.getColor, p, s, t, [30, 30, 30, 255]), i = v.map((h) => o.project([h[0], h[1]]).slice(0, 2));
|
|
176
|
+
for (const h of F(i, b, {
|
|
169
177
|
fontFamily: a,
|
|
170
178
|
fontWeight: l,
|
|
171
|
-
sizePx:
|
|
179
|
+
sizePx: m,
|
|
172
180
|
letterSpacing: this.props.letterSpacing ?? 0,
|
|
173
181
|
maxAngle: Number.isFinite(u) ? u : void 0,
|
|
174
182
|
orientation: f,
|
|
175
183
|
offsetPx: this.props.offset ?? 0,
|
|
176
|
-
placement:
|
|
184
|
+
placement: r
|
|
177
185
|
})) {
|
|
178
|
-
const
|
|
186
|
+
const y = o.unproject([h.position[0], h.position[1]]);
|
|
179
187
|
if (c.push({
|
|
180
|
-
char:
|
|
181
|
-
position: [
|
|
182
|
-
angle:
|
|
183
|
-
size:
|
|
188
|
+
char: h.char,
|
|
189
|
+
position: [y[0], y[1]],
|
|
190
|
+
angle: h.angle,
|
|
191
|
+
size: m,
|
|
184
192
|
color: Array.isArray(d) ? d : [30, 30, 30, 255],
|
|
185
193
|
row: s
|
|
186
194
|
}), c.length >= g) break;
|
|
187
195
|
}
|
|
188
196
|
}
|
|
189
|
-
return c.length === 0 ? null : new
|
|
197
|
+
return c.length === 0 ? null : new E(
|
|
190
198
|
this.getSubLayerProps({ id: "glyphs" }),
|
|
191
199
|
{
|
|
192
200
|
data: c,
|
|
@@ -208,7 +216,7 @@ class _ extends E {
|
|
|
208
216
|
}
|
|
209
217
|
}
|
|
210
218
|
export {
|
|
211
|
-
|
|
219
|
+
B as OmTextOnPathLayer,
|
|
212
220
|
j as charAdvance,
|
|
213
221
|
L as maxGlyphTurn,
|
|
214
222
|
k as pathMetrics,
|
package/dist/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ur, d as lr, R as zt, e as fr, m as dr, p as St, f as hr, k as pr, l as mr } from "./raster-pipeline-
|
|
2
|
-
import { c as gr } from "./index-
|
|
1
|
+
import { A as ur, d as lr, R as zt, e as fr, m as dr, p as St, f as hr, k as pr, l as mr } from "./raster-pipeline-BODPC9vJ.js";
|
|
2
|
+
import { c as gr } from "./index-IDWDfgTC.js";
|
|
3
3
|
import $t from "./index-CW1n5LdO.js";
|
|
4
4
|
var Et;
|
|
5
5
|
function h(e, t, n) {
|
package/docs/cartograph.md
CHANGED
|
@@ -22,8 +22,8 @@ to PDF at true page size via CSS `@page` and exports PNG/JPEG at print DPI throu
|
|
|
22
22
|
<html>
|
|
23
23
|
<head>
|
|
24
24
|
<meta charset="utf-8">
|
|
25
|
-
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.
|
|
26
|
-
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.
|
|
25
|
+
<script type="module" src="https://unpkg.com/@nika-js/onlymap@0.13.0/dist/cartograph.standalone.js"></script>
|
|
26
|
+
<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.13.0/dist/cartograph.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<om-cartograph cartograph-id="cg-lot-12" format="cartograph/2" size="A4" theme="minimal"
|
package/docs/cartography.md
CHANGED
|
@@ -78,12 +78,68 @@ Each is a validation error with a fix, never a silent no-op:
|
|
|
78
78
|
|
|
79
79
|
| Limit | Why | What to do instead |
|
|
80
80
|
|---|---|---|
|
|
81
|
-
| No MapLibre basemap | it is a second renderer with its own camera | `basemap="none"
|
|
82
|
-
| No
|
|
81
|
+
| No MapLibre basemap — except `positron`, `liberty` and `bright` | it is a second renderer with its own camera | an OpenFreeMap preset (below), or `basemap="none"` plus an image `TileLayer` for a raster basemap |
|
|
82
|
+
| No terrain or 3D tile layers (`TerrainLayer`, `Tile3DLayer`), and no `.pbf` `TileLayer` (use `MVTLayer`) | deck indexes their tiles from a Mercator viewport | image tiles, `HillshadeLayer` and `MVTLayer` are taught the plane (below) |
|
|
83
83
|
| No `terrain` | the 3D surface and its tiles are Mercator throughout | drop it, or use Mercator |
|
|
84
|
+
| No clip box (`clip-box-min`/`clip-box-max`) | its corners are placed with Mercator arithmetic, so on a plane it cuts every layer away | drop it, or use Mercator |
|
|
84
85
|
| No `pitch` / `bearing` | the projected view is planimetric | a print sheet is planimetric; rotate the frame in the layout |
|
|
85
86
|
| No H3 / S2 / geohash / quadkey layers | deck builds their geometry from a token, inside the layer | convert the cells to polygons and use a `GeoJsonLayer` |
|
|
86
|
-
|
|
87
|
+
|
|
88
|
+
**Most national grids are drawn by the GPU.** Transverse Mercator (British
|
|
89
|
+
National Grid, NZTM, SVY21, every UTM zone), Albers (CONUS, Australia), Lambert
|
|
90
|
+
Conformal Conic (Lambert-93) and Lambert Azimuthal Equal Area (LAEA Europe) are
|
|
91
|
+
projected per vertex in the shader: the layers keep their longitude/latitude,
|
|
92
|
+
and placement agrees with proj4js to a quarter of a pixel at any zoom. Other projections — the Swiss
|
|
93
|
+
and Dutch oblique grids, for instance — draw on the CPU as before, as do the few
|
|
94
|
+
layer types that bin points themselves (`HexagonLayer`, `GridLayer`,
|
|
95
|
+
`ContourLayer`, `GreatCircleLayer`).
|
|
96
|
+
`OmMap.configureCrs({ gpuProjection: false })` puts every projected map on the
|
|
97
|
+
CPU path; set it before maps mount.
|
|
98
|
+
|
|
99
|
+
**A geographic CRS as the sheet.** `crs="EPSG:4326"` (or any geographic system: NAD83,
|
|
100
|
+
ETRS89, a `+proj=longlat` definition) draws as plate carrée — one scale in degrees on both
|
|
101
|
+
axes, so a degree of longitude is drawn 1/cos(latitude) times its ground width. That is how a
|
|
102
|
+
desktop GIS draws an unprojected layout, and a cartograph copying a QGIS or ArcGIS sheet in
|
|
103
|
+
EPSG:4326 needs exactly that (0.0014 mm off the layout's corners at 60°N, where Web Mercator
|
|
104
|
+
was 57 mm off). The validator says so as a warning, with the stretch at your `center`; for a
|
|
105
|
+
map meant to be read at scale, use a projected CRS.
|
|
106
|
+
|
|
107
|
+
**Across the seam.** A conic is a cone cut open along the meridian opposite its central
|
|
108
|
+
one, and a Transverse Mercator wraps there too. A polygon or line that crosses that meridian
|
|
109
|
+
(Russia on a CONUS map) is cut there before drawing, so it never reaches across the sheet;
|
|
110
|
+
each piece keeps the feature's properties, so picks and popups are unchanged. The same holds
|
|
111
|
+
for a polygon or path read from flat rows (`get-polygon="$polygon"` on a CSV): a row that
|
|
112
|
+
crosses becomes one row per piece, each carrying every field of the original.
|
|
113
|
+
|
|
114
|
+
**Vector tiles on any grid.** `MVTLayer` works on every projected map. Each tile
|
|
115
|
+
is cut to its own edge, projected into the plane once and triangulated in a
|
|
116
|
+
background worker, then drawn as plain plane coordinates — so panning a
|
|
117
|
+
vector-tile layer costs what it does in Web Mercator, and a tile never blocks
|
|
118
|
+
the page while it arrives. A live `crs` switch rebuilds the cached tiles for the
|
|
119
|
+
new projection without fetching them again.
|
|
120
|
+
|
|
121
|
+
**A vector basemap.** `basemap="positron"`, `"liberty"` or `"bright"`
|
|
122
|
+
on a projected map renders OpenFreeMap's vector tiles — the same
|
|
123
|
+
tiles those presets use in Web Mercator — in the plane, in each preset's own
|
|
124
|
+
colours: land, water, land cover, parks, buildings, roads, rail and national and
|
|
125
|
+
regional boundaries. No labels yet: text on a projected map would need live
|
|
126
|
+
decluttering. The map credits OpenFreeMap, OpenMapTiles and OpenStreetMap itself,
|
|
127
|
+
as it does for any basemap it picks. Switching `basemap` recolours it in place;
|
|
128
|
+
switching `crs` keeps it, and dropping `crs` hands the preset back to MapLibre in
|
|
129
|
+
Web Mercator.
|
|
130
|
+
|
|
131
|
+
**`crs` is live.** Change it on a mounted map — the attribute, the `set-crs` action
|
|
132
|
+
(`{ crs: "EPSG:27700" }`, or `{ crs: "mercator" }` for Web Mercator), `MapController.setCrs`,
|
|
133
|
+
or React's `crs` prop — and every layer re-projects in place: no refetch, no reparse, no
|
|
134
|
+
remount, and the camera stays where it was. A story step can switch the sheet's
|
|
135
|
+
projection, and undo restores it. A CRS that cannot resolve is reported and the map
|
|
136
|
+
stays as it was. Between two grids the GPU draws (above), a switch re-projects
|
|
137
|
+
nothing: no layer is rebuilt, and tiled layers keep the tiles they have — only
|
|
138
|
+
polygon fills are triangulated again, in the new plane, so their triangles tile
|
|
139
|
+
the shape the shader will draw. Onto any
|
|
140
|
+
other projection the layers are re-projected on the CPU — about a quarter of a
|
|
141
|
+
second for a million line vertices on a real GPU; in a browser with no GPU, which
|
|
142
|
+
emulates the drawing too, about 2 s for 100 000 and 18 s for a million.
|
|
87
143
|
|
|
88
144
|
**Relief works.** Both routes: `shading="hillshade"` on a DEM of your own has no
|
|
89
145
|
projection tie at all, and the global keyless `HillshadeLayer` re-indexes its
|
package/docs/testing.md
CHANGED
|
@@ -40,7 +40,8 @@ npm i -D vitest happy-dom @playwright/test
|
|
|
40
40
|
// package.json
|
|
41
41
|
"scripts": {
|
|
42
42
|
"test": "vitest run", // tiers 1–2: every commit
|
|
43
|
-
"test:e2e": "playwright test" // tier 3: PR / nightly
|
|
43
|
+
"test:e2e": "playwright test", // tier 3: PR / nightly
|
|
44
|
+
"test:e2e:release": "playwright test --grep-invert @slow" // tier 3 minus tests titled "… @slow"
|
|
44
45
|
}
|
|
45
46
|
```
|
|
46
47
|
|