@nika-js/onlymap 0.12.1 → 0.13.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/CHANGELOG.md +29 -0
- package/README.md +1 -1
- package/dist/{basemap-BK25o5OE.js → basemap-zG1-omic.js} +473 -443
- package/dist/basemap.d.ts +16 -3
- package/dist/build-Bbi4SleC.js +208 -0
- package/dist/cartograph.js +43 -41
- package/dist/cartograph.standalone.js +3 -1
- package/dist/client-CIH6ToMI.js +6878 -0
- package/dist/{geoparquet-CLydPm2f.js → geoparquet-CyWsYt9S.js} +1 -1
- package/dist/{globe-view-ChuX60M5.js → globe-view-Xelgj_KW.js} +6 -6
- package/dist/{hillshade-DD8WFrvf.js → hillshade-Zbg50lm6.js} +79 -67
- package/dist/hillshade.d.ts +7 -0
- package/dist/html-data.d.ts +1 -1
- package/dist/{index-CgVFHEdM.js → index-6eeSlSqN.js} +3 -3
- package/dist/{index-CMKrghNb.js → index-BL_YCKiW.js} +54 -54
- package/dist/{index-C2CKUsom.js → index-BbVnkgld.js} +38 -38
- package/dist/{index-CvrH6mbS.js → index-BtRsa5oc.js} +3 -3
- package/dist/{index-DIzzRLKr.js → index-BwtXeP_F.js} +1 -1
- package/dist/{index-Dvwr1Y3o.js → index-ClAPAqcm.js} +49 -49
- package/dist/{index-Bs69fn8a.js → index-CpFNIkOO.js} +33429 -30673
- package/dist/{index-CdAf0bLj.js → index-DnCmvLuC.js} +42 -42
- package/dist/index-JFuN4DCn.js +4449 -0
- package/dist/layer-registry.d.ts +1 -0
- package/dist/{lerc-mAijS40k.js → lerc-C3SKC6CU.js} +1 -1
- package/dist/onlymap.standalone.js +60762 -51701
- 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-rwFDi8di.js → post-process-effect-C3P9VwC9.js} +11 -11
- package/dist/programmatic.d.ts +6 -0
- package/dist/projection.d.ts +51 -0
- package/dist/{raster-CXIqf83L.js → raster-BgCnz9-Z.js} +3 -3
- package/dist/{raster-pipeline-CfSg2Re7.js → raster-pipeline-CKdpKgFo.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-B08PekFz.js → text-on-path-BpVLX8Yt.js} +74 -66
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-CUn2udOc.js → zarr-Cur_pzNa.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-BHRpKnGi.js +0 -4883
package/dist/basemap.d.ts
CHANGED
|
@@ -156,15 +156,28 @@ export declare class MapLibreBasemapAdapter {
|
|
|
156
156
|
*/
|
|
157
157
|
setStyle(resolved: ResolvedBasemap): void;
|
|
158
158
|
/**
|
|
159
|
-
* This basemap's attribution as plain text: every source's
|
|
160
|
-
*
|
|
159
|
+
* This basemap's attribution as plain text: every source's attribution plus
|
|
160
|
+
* the preset's own line, de-duplicated.
|
|
161
161
|
*
|
|
162
162
|
* Every source the style DECLARES, not only the ones currently drawn — the
|
|
163
163
|
* superset MapLibre's control narrows to. On a printed sheet an extra credit
|
|
164
164
|
* costs nothing; a missing one is a licence breach.
|
|
165
|
+
*
|
|
166
|
+
* A source's credit is read from the LOADED source first. The keyless
|
|
167
|
+
* presets — CARTO's dark-matter, positron and voyager, OpenFreeMap's liberty
|
|
168
|
+
* and bright — declare each vector source as `{ type, url }`, and the credit
|
|
169
|
+
* lives in the TileJSON behind that url, which `getStyle()` never reports
|
|
170
|
+
* (MapLibre serialises the declared options). Reading the style alone
|
|
171
|
+
* returned nothing for every one of them, and a sheet printed no credit.
|
|
165
172
|
*/
|
|
166
173
|
attributions(): string[];
|
|
167
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* Called when a (new) style has loaded, and again whenever a source's
|
|
176
|
+
* metadata arrives with a credit the list did not have — the TileJSON of a
|
|
177
|
+
* `{ type, url }` source loads AFTER `style.load`, which is the only event
|
|
178
|
+
* MapLibre's own control does not wait on either (it re-reads on
|
|
179
|
+
* `sourcedata` metadata).
|
|
180
|
+
*/
|
|
168
181
|
onAttributionsChange(callback: () => void): void;
|
|
169
182
|
/**
|
|
170
183
|
* (Re)mounts the compact attribution control. Source-declared attributions
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { ah as j, ai as T, aj as B, ak as E, al as q } from "./index-CpFNIkOO.js";
|
|
2
|
+
const N = (l) => Number.isFinite(l[0]) && Number.isFinite(l[1]);
|
|
3
|
+
function O(l, t, s) {
|
|
4
|
+
const o = T(s.x, s.y, s.z), i = 8, n = [];
|
|
5
|
+
let p = !0;
|
|
6
|
+
for (let e = 0; e <= i; e++) {
|
|
7
|
+
const r = [];
|
|
8
|
+
for (let F = 0; F <= i; F++) {
|
|
9
|
+
const I = o.west + (o.east - o.west) * e / i, M = o.south + (o.north - o.south) * F / i, S = l(I, M);
|
|
10
|
+
(!N(S) || t && !U(I, M, S, t)) && (p = !1), r.push(S);
|
|
11
|
+
}
|
|
12
|
+
n.push(r);
|
|
13
|
+
}
|
|
14
|
+
const u = [];
|
|
15
|
+
for (let e = 0; e <= i; e++)
|
|
16
|
+
for (let r = 0; r <= i; r++)
|
|
17
|
+
e < i && u.push(Math.hypot(n[e + 1][r][0] - n[e][r][0], n[e + 1][r][1] - n[e][r][1])), r < i && u.push(Math.hypot(n[e][r + 1][0] - n[e][r][0], n[e][r + 1][1] - n[e][r][1]));
|
|
18
|
+
const a = u.filter(Number.isFinite).sort((e, r) => e - r), g = a[a.length >> 1] ?? 0, d = a.length < u.length || a[a.length - 1] > 20 * g, c = p || !t ? l : (e, r) => {
|
|
19
|
+
const F = l(e, r);
|
|
20
|
+
return N(F) && U(e, r, F, t) ? F : [NaN, NaN];
|
|
21
|
+
};
|
|
22
|
+
return { project: c, tears: d ? (e, r, F, I) => V(e, r, F, I, c) : null };
|
|
23
|
+
}
|
|
24
|
+
function U(l, t, s, o) {
|
|
25
|
+
try {
|
|
26
|
+
return q(l, t, o(s[0], s[1]));
|
|
27
|
+
} catch {
|
|
28
|
+
return !1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function V(l, t, s, o, i) {
|
|
32
|
+
const n = Math.hypot(o[0] - s[0], o[1] - s[1]);
|
|
33
|
+
if (!(n > 0)) return !1;
|
|
34
|
+
let p = s;
|
|
35
|
+
for (let u = 1; u <= 4; u++) {
|
|
36
|
+
const a = u === 4 ? o : i(l[0] + (t[0] - l[0]) * u / 4, l[1] + (t[1] - l[1]) * u / 4);
|
|
37
|
+
if (!N(a) || Math.hypot(a[0] - p[0], a[1] - p[1]) > 0.75 * n) return !0;
|
|
38
|
+
p = a;
|
|
39
|
+
}
|
|
40
|
+
return !1;
|
|
41
|
+
}
|
|
42
|
+
function H(l, t, s, o, i) {
|
|
43
|
+
const { project: n, tears: p } = O(o, i, t), u = j.parseSync(l, {
|
|
44
|
+
// Called directly, the parser does not merge the loader's defaults: name
|
|
45
|
+
// the layer property, which a basemap selects and styles by.
|
|
46
|
+
mvt: { shape: "geojson", coordinates: "wgs84", tileIndex: t, layerProperty: "layerName", ...s.layers ? { layers: s.layers } : null }
|
|
47
|
+
}) ?? [], a = T(t.x, t.y, t.z), g = B(a, n), d = s.cut !== !1, c = s.classify, e = new Y(), r = new Y(), F = new Y(), I = new Y(), M = [], S = [], k = [];
|
|
48
|
+
u.forEach((f, h) => {
|
|
49
|
+
const w = f.properties ?? {};
|
|
50
|
+
M[h] = w;
|
|
51
|
+
const y = f.geometry?.type;
|
|
52
|
+
if (y === "Polygon" || y === "MultiPolygon") {
|
|
53
|
+
const m = c ? c.fillRank[String(w.layerName)] : 0;
|
|
54
|
+
if (m !== void 0 && S.push({ id: h, f, rank: m, casing: !1 }), s.outlines && !c) for (const v of R(f)) for (const P of v) C(F, h, w, P);
|
|
55
|
+
} else if (y === "LineString" || y === "MultiLineString") {
|
|
56
|
+
const m = c ? _(c.lineRules, w) : void 0;
|
|
57
|
+
(!c || m) && k.push({ id: h, f, rank: m?.rank ?? 0, casing: !!m?.casing });
|
|
58
|
+
} else if ((y === "Point" || y === "MultiPoint") && !c) {
|
|
59
|
+
const m = y === "Point" ? [f.geometry.coordinates] : f.geometry.coordinates;
|
|
60
|
+
for (const v of m) {
|
|
61
|
+
if (d && !g.contains(v)) continue;
|
|
62
|
+
const P = n(v[0], v[1]);
|
|
63
|
+
Number.isFinite(P[0]) && Number.isFinite(P[1]) && r.addPoint(h, w, P);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const L = (f, h) => f.rank - h.rank;
|
|
68
|
+
c && (S.sort(L), k.sort(L));
|
|
69
|
+
for (const { id: f, f: h } of S)
|
|
70
|
+
for (const w of R(h)) {
|
|
71
|
+
const y = d ? g.polygon(w) : w;
|
|
72
|
+
y && D(e, f, h.properties ?? {}, y, n, p);
|
|
73
|
+
}
|
|
74
|
+
for (const { id: f, f: h, casing: w } of k) {
|
|
75
|
+
const y = h.geometry.type === "LineString" ? [h.geometry.coordinates] : h.geometry.coordinates;
|
|
76
|
+
for (const m of y)
|
|
77
|
+
C(r, f, h.properties ?? {}, m), w && C(I, f, h.properties ?? {}, m);
|
|
78
|
+
}
|
|
79
|
+
return { fills: e.finish(), lines: r.finish(), outlines: F.finish(), casings: I.finish(), properties: M };
|
|
80
|
+
function C(f, h, w, y) {
|
|
81
|
+
const m = d ? g.line(y) : [{ points: y, startCut: !1, endCut: !1 }];
|
|
82
|
+
for (const v of m) {
|
|
83
|
+
let P = [], z = v.startCut;
|
|
84
|
+
const A = (b) => {
|
|
85
|
+
P.length >= 2 && f.addPath(h, w, P, z, b), P = [];
|
|
86
|
+
};
|
|
87
|
+
let X = null;
|
|
88
|
+
for (const b of v.points) {
|
|
89
|
+
const x = n(b[0], b[1]);
|
|
90
|
+
if (!N(x)) {
|
|
91
|
+
A(!0), z = !0, X = null;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
p && X && P.length && p(X, b, P[P.length - 1], x) && (A(!0), z = !0), P.push(x), X = b;
|
|
95
|
+
}
|
|
96
|
+
A(v.endCut);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function R(l) {
|
|
101
|
+
return l.geometry.type === "Polygon" ? [l.geometry.coordinates] : l.geometry.coordinates;
|
|
102
|
+
}
|
|
103
|
+
function _(l, t) {
|
|
104
|
+
return l.find(
|
|
105
|
+
(s) => s.layer === t.layerName && (!s.classes || s.classes.includes(String(t.class))) && (!s.notMaritime || !t.maritime) && (s.adminLevelMax === void 0 || Number(t.admin_level ?? 99) <= s.adminLevelMax)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
function D(l, t, s, o, i, n) {
|
|
109
|
+
const p = [];
|
|
110
|
+
for (const [u, a] of o.entries()) {
|
|
111
|
+
const g = [];
|
|
112
|
+
for (const [d, c] of a.entries()) {
|
|
113
|
+
const e = i(c[0], c[1]);
|
|
114
|
+
if (!N(e)) break;
|
|
115
|
+
if (n && d > 0 && n(a[d - 1], c, g[d - 1], e)) return;
|
|
116
|
+
g.push(e);
|
|
117
|
+
}
|
|
118
|
+
if (g.length === a.length && g.length >= 4) p.push(g);
|
|
119
|
+
else if (u === 0) return;
|
|
120
|
+
}
|
|
121
|
+
p.length && l.addPolygon(t, s, p);
|
|
122
|
+
}
|
|
123
|
+
class Y {
|
|
124
|
+
pointXY = [];
|
|
125
|
+
pointIds = [];
|
|
126
|
+
pointProps = [];
|
|
127
|
+
pointFeature = [];
|
|
128
|
+
lineXY = [];
|
|
129
|
+
lineIds = [];
|
|
130
|
+
lineFeature = [];
|
|
131
|
+
lineCut = [];
|
|
132
|
+
pathStarts = [0];
|
|
133
|
+
lineProps = [];
|
|
134
|
+
polyXY = [];
|
|
135
|
+
polyIds = [];
|
|
136
|
+
polyFeature = [];
|
|
137
|
+
polygonStarts = [0];
|
|
138
|
+
ringStarts = [0];
|
|
139
|
+
triangles = [];
|
|
140
|
+
polyProps = [];
|
|
141
|
+
/** Properties are indexed per geometry type; a feature's index is reused across its pieces. */
|
|
142
|
+
propIndex = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
|
|
143
|
+
propsFor(t, s, o, i) {
|
|
144
|
+
let n = this.propIndex[t].get(s);
|
|
145
|
+
return n === void 0 && (n = i.length, i.push(o), this.propIndex[t].set(s, n)), n;
|
|
146
|
+
}
|
|
147
|
+
addPoint(t, s, o) {
|
|
148
|
+
const i = this.propsFor(0, t, s, this.pointProps);
|
|
149
|
+
this.pointXY.push(o[0], o[1]), this.pointIds.push(t), this.pointFeature.push(i);
|
|
150
|
+
}
|
|
151
|
+
addPath(t, s, o, i, n) {
|
|
152
|
+
const p = this.propsFor(1, t, s, this.lineProps), u = (i ? 1 : 0) + (n ? 2 : 0);
|
|
153
|
+
for (const a of o)
|
|
154
|
+
this.lineXY.push(a[0], a[1]), this.lineIds.push(t), this.lineFeature.push(p), this.lineCut.push(u);
|
|
155
|
+
this.pathStarts.push(this.lineXY.length / 2);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* A polygon, triangulated in the PLANE: its fill then follows its projected
|
|
159
|
+
* outline. Triangulated in lng/lat instead, a triangle's straight edges in
|
|
160
|
+
* the plane are chords of curves — thousands of kilometres off where the
|
|
161
|
+
* projection is far from linear (an ocean fill 80° from BNG's meridian
|
|
162
|
+
* covered Canada). The slivers that triangulating in the plane makes along a
|
|
163
|
+
* nearly straight tile edge are avoided where they are made: the cutter
|
|
164
|
+
* leaves such an edge its ends alone (tile-cut.ts, `bowedEdges`).
|
|
165
|
+
*/
|
|
166
|
+
addPolygon(t, s, o) {
|
|
167
|
+
const i = this.propsFor(2, t, s, this.polyProps), n = this.polyXY.length / 2, p = [], u = [], [a, g] = o[0][0];
|
|
168
|
+
for (const [d, c] of o.entries()) {
|
|
169
|
+
d > 0 && u.push(p.length / 2);
|
|
170
|
+
for (const e of c)
|
|
171
|
+
this.polyXY.push(e[0], e[1]), p.push(e[0] - a, e[1] - g), this.polyIds.push(t), this.polyFeature.push(i);
|
|
172
|
+
this.ringStarts.push(this.polyXY.length / 2);
|
|
173
|
+
}
|
|
174
|
+
for (const d of E(p, u, 2)) this.triangles.push(n + d);
|
|
175
|
+
this.polygonStarts.push(this.polyXY.length / 2);
|
|
176
|
+
}
|
|
177
|
+
finish() {
|
|
178
|
+
const t = (s, o, i, n) => ({
|
|
179
|
+
positions: { value: new Float64Array(s), size: 2 },
|
|
180
|
+
globalFeatureIds: { value: new Uint32Array(o), size: 1 },
|
|
181
|
+
featureIds: { value: new Uint32Array(i), size: 1 },
|
|
182
|
+
numericProps: {},
|
|
183
|
+
properties: n,
|
|
184
|
+
fields: []
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
shape: "binary-feature-collection",
|
|
188
|
+
points: { type: "Point", ...t(this.pointXY, this.pointIds, this.pointFeature, this.pointProps) },
|
|
189
|
+
lines: {
|
|
190
|
+
type: "LineString",
|
|
191
|
+
...t(this.lineXY, this.lineIds, this.lineFeature, this.lineProps),
|
|
192
|
+
pathIndices: { value: new Uint32Array(this.pathStarts), size: 1 },
|
|
193
|
+
attributes: { getCutEnds: { value: new Float32Array(this.lineCut), size: 1 } }
|
|
194
|
+
},
|
|
195
|
+
polygons: {
|
|
196
|
+
type: "Polygon",
|
|
197
|
+
...t(this.polyXY, this.polyIds, this.polyFeature, this.polyProps),
|
|
198
|
+
polygonIndices: { value: new Uint32Array(this.polygonStarts), size: 1 },
|
|
199
|
+
primitivePolygonIndices: { value: new Uint32Array(this.ringStarts), size: 1 },
|
|
200
|
+
triangles: { value: new Uint32Array(this.triangles), size: 1 }
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export {
|
|
206
|
+
H as buildPlaneTile,
|
|
207
|
+
O as tileProjection
|
|
208
|
+
};
|
package/dist/cartograph.js
CHANGED
|
@@ -240,11 +240,11 @@ async function Nr(r) {
|
|
|
240
240
|
})
|
|
241
241
|
), t;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function ze(r) {
|
|
244
244
|
return !r.hasAttribute("hidden") && !r.hasAttribute("data-om-carto-screen-only") && !r.hasAttribute("data-om-carto-marks") && !r.hasAttribute("data-om-carto-flattened") && r.tagName.toLowerCase() !== "style" && r.tagName.toLowerCase() !== "script";
|
|
245
245
|
}
|
|
246
246
|
function Pr(r) {
|
|
247
|
-
return [...r.children].filter(
|
|
247
|
+
return [...r.children].filter(ze).map((t, e) => ({ el: t, index: e, z: S(t).z ?? 0 })).sort((t, e) => t.z - e.z || t.index - e.index).map((t) => t.el);
|
|
248
248
|
}
|
|
249
249
|
async function Wt(r, t = {}) {
|
|
250
250
|
const e = r ?? document.querySelector("om-cartograph");
|
|
@@ -302,7 +302,7 @@ async function Wt(r, t = {}) {
|
|
|
302
302
|
if (!N) throw new Error("[onlymapjs/cartograph] renderCartograph: the canvas produced no image (it may have exceeded a browser limit).");
|
|
303
303
|
return { blob: N, widthPx: b, heightPx: w, dpi: d, warnings: n };
|
|
304
304
|
}
|
|
305
|
-
async function
|
|
305
|
+
async function je(r, t = {}) {
|
|
306
306
|
const e = r ?? document.querySelector("om-cartograph");
|
|
307
307
|
if (!e) throw new Error("[onlymapjs/cartograph] renderCartographAtlas: no <om-cartograph> to render.");
|
|
308
308
|
const n = e.querySelector("om-atlas") ?? null;
|
|
@@ -343,9 +343,9 @@ const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
343
343
|
__proto__: null,
|
|
344
344
|
MAX_CANVAS_AREA: De,
|
|
345
345
|
MAX_CANVAS_DIMENSION: Ue,
|
|
346
|
-
paintsInExport:
|
|
346
|
+
paintsInExport: ze,
|
|
347
347
|
renderCartograph: Wt,
|
|
348
|
-
renderCartographAtlas:
|
|
348
|
+
renderCartographAtlas: je
|
|
349
349
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
350
350
|
function re(r, t, e = {}) {
|
|
351
351
|
const n = URL.createObjectURL(r), i = document.createElement("a");
|
|
@@ -390,7 +390,7 @@ async function Rr(r, t = {}) {
|
|
|
390
390
|
const d = Number(c);
|
|
391
391
|
if (!Number.isInteger(d) || d < 1) throw new Error(`?page=${c} is not a page number (they start at 1).`);
|
|
392
392
|
h.refresh?.();
|
|
393
|
-
const m = await
|
|
393
|
+
const m = await je(r, { dpi: a, format: o, page: d - 1 });
|
|
394
394
|
for (const f of m.warnings) console.warn(`[onlymapjs/cartograph] ${f}`);
|
|
395
395
|
return re(m.blob, m.filenames[0] ?? `${l}.${o === "jpeg" ? "jpg" : "png"}`, { revokeAfterMs: 1e4 }), "export";
|
|
396
396
|
}
|
|
@@ -494,21 +494,21 @@ class O extends qe {
|
|
|
494
494
|
}
|
|
495
495
|
const bt = "cartograph/2", Ii = ["default", "dark", "sepia", "blueprint", "minimal"], se = ["A0", "A1", "A2", "A3", "A4", "A5", "Letter", "Legal"], Ur = /* @__PURE__ */ new Map([
|
|
496
496
|
["projection", "live frames render Web Mercator (EPSG:3857) only — Globe support is design-only; use a static frame for other projections"]
|
|
497
|
-
]),
|
|
497
|
+
]), z = ["id", "x", "y", "w", "h", "rotation", "z", "locked", "hidden"], T = {
|
|
498
498
|
"om-cartograph": ["cartograph-id", "format", "size", "width", "height", "orientation", "theme", "bg", "color", "font", "title", "attribution", "notes", "cvd", "bleed", "crop-marks", "safe-zone", "dpi", "flatten", "color-profile", "allow-url-actions", "keep-badge"],
|
|
499
|
-
"om-frame": [...
|
|
500
|
-
"om-legend": [...
|
|
499
|
+
"om-frame": [...z, "src", "mode", "center", "zoom", "bearing", "pitch", "dpi", "crs", "corners", "crs-def", "overview-of", "overview-stroke", "atlas-fit", "atlas-margin", "frame-stroke", "frame-bg", "attribution"],
|
|
500
|
+
"om-legend": [...z, "for", "title", "columns", "derived", "bg", "color", "stroke", "font-size", "padding"],
|
|
501
501
|
"om-legend-row": ["layer", "match", "label", "hide", "order", "color", "shape"],
|
|
502
502
|
// NOTE: the discriminator on furniture is `kind`, never `style` — `style` is
|
|
503
503
|
// the global HTML attribute the runtime itself writes for mm placement, so
|
|
504
504
|
// `style="double"` would be erased on the first render. `kind` also matches
|
|
505
505
|
// om-text/om-shape, so the whole vocabulary has ONE discriminator word.
|
|
506
|
-
"om-scalebar": [...
|
|
507
|
-
"om-north": [...
|
|
508
|
-
"om-graticule": [...
|
|
509
|
-
"om-text": [...
|
|
510
|
-
"om-shape": [...
|
|
511
|
-
"om-image": [...
|
|
506
|
+
"om-scalebar": [...z, "for", "units", "segments", "segment-length", "kind", "color"],
|
|
507
|
+
"om-north": [...z, "for", "kind", "color"],
|
|
508
|
+
"om-graticule": [...z, "for", "crs", "crs-def", "interval", "interval-x", "interval-y", "kind", "labels", "format", "color"],
|
|
509
|
+
"om-text": [...z, "kind", "font-size", "weight", "align", "font", "color", "bg"],
|
|
510
|
+
"om-shape": [...z, "kind", "fill", "fill-opacity", "stroke", "stroke-width", "radius"],
|
|
511
|
+
"om-image": [...z, "src", "fit"],
|
|
512
512
|
// NOT placed: a source is a child of <om-frame> that says where the frame's
|
|
513
513
|
// picture may come from. Its corners/crs describe THAT source — a capture
|
|
514
514
|
// carries the georeference that was true when it was taken, which is the
|
|
@@ -516,7 +516,7 @@ const bt = "cartograph/2", Ii = ["default", "dark", "sepia", "blueprint", "minim
|
|
|
516
516
|
// CRS is therefore unknowable.
|
|
517
517
|
"om-source": ["src", "corners", "crs", "crs-def", "attribution"],
|
|
518
518
|
"om-atlas": ["id", "for", "layer", "filter", "sort", "filename", "page-name", "pager"]
|
|
519
|
-
}, yt = Object.keys(T), Lt = "data-om-carto-vector", Dr = ["metric", "imperial", "nautical"],
|
|
519
|
+
}, yt = Object.keys(T), Lt = "data-om-carto-vector", Dr = ["metric", "imperial", "nautical"], zr = 0.3048, jr = 1609.344, Gr = 1852;
|
|
520
520
|
function qr(r) {
|
|
521
521
|
return r != null && Dr.includes(r) ? r : null;
|
|
522
522
|
}
|
|
@@ -532,8 +532,8 @@ const oe = {
|
|
|
532
532
|
{ metersPerUnit: 1e3, label: "km" }
|
|
533
533
|
],
|
|
534
534
|
imperial: [
|
|
535
|
-
{ metersPerUnit:
|
|
536
|
-
{ metersPerUnit:
|
|
535
|
+
{ metersPerUnit: zr, label: "ft" },
|
|
536
|
+
{ metersPerUnit: jr, label: "mi" }
|
|
537
537
|
],
|
|
538
538
|
nautical: [{ metersPerUnit: Gr, label: "nmi" }]
|
|
539
539
|
};
|
|
@@ -1156,7 +1156,9 @@ async function bn(r, t) {
|
|
|
1156
1156
|
units: o,
|
|
1157
1157
|
metresPerUnit: a,
|
|
1158
1158
|
forward: (l) => i.inverse(l),
|
|
1159
|
-
inverse: (l) => i.forward(l)
|
|
1159
|
+
inverse: (l) => i.forward(l),
|
|
1160
|
+
...typeof t == "string" && /^\s*\+proj=/.test(t) ? { definition: t.trim() } : null,
|
|
1161
|
+
proj4Source: t
|
|
1160
1162
|
};
|
|
1161
1163
|
}
|
|
1162
1164
|
const be = Math.PI / 180, yn = 180 / Math.PI, wn = { code: "EPSG:3857", forward: Kt, inverse: pt }, Oi = Kt, _i = pt, ye = 6378137, we = 89.9;
|
|
@@ -1387,7 +1389,7 @@ function mt(r) {
|
|
|
1387
1389
|
pitch: Number(r.getAttribute("pitch")) || 0
|
|
1388
1390
|
};
|
|
1389
1391
|
}
|
|
1390
|
-
function
|
|
1392
|
+
function zi(r, t, e, n, i = 60) {
|
|
1391
1393
|
const s = (l) => _t(r, { ...t, pitch: l }, e, n) !== null;
|
|
1392
1394
|
if (s(i)) return i;
|
|
1393
1395
|
if (!s(0)) return 0;
|
|
@@ -2240,12 +2242,12 @@ class ar extends O {
|
|
|
2240
2242
|
}
|
|
2241
2243
|
}
|
|
2242
2244
|
x("om-shape", ar);
|
|
2243
|
-
const xe = "data-om-carto-owned",
|
|
2245
|
+
const xe = "data-om-carto-owned", zn = ["contain", "cover", "fill"];
|
|
2244
2246
|
class lr extends O {
|
|
2245
2247
|
static observedAttributes = [...T["om-image"]];
|
|
2246
2248
|
get fit() {
|
|
2247
2249
|
const t = this.getAttribute("fit");
|
|
2248
|
-
return
|
|
2250
|
+
return zn.includes(t ?? "") ? t : "contain";
|
|
2249
2251
|
}
|
|
2250
2252
|
get image() {
|
|
2251
2253
|
return this.querySelector(":scope > img");
|
|
@@ -2271,11 +2273,11 @@ class lr extends O {
|
|
|
2271
2273
|
}
|
|
2272
2274
|
}
|
|
2273
2275
|
x("om-image", lr);
|
|
2274
|
-
const
|
|
2276
|
+
const jn = /* @__PURE__ */ new Set(["PathLayer", "LineLayer", "ArcLayer", "TripsLayer", "GreatCircleLayer", "PathStyleLayer"]), Gn = /* @__PURE__ */ new Set(["ScatterplotLayer", "IconLayer", "TextLayer", "PointCloudLayer", "HeatmapLayer", "ScreenGridLayer"]), qn = /* @__PURE__ */ new Set(["COGLayer", "ZarrLayer", "BitmapLayer", "TerrainLayer", "ImageOverlay"]);
|
|
2275
2277
|
function Wn(r) {
|
|
2276
2278
|
const t = r.type ?? "";
|
|
2277
2279
|
if (qn.has(t)) return "ramp";
|
|
2278
|
-
if (
|
|
2280
|
+
if (jn.has(t)) return "line";
|
|
2279
2281
|
if (Gn.has(t)) return "point";
|
|
2280
2282
|
if (t === "GeoJsonLayer") {
|
|
2281
2283
|
const e = r.props ?? {}, n = e.getFillColor !== void 0, i = e.getLineColor !== void 0;
|
|
@@ -2552,7 +2554,7 @@ function Qn(r, t) {
|
|
|
2552
2554
|
const e = t === "x" ? r < 0 ? "W" : "E" : r < 0 ? "S" : "N", n = Math.abs(r), i = Math.floor(n), s = (n - i) * 60, o = Math.floor(s), a = Math.round((s - o) * 60), l = a === 60 ? o + 1 : o, c = l === 60 ? i + 1 : i, u = l === 60 ? 0 : l, h = a === 60 ? 0 : a;
|
|
2553
2555
|
return `${c}°${String(u).padStart(2, "0")}′${String(h).padStart(2, "0")}″${e}`;
|
|
2554
2556
|
}
|
|
2555
|
-
const ut = "http://www.w3.org/2000/svg", ti = ["solid", "cross", "markers"],
|
|
2557
|
+
const ut = "http://www.w3.org/2000/svg", ti = ["solid", "cross", "markers"], j = 1.4;
|
|
2556
2558
|
class hr extends O {
|
|
2557
2559
|
static observedAttributes = [...T["om-graticule"]];
|
|
2558
2560
|
resolvedPlane = null;
|
|
@@ -2631,7 +2633,7 @@ class hr extends O {
|
|
|
2631
2633
|
} else
|
|
2632
2634
|
for (const c of this.tickPoints(l, a, t)) {
|
|
2633
2635
|
const u = i.createElementNS(ut, "path");
|
|
2634
|
-
u.setAttribute("d", `M ${c.xMm -
|
|
2636
|
+
u.setAttribute("d", `M ${c.xMm - j} ${c.yMm} H ${c.xMm + j} M ${c.xMm} ${c.yMm - j} V ${c.yMm + j}`), u.setAttribute("stroke", o), u.setAttribute("stroke-width", "0.15"), s.appendChild(u);
|
|
2635
2637
|
}
|
|
2636
2638
|
for (const l of t.labels) {
|
|
2637
2639
|
const c = i.createElementNS(ut, "text");
|
|
@@ -2659,7 +2661,7 @@ class hr extends O {
|
|
|
2659
2661
|
t.beginPath(), l.points.forEach((c, u) => u === 0 ? t.moveTo(o(c.xMm), o(c.yMm)) : t.lineTo(o(c.xMm), o(c.yMm))), t.stroke();
|
|
2660
2662
|
else
|
|
2661
2663
|
for (const c of this.tickPoints(l, a, n))
|
|
2662
|
-
t.beginPath(), t.moveTo(o(c.xMm -
|
|
2664
|
+
t.beginPath(), t.moveTo(o(c.xMm - j), o(c.yMm)), t.lineTo(o(c.xMm + j), o(c.yMm)), t.moveTo(o(c.xMm), o(c.yMm - j)), t.lineTo(o(c.xMm), o(c.yMm + j)), t.stroke();
|
|
2663
2665
|
t.font = `${o(2.2)}px ${i?.fontFamily || "system-ui, sans-serif"}`, t.textBaseline = "alphabetic";
|
|
2664
2666
|
for (const l of n.labels)
|
|
2665
2667
|
t.textAlign = l.edge === "left" ? "right" : "center", t.fillText(l.text, o(l.xMm), o(l.yMm));
|
|
@@ -2681,13 +2683,13 @@ function ri(r, t) {
|
|
|
2681
2683
|
const e = r.properties;
|
|
2682
2684
|
return e && t in e ? e[t] : r[t];
|
|
2683
2685
|
}
|
|
2684
|
-
function
|
|
2686
|
+
function zt(r, t) {
|
|
2685
2687
|
if (Array.isArray(r)) {
|
|
2686
2688
|
if (typeof r[0] == "number") {
|
|
2687
2689
|
t.push([r[0], r[1]]);
|
|
2688
2690
|
return;
|
|
2689
2691
|
}
|
|
2690
|
-
for (const e of r)
|
|
2692
|
+
for (const e of r) zt(e, t);
|
|
2691
2693
|
}
|
|
2692
2694
|
}
|
|
2693
2695
|
function ni(r) {
|
|
@@ -2696,7 +2698,7 @@ function ni(r) {
|
|
|
2696
2698
|
function F(r, t) {
|
|
2697
2699
|
return ri(r, t);
|
|
2698
2700
|
}
|
|
2699
|
-
function
|
|
2701
|
+
function jt(r) {
|
|
2700
2702
|
const t = {}, e = (i) => {
|
|
2701
2703
|
for (const [s, o] of Object.entries(i))
|
|
2702
2704
|
o == null || typeof o == "object" || (t[s] = String(o));
|
|
@@ -2708,8 +2710,8 @@ function zt(r) {
|
|
|
2708
2710
|
function ii(r) {
|
|
2709
2711
|
let t = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
|
|
2710
2712
|
const s = [], o = r.geometry;
|
|
2711
|
-
if (o?.coordinates != null)
|
|
2712
|
-
else if (Array.isArray(r.coordinates))
|
|
2713
|
+
if (o?.coordinates != null) zt(o.coordinates, s);
|
|
2714
|
+
else if (Array.isArray(r.coordinates)) zt(r.coordinates, s);
|
|
2713
2715
|
else {
|
|
2714
2716
|
const a = Number(F(r, "lng") ?? F(r, "longitude") ?? F(r, "lon") ?? F(r, "x")), l = Number(F(r, "lat") ?? F(r, "latitude") ?? F(r, "y"));
|
|
2715
2717
|
Number.isFinite(a) && Number.isFinite(l) && s.push([a, l]);
|
|
@@ -2722,7 +2724,7 @@ function si(r, t) {
|
|
|
2722
2724
|
const [e, n, i, s] = r, o = Math.max(i - e, 1e-4), a = Math.max(s - n, 1e-4), l = o * t, c = a * t;
|
|
2723
2725
|
return [e - l, n - c, i + l, s + c];
|
|
2724
2726
|
}
|
|
2725
|
-
const
|
|
2727
|
+
const ji = ([r, t, e, n]) => Math.max(0, e - r) * Math.max(0, n - t);
|
|
2726
2728
|
function oi({ features: r, filter: t, sort: e }) {
|
|
2727
2729
|
let n = t ? r.filter((s) => ai(t, s)) : [...r];
|
|
2728
2730
|
const i = li(e);
|
|
@@ -2758,7 +2760,7 @@ function ui(r) {
|
|
|
2758
2760
|
function hi(r, t, e) {
|
|
2759
2761
|
const n = /* @__PURE__ */ new Map();
|
|
2760
2762
|
return t.map((i, s) => {
|
|
2761
|
-
const o =
|
|
2763
|
+
const o = jt(i), a = (r ?? "page-{{atlas.index}}").replace(/\{\{\s*atlas\.([\w]+)\s*\}\}/g, (u, h) => h === "index" ? String(s + 1) : h === "count" ? String(t.length) : o[h] ?? u), l = ui(a), c = n.get(l) ?? 0;
|
|
2762
2764
|
return n.set(l, c + 1), `${c === 0 ? l : `${l}-${c + 1}`}.${e}`;
|
|
2763
2765
|
});
|
|
2764
2766
|
}
|
|
@@ -2840,7 +2842,7 @@ class mr extends O {
|
|
|
2840
2842
|
pageName(t) {
|
|
2841
2843
|
const e = this.ensurePages()[t];
|
|
2842
2844
|
if (!e) return `Page ${t + 1}`;
|
|
2843
|
-
const n =
|
|
2845
|
+
const n = jt(e), i = this.getAttribute("page-name");
|
|
2844
2846
|
return i ? i.replace(
|
|
2845
2847
|
/\{\{\s*atlas\.([\w]+)\s*\}\}/g,
|
|
2846
2848
|
(s, o) => o === "index" ? String(t + 1) : o === "count" ? String(this.count) : n[o] ?? s
|
|
@@ -2918,7 +2920,7 @@ class mr extends O {
|
|
|
2918
2920
|
const a = Number(s.getAttribute("atlas-margin")), l = si(o, Number.isFinite(a) && a > 0 ? a : 0.15);
|
|
2919
2921
|
s.fitBounds?.(l);
|
|
2920
2922
|
}
|
|
2921
|
-
e?.setAtlasFields({ ...
|
|
2923
|
+
e?.setAtlasFields({ ...jt(t), index: String(this.currentIndex + 1), count: String(this.count) }), e?.refreshFurniture();
|
|
2922
2924
|
const n = this.pageName(this.currentIndex);
|
|
2923
2925
|
this.dispatchEvent(
|
|
2924
2926
|
new CustomEvent("om-atlas-page", {
|
|
@@ -3395,7 +3397,7 @@ export {
|
|
|
3395
3397
|
tr as OmTextElement,
|
|
3396
3398
|
Xt as PAGE_PRESETS,
|
|
3397
3399
|
se as PAGE_SIZE_NAMES,
|
|
3398
|
-
|
|
3400
|
+
z as PLACED_ATTR_NAMES,
|
|
3399
3401
|
D as PX_PER_MM,
|
|
3400
3402
|
Br as SCALE_GROUP_SEPARATOR,
|
|
3401
3403
|
Lr as URL_ACTION_TIMEOUT_MS,
|
|
@@ -3404,8 +3406,8 @@ export {
|
|
|
3404
3406
|
$r as applyCvdToCanvas,
|
|
3405
3407
|
Yr as applyTokens,
|
|
3406
3408
|
Rr as applyUrlActions,
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
+
jt as atlasFields,
|
|
3410
|
+
ji as boundsArea,
|
|
3409
3411
|
S as boxMm,
|
|
3410
3412
|
Xn as buildGraticule,
|
|
3411
3413
|
oi as buildPages,
|
|
@@ -3433,7 +3435,7 @@ export {
|
|
|
3433
3435
|
en as layoutText,
|
|
3434
3436
|
kr as lintLegendColours,
|
|
3435
3437
|
Fe as loadCore,
|
|
3436
|
-
|
|
3438
|
+
zi as maxGeoreferenceablePitch,
|
|
3437
3439
|
Oi as mercatorForward,
|
|
3438
3440
|
_i as mercatorInverse,
|
|
3439
3441
|
Ee as niceInterval,
|
|
@@ -3453,7 +3455,7 @@ export {
|
|
|
3453
3455
|
U as referencedFrame,
|
|
3454
3456
|
ni as rejectionFor,
|
|
3455
3457
|
Wt as renderCartograph,
|
|
3456
|
-
|
|
3458
|
+
je as renderCartographAtlas,
|
|
3457
3459
|
Ot as resolveCrsForward,
|
|
3458
3460
|
Gt as resolveCvdType,
|
|
3459
3461
|
hi as resolveFilenames,
|
|
@@ -1156,7 +1156,9 @@ async function ia(t, e) {
|
|
|
1156
1156
|
units: a,
|
|
1157
1157
|
metresPerUnit: o,
|
|
1158
1158
|
forward: (h) => r.inverse(h),
|
|
1159
|
-
inverse: (h) => r.forward(h)
|
|
1159
|
+
inverse: (h) => r.forward(h),
|
|
1160
|
+
...typeof e == "string" && /^\s*\+proj=/.test(e) ? { definition: e.trim() } : null,
|
|
1161
|
+
proj4Source: e
|
|
1160
1162
|
};
|
|
1161
1163
|
}
|
|
1162
1164
|
const rs = Math.PI / 180, sa = 180 / Math.PI, ra = { code: "EPSG:3857", forward: wi, inverse: Te }, Ru = wi, Tu = Te, ns = 6378137, as = 89.9;
|