@nika-js/onlymap 0.9.1 → 0.10.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 +24 -0
- package/README.md +27 -3
- package/dist/{basemap-DL0mk9Bf.js → basemap-DzQBuqBn.js} +3882 -3980
- package/dist/cartograph/elements/om-frame.d.ts +67 -1
- package/dist/cartograph/georef.d.ts +18 -4
- package/dist/cartograph/schema.d.ts +11 -0
- package/dist/cartograph.js +1480 -1311
- package/dist/cartograph.standalone.js +1808 -1615
- package/dist/{cityjson-D_V5GY8b.js → cityjson-k-z1r6c0.js} +1 -1
- package/dist/{crs-DsDQ4Q4i.js → crs-BzE_KP4M.js} +25 -2
- package/dist/{crs-Ciu7Xs7a.js → crs-ChglCB3O.js} +39 -16
- package/dist/elements/om-map.d.ts +10 -0
- package/dist/{geoparquet-DJxZA0if.js → geoparquet-BlFSeNwf.js} +10 -10
- package/dist/globe-view-qTt7YaiC.js +104 -0
- package/dist/hillshade-Ds0pONmA.js +298 -0
- package/dist/{hillshade-shader-n_zManfZ.js → hillshade-shader-DI2uLSNU.js} +15 -10
- package/dist/hillshade-shader.d.ts +18 -2
- package/dist/hillshade.d.ts +30 -0
- package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
- package/dist/{index-vLXZuog4.js → index-B9kwlhFA.js} +1 -1
- package/dist/index-BCTAq6uy.js +65 -0
- package/dist/{index-DdTZSuAb.js → index-BK99wPf_.js} +106 -106
- package/dist/index-BSwEOxkR.js +322 -0
- package/dist/{index-BjcPjICh.js → index-Bpk1EipB.js} +59 -59
- package/dist/index-C2VK-Is6.js +641 -0
- package/dist/index-C4oddUIX.js +459 -0
- package/dist/{index-oY3XHIux.js → index-CBYDP-_0.js} +18178 -16943
- package/dist/{index-CvuDsvnk.js → index-oL_18WvP.js} +47 -47
- package/dist/index.d.ts +4 -0
- package/dist/layer-registry.d.ts +27 -0
- package/dist/{lerc-Bph62dCb.js → lerc-xM89n_hR.js} +1 -1
- package/dist/onlymap.standalone.js +48211 -45574
- package/dist/onlymapjs.js +77 -74
- package/dist/parse-manifest.d.ts +6 -0
- package/dist/plane-camera.d.ts +59 -0
- package/dist/plane-layers.d.ts +56 -0
- package/dist/plane-tiles.d.ts +99 -0
- package/dist/plane-tileset.d.ts +31 -0
- package/dist/plane-warp.d.ts +91 -0
- package/dist/post-process-effect-CNMzoP-h.js +197 -0
- package/dist/programmatic.d.ts +16 -1
- package/dist/projection.d.ts +118 -0
- package/dist/{raster-pipeline-BlOnMPJe.js → raster-pipeline-B_gY9-5f.js} +4 -3
- package/dist/{raster-D-eTzCE3.js → raster-yVRqHYLH.js} +4 -4
- package/dist/runtime-core.d.ts +140 -1
- package/dist/serialize/clip.d.ts +50 -0
- package/dist/serialize/declutter.d.ts +44 -0
- package/dist/serialize/emit.d.ts +60 -0
- package/dist/serialize/index.d.ts +64 -0
- package/dist/serialize/strategy.d.ts +30 -0
- package/dist/serialize/style.d.ts +77 -0
- package/dist/snapshot.d.ts +46 -0
- package/dist/surface-anchor.d.ts +6 -0
- package/dist/text-on-path-D-fhYDqa.js +146 -0
- package/dist/text-on-path.d.ts +157 -0
- package/dist/transform/buffer.d.ts +63 -0
- package/dist/transform/contour.d.ts +37 -0
- package/dist/transform/dot-density.d.ts +19 -0
- package/dist/transform/field.d.ts +80 -0
- package/dist/transform/geometry.d.ts +20 -0
- package/dist/transform/index.d.ts +29 -0
- package/dist/transform/simplify.d.ts +10 -0
- package/dist/transform/smooth.d.ts +12 -0
- package/dist/transform-stage.d.ts +92 -0
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-BGDoEtFb.js → zarr-BPeWy3ro.js} +2 -2
- package/docs/cartograph.md +12 -4
- package/docs/cartography.md +328 -0
- package/docs/design/arrows.md +182 -0
- package/docs/design/carto-substrate.md +1055 -0
- package/docs/design/extensions.md +250 -0
- package/llms.txt +3 -2
- package/onlymapjs.attributes.json +18 -0
- package/onlymapjs.html-data.json +169 -19
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +6 -2
- package/skills/onlymapjs/references/syntax.md +22 -2
- package/dist/hillshade-DR3TxO1a.js +0 -186
- package/dist/index-DO_w0tqR.js +0 -514
package/dist/onlymapjs.js
CHANGED
|
@@ -1,116 +1,119 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bP as e, bQ as r, bR as t, as as c, C as o, bS as i, c as n, bT as d, bU as l, bV as S, bW as E, ah as g, bX as L, bY as T, bZ as _, b_ as A, b$ as p, c0 as m, c1 as I, c2 as D, L as M, g as u, c3 as b, c4 as y, c5 as f, c6 as O, c7 as P, bE as R, c8 as C, ap as N, c9 as F, aB as h, ca as B, W as v, cb as x, aA as G, cc as U, cd as W, ce as w, cf as Y, cg as k, ch as X, ci as H, cj as K, ck as V, cl as j, cm as z, cn as J, co as q, cp as Q, cq as Z, cr as $, ak as aa, cs as sa, ct as ea, cu as ra, cv as ta, cw as ca, cx as oa, cy as ia, cz as na, cA as da, cB as la, cC as Sa, cD as Ea, aq as ga, cE as La, cF as Ta, ae as _a, cG as Aa, cH as pa, cI as ma, cJ as Ia, cK as Da, cL as Ma, cM as ua, cN as ba, cO as ya, cP as fa, cQ as Oa, cR as Pa, cS as Ra, cT as Ca, cU as Na, cV as Fa, cW as ha, cX as Ba, cY as va, cZ as xa, c_ as Ga, c$ as Ua, d0 as Wa, d1 as wa, d2 as Ya, d3 as ka, d4 as Xa, d5 as Ha, d6 as Ka, aC as Va, d7 as ja, d8 as za, d9 as Ja, da as qa, db as Qa, dc as Za, dd as $a, de as as, df as ss, dg as es, dh as rs, di as ts, dj as cs, dk as os, dl as is, dm as ns, dn as ds } from "./index-CBYDP-_0.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ALL_POSITION_VALUES,
|
|
4
4
|
r as AUDIT_EXEMPTIONS,
|
|
5
5
|
t as AccessorCache,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
c as BitmapLayer,
|
|
7
|
+
o as COORDINATE_SYSTEM,
|
|
8
8
|
i as CompileError,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
n as CompositeLayer,
|
|
10
|
+
d as DEFAULT_AUDIT_WIDTHS,
|
|
11
11
|
l as DEFAULT_FOLD_BREAKPOINT_PX,
|
|
12
12
|
S as DRONE_SENSOR_DATABASE,
|
|
13
13
|
E as EDGE_TOLERANCE_PX,
|
|
14
14
|
g as EFFECT_PRESET_NAMES,
|
|
15
15
|
L as FOLD_BOTTOM_CLEARANCE_PX,
|
|
16
16
|
T as FOLD_HYSTERESIS_PX,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
_ as FOLD_SIDES,
|
|
18
|
+
A as FOLD_SINGLE_SIDED_RATIO,
|
|
19
|
+
p as GeoJsonLayer,
|
|
20
|
+
m as IconLayer,
|
|
21
|
+
I as LEGACY_POSITION_ALIASES,
|
|
22
|
+
D as LIGHTING_PRESET_NAMES,
|
|
23
|
+
M as Layer,
|
|
24
|
+
u as LayerExtension,
|
|
25
|
+
b as MANAGED_SLOTS,
|
|
26
26
|
y as MapController,
|
|
27
27
|
f as OmMap,
|
|
28
28
|
O as ScatterplotLayer,
|
|
29
29
|
P as ScenegraphLayer,
|
|
30
30
|
R as SimpleMeshLayer,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
C as Tile3DLayer,
|
|
32
|
+
N as TileLayer,
|
|
33
|
+
F as UNIT_SYSTEMS,
|
|
34
|
+
h as WGS84_MEAN_RADIUS_M,
|
|
35
|
+
B as WIDGET_STYLE_KEY_NAMES,
|
|
36
36
|
v as WebMercatorViewport,
|
|
37
37
|
x as arrowTableToColumnar,
|
|
38
38
|
G as asRows,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
U as auditLayout,
|
|
40
|
+
W as badgeMode,
|
|
41
|
+
w as bottomEndLiftPx,
|
|
42
42
|
Y as compileExpression,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
k as compileFullJsAccessorBlockInSandbox,
|
|
44
|
+
X as computeTimeline,
|
|
45
45
|
H as configureBasemap,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
K as configureData,
|
|
47
|
+
V as configureIfc,
|
|
48
|
+
j as configureLicense,
|
|
49
|
+
z as configureTelemetry,
|
|
50
|
+
J as descriptorToIR,
|
|
51
51
|
q as destroySandbox,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
Q as distanceMeters,
|
|
53
|
+
Z as effectiveFoldBreakpointPx,
|
|
54
|
+
$ as evaluateInSandbox,
|
|
55
55
|
aa as expandPreset,
|
|
56
56
|
sa as foldDrawerStyle,
|
|
57
57
|
ea as foldPanelStyle,
|
|
58
58
|
ra as foldSideForSlot,
|
|
59
59
|
ta as foldToggleSlot,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
ca as foldToggleStyle,
|
|
61
|
+
oa as formatArea,
|
|
62
62
|
ia as formatLength,
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
na as getBasemap,
|
|
64
|
+
da as getEntitlements,
|
|
65
65
|
la as getLayerSchema,
|
|
66
66
|
Sa as getMeasureRadiusMeters,
|
|
67
67
|
Ea as getRoutingProvider,
|
|
68
68
|
ga as getTerrain,
|
|
69
69
|
La as isBrowser,
|
|
70
70
|
Ta as isColumnar,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
_a as isEffectPreset,
|
|
72
|
+
Aa as isStoreToken,
|
|
73
|
+
pa as lineStringLengthMeters,
|
|
74
|
+
ma as loadIfc,
|
|
75
|
+
Ia as loadRasterModule,
|
|
76
|
+
Da as midpoint,
|
|
77
|
+
Ma as mountForTest,
|
|
78
|
+
ua as niceNumber,
|
|
79
|
+
ba as normalizeData,
|
|
80
80
|
ya as parseDurationMs,
|
|
81
81
|
fa as parseTerrainAttrs,
|
|
82
82
|
Oa as parseUnitSystem,
|
|
83
83
|
Pa as parseWidgetStyle,
|
|
84
84
|
Ra as pathLengthMeters,
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
Ca as registerAction,
|
|
86
|
+
Na as registerBasemap,
|
|
87
|
+
Fa as registerCrs,
|
|
87
88
|
ha as registerFormat,
|
|
88
89
|
Ba as registerLayer,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Wa as
|
|
94
|
-
wa as
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Xa as
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Za as
|
|
107
|
-
$a as
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
os as
|
|
115
|
-
|
|
90
|
+
va as registerRoutingProvider,
|
|
91
|
+
xa as registerSource,
|
|
92
|
+
Ga as registerTerrain,
|
|
93
|
+
Ua as registerWidget,
|
|
94
|
+
Wa as registeredCrsCodes,
|
|
95
|
+
wa as releaseDataOwner,
|
|
96
|
+
Ya as resolveFoldBreakpointPx,
|
|
97
|
+
ka as resolveImageOverlay,
|
|
98
|
+
Xa as resolveLighting,
|
|
99
|
+
Ha as resolveProjection,
|
|
100
|
+
Ka as resolveSlot,
|
|
101
|
+
Va as ringAreaMeters2,
|
|
102
|
+
ja as ringEnclosesPole,
|
|
103
|
+
za as ringPerimeterMeters,
|
|
104
|
+
Ja as rowAt,
|
|
105
|
+
qa as sandboxHtml,
|
|
106
|
+
Qa as scaleBarStep,
|
|
107
|
+
Za as setKeepBadge,
|
|
108
|
+
$a as setMeasureRadiusMeters,
|
|
109
|
+
as as settleLayout,
|
|
110
|
+
ss as shouldFoldAtWidth,
|
|
111
|
+
es as slotContainerStyle,
|
|
112
|
+
rs as slotLayout,
|
|
113
|
+
ts as snapshotDescriptorIR,
|
|
114
|
+
cs as snapshotIR,
|
|
115
|
+
os as solarAzElDegrees,
|
|
116
|
+
is as subscribeLicense,
|
|
117
|
+
ns as validateManifest,
|
|
118
|
+
ds as validateManifestString
|
|
116
119
|
};
|
package/dist/parse-manifest.d.ts
CHANGED
|
@@ -26,5 +26,11 @@ export interface ParseManifestOptions {
|
|
|
26
26
|
}) => void;
|
|
27
27
|
/** Controller/element identity for descriptor-owned transport lifetime. */
|
|
28
28
|
dataOwner?: DataTransportOwner;
|
|
29
|
+
/**
|
|
30
|
+
* Ground metres per millimetre of paper, overriding the map's own
|
|
31
|
+
* `reference-scale`. A cartograph frame passes its georef's value, so a
|
|
32
|
+
* sheet never has to declare a scale it already knows.
|
|
33
|
+
*/
|
|
34
|
+
metresPerMm?: number | null;
|
|
29
35
|
}
|
|
30
36
|
export declare function parseManifest(mapEl: Element, onDataLoaded: () => void, opts?: ParseManifestOptions): LayerIR[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { PlaneFrame } from "./projection";
|
|
2
|
+
/**
|
|
3
|
+
* Metres per common unit at a latitude — equivalently, metres per pixel at
|
|
4
|
+
* zoom 0. Zoom-independent, because deck scales common space by `2^zoom`
|
|
5
|
+
* separately.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mercatorMetresPerUnit(latitude: number): number;
|
|
8
|
+
/** An orthographic camera in origin-relative plane units. */
|
|
9
|
+
export interface PlaneCamera {
|
|
10
|
+
target: [number, number];
|
|
11
|
+
zoom: number;
|
|
12
|
+
}
|
|
13
|
+
export interface GeographicCamera {
|
|
14
|
+
longitude: number;
|
|
15
|
+
latitude: number;
|
|
16
|
+
zoom: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Geographic zoom → orthographic zoom, matching metres per pixel at
|
|
20
|
+
* `latitude`.
|
|
21
|
+
*
|
|
22
|
+
* An orthographic viewport draws `2^zoom` pixels per world unit, so the world
|
|
23
|
+
* unit has to be priced in metres first — which is what `metresPerUnit` does,
|
|
24
|
+
* and why a plane in feet or degrees is not simply a rescaled plane in metres.
|
|
25
|
+
*/
|
|
26
|
+
export declare function planeZoomFromGeographic(zoom: number, latitude: number, metresPerUnit: number): number;
|
|
27
|
+
/** The exact inverse, so a round trip through the boundary changes nothing. */
|
|
28
|
+
export declare function geographicZoomFromPlane(zoom: number, latitude: number, metresPerUnit: number): number;
|
|
29
|
+
/** Authored geographic camera → the orthographic camera deck is given. */
|
|
30
|
+
export declare function toPlaneCamera(frame: PlaneFrame, camera: GeographicCamera): PlaneCamera;
|
|
31
|
+
/**
|
|
32
|
+
* The orthographic camera deck reports → the geographic camera every consumer
|
|
33
|
+
* expects.
|
|
34
|
+
*
|
|
35
|
+
* The latitude comes from unprojecting the target rather than being carried
|
|
36
|
+
* alongside, because the target is the only thing deck actually moved — a
|
|
37
|
+
* remembered latitude would drift out of step with it after a pan.
|
|
38
|
+
*/
|
|
39
|
+
export declare function toGeographicCamera(frame: PlaneFrame, camera: PlaneCamera): GeographicCamera;
|
|
40
|
+
/**
|
|
41
|
+
* A plane viewport that answers in lng/lat.
|
|
42
|
+
*
|
|
43
|
+
* `getViewport()` is the shared coordinate seam: overlays anchor through it,
|
|
44
|
+
* widgets read `getBounds()` for viewport filtering and stats, `ctx` hands it
|
|
45
|
+
* to accessors, and the measure and snap paths unproject screen points with
|
|
46
|
+
* it. Every one of those assumes geographic coordinates, because until now
|
|
47
|
+
* every viewport produced them.
|
|
48
|
+
*
|
|
49
|
+
* An `OrthographicViewport` does not — it answers in plane metres — so handing
|
|
50
|
+
* one out directly would give all of those consumers plausible numbers that
|
|
51
|
+
* are wrong by hundreds of kilometres, with nothing raised. Rather than teach
|
|
52
|
+
* each consumer about the plane, this keeps the seam's contract and converts
|
|
53
|
+
* at it, which is the same choice the camera makes one layer up.
|
|
54
|
+
*
|
|
55
|
+
* Built with `Object.create` so everything not overridden — width, height,
|
|
56
|
+
* zoom, the projection matrices deck's own picking uses — delegates to the
|
|
57
|
+
* real viewport untouched.
|
|
58
|
+
*/
|
|
59
|
+
export declare function planeViewport<T extends object>(viewport: T, frame: PlaneFrame): T;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projecting a layer's geometry into the plane (docs/design/carto-substrate.md
|
|
3
|
+
* §4, and the accessor gap found while building it).
|
|
4
|
+
*
|
|
5
|
+
* THE GAP. The design said data is projected once at ingest and "every layer,
|
|
6
|
+
* accessor, classification, effect and the legend are untouched: none of them
|
|
7
|
+
* ever asked what the coordinates meant". That is true of colours and sizes
|
|
8
|
+
* and false of POSITIONS: `get-position="[$lon, $lat]"` compiles to a function
|
|
9
|
+
* deck evaluates per row at draw time, reading fields off the row. Projecting
|
|
10
|
+
* the data never reaches it — the fields stay lng/lat and the layer keeps
|
|
11
|
+
* emitting lng/lat into a metre plane, which renders as nothing at all.
|
|
12
|
+
*
|
|
13
|
+
* So both halves are handled here, at the one point where a deck layer is
|
|
14
|
+
* constructed: geometry carried AS data is projected, and positional accessors
|
|
15
|
+
* are wrapped. Nothing in `parse-manifest` or `attribute-resolution` changes,
|
|
16
|
+
* which is deliberate — those are the hottest shared paths in the library and
|
|
17
|
+
* a Mercator map must take exactly the code it takes today.
|
|
18
|
+
*
|
|
19
|
+
* WHY MEMOISED, AND WHY IT MATTERS MORE THAN IT LOOKS. `expr/cache.ts` states
|
|
20
|
+
* that an accessor's cache key IS its deck `updateTrigger`. Handing deck a
|
|
21
|
+
* freshly-wrapped function on every rebuild would leave the trigger unchanged
|
|
22
|
+
* while the reference churned, and deck would recompute every attribute of
|
|
23
|
+
* every layer on every frame. The WeakMaps below keep one wrapper per
|
|
24
|
+
* (original, plane) pair, so identity is as stable as the thing it wraps.
|
|
25
|
+
*/
|
|
26
|
+
import type { PlaneFrame } from "./projection";
|
|
27
|
+
/**
|
|
28
|
+
* Accessors that RETURN coordinates. Five, across every registered schema —
|
|
29
|
+
* `plane-layers.test.ts` fails if a new one appears unlisted, so this cannot
|
|
30
|
+
* rot silently into geometry drawn in the wrong place.
|
|
31
|
+
*/
|
|
32
|
+
export declare const POSITIONAL_ACCESSORS: readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* Accessors that return a spatial-index TOKEN, not a coordinate — H3 cells,
|
|
35
|
+
* S2 tokens, geohashes, quadkeys. Deck resolves these to geometry inside the
|
|
36
|
+
* layer using its own geographic maths, so there is nothing here to intercept
|
|
37
|
+
* and no wrapper that could help: those layer types cannot draw in a plane
|
|
38
|
+
* view at all, and say so through validation rather than vanishing.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SPATIAL_INDEX_ACCESSORS: readonly string[];
|
|
41
|
+
/** Names that LOOK positional — the guard the classification test applies to new layer types. */
|
|
42
|
+
export declare const POSITIONAL_NAME_PATTERN: RegExp;
|
|
43
|
+
export declare const SPATIAL_INDEX_NAME_PATTERN: RegExp;
|
|
44
|
+
/**
|
|
45
|
+
* Projects geometry a layer reads DIRECTLY rather than through an accessor —
|
|
46
|
+
* GeoJSON features, whose coordinates deck walks itself.
|
|
47
|
+
*
|
|
48
|
+
* A row with no `geometry.coordinates` is returned untouched, so row data
|
|
49
|
+
* driven entirely by accessors costs nothing here. The author's own array is
|
|
50
|
+
* never mutated: it may be the inline-JSON memo, shared with the DOM.
|
|
51
|
+
*/
|
|
52
|
+
export declare function projectData(data: unknown, plane: PlaneFrame): unknown;
|
|
53
|
+
/** Positional accessor props on a resolved prop bag, wrapped for the plane. */
|
|
54
|
+
export declare function projectProps(props: Record<string, unknown>, plane: PlaneFrame): Record<string, unknown>;
|
|
55
|
+
/** Which spatial-index accessors a resolved prop bag uses — empty for every layer that can draw in a plane. */
|
|
56
|
+
export declare function spatialIndexPropsUsed(props: Record<string, unknown>): string[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which Web Mercator tiles cover a projected sheet (docs/design/carto-substrate.md
|
|
3
|
+
* §9, Phase 6).
|
|
4
|
+
*
|
|
5
|
+
* deck's `Tileset2D` picks tiles two different ways: OSM `{z}/{x}/{y}` indices
|
|
6
|
+
* when the viewport `isGeospatial`, and a Cartesian tiling of the viewport's
|
|
7
|
+
* own world units when it is not. A plane view is an `OrthographicViewport`,
|
|
8
|
+
* so it takes the second branch — and a DEM served as OSM tiles would be asked
|
|
9
|
+
* for indices that mean nothing. That is not a bug in deck; a non-geospatial
|
|
10
|
+
* viewport genuinely has no latitude.
|
|
11
|
+
*
|
|
12
|
+
* This module is the third case: an orthographic viewport that DOES have a
|
|
13
|
+
* geography, because its plane carries one. It converts the visible plane
|
|
14
|
+
* rectangle back to lng/lat and enumerates the OSM tiles over it.
|
|
15
|
+
*
|
|
16
|
+
* **The cover is sampled along the edges, not taken from the corners.** A conic
|
|
17
|
+
* projection bends parallels, so a plane rectangle's extreme latitude sits at
|
|
18
|
+
* the middle of an edge, not at a corner — the same reason `planeViewport`'s
|
|
19
|
+
* `getBounds()` samples edges. Taking corners alone leaves a crescent of the
|
|
20
|
+
* sheet's top edge untiled, which reads as relief that stops short of the
|
|
21
|
+
* frame.
|
|
22
|
+
*/
|
|
23
|
+
import type { PlaneFrame } from "./projection";
|
|
24
|
+
export interface TileIndexXYZ {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
z: number;
|
|
28
|
+
}
|
|
29
|
+
export interface LngLatBounds {
|
|
30
|
+
west: number;
|
|
31
|
+
south: number;
|
|
32
|
+
east: number;
|
|
33
|
+
north: number;
|
|
34
|
+
}
|
|
35
|
+
/** Web Mercator's latitude limit — beyond it the projection runs to infinity. */
|
|
36
|
+
export declare const MERCATOR_MAX_LATITUDE = 85.051129;
|
|
37
|
+
/** The lng/lat extent of one OSM tile — the same numbers deck's `tile.boundingBox` carries. */
|
|
38
|
+
export declare function osmTileBounds(x: number, y: number, z: number): LngLatBounds;
|
|
39
|
+
export declare function lngLatToTile(lng: number, lat: number, z: number): {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The geographic extent of a plane rectangle.
|
|
45
|
+
*
|
|
46
|
+
* Sampled over the rectangle's INTERIOR as well as its boundary, and with
|
|
47
|
+
* longitudes unwrapped before the extremes are taken. Both corrections exist
|
|
48
|
+
* because an earlier version sampled edges only, on the reasoning that a
|
|
49
|
+
* conic's extreme latitude sits mid-edge — true for a conic away from its
|
|
50
|
+
* apex, and false in two cases that matter:
|
|
51
|
+
*
|
|
52
|
+
* - **A sheet that CONTAINS the projection's pole.** The pole is then an
|
|
53
|
+
* interior point and is the latitude extreme, so edge sampling never sees
|
|
54
|
+
* it. Measured on a 6 000 km polar-stereographic sheet centred on the
|
|
55
|
+
* South Pole: the edge-sampled bounds bottomed out at −62.9° while the
|
|
56
|
+
* sheet's own centre is −90°, and relief rendered as an annulus with an
|
|
57
|
+
* unshaded hole over the inner two-thirds of the plate — every selected
|
|
58
|
+
* tile loaded and nothing errored.
|
|
59
|
+
* - **A sheet that crosses the ANTIMERIDIAN.** Longitudes wrap, so a naive
|
|
60
|
+
* min/max collapses to the whole world. Measured on a 1 400 km NZTM sheet:
|
|
61
|
+
* bounds of (−179.4 … 179.9), a cover that blew the tile budget, and a
|
|
62
|
+
* silent fall back of three pyramid levels — "looks a bit soft", which is
|
|
63
|
+
* the kind of wrong that survives review.
|
|
64
|
+
*
|
|
65
|
+
* `samples` is per axis. The interior grid is the same cost class as the edge
|
|
66
|
+
* walk it replaces and removes both failure modes at once.
|
|
67
|
+
*/
|
|
68
|
+
export declare function planeRectToLngLat(frame: PlaneFrame, rect: {
|
|
69
|
+
left: number;
|
|
70
|
+
bottom: number;
|
|
71
|
+
right: number;
|
|
72
|
+
top: number;
|
|
73
|
+
}, samples?: number): LngLatBounds;
|
|
74
|
+
/**
|
|
75
|
+
* The OSM tiles covering a plane rectangle at a given tile zoom.
|
|
76
|
+
*
|
|
77
|
+
* `limit` is a hard ceiling, because the cover is the one place a bad camera
|
|
78
|
+
* turns into thousands of network requests: a projection's inverse can return
|
|
79
|
+
* a wildly wrong lng/lat outside its area of use (proj4 does not clamp), and a
|
|
80
|
+
* fully zoomed-out plane view of a national grid legitimately sees most of a
|
|
81
|
+
* hemisphere. Over the ceiling the caller falls back a zoom level rather than
|
|
82
|
+
* issuing the requests.
|
|
83
|
+
*/
|
|
84
|
+
export declare function planeTileCover(frame: PlaneFrame, rect: {
|
|
85
|
+
left: number;
|
|
86
|
+
bottom: number;
|
|
87
|
+
right: number;
|
|
88
|
+
top: number;
|
|
89
|
+
}, z: number, limit?: number): TileIndexXYZ[];
|
|
90
|
+
/**
|
|
91
|
+
* The cover, dropping a zoom level at a time until it fits under `limit`.
|
|
92
|
+
* Coarser relief is a worse sheet; a thousand tile requests is a broken one.
|
|
93
|
+
*/
|
|
94
|
+
export declare function planeTileCoverWithinBudget(frame: PlaneFrame, rect: {
|
|
95
|
+
left: number;
|
|
96
|
+
bottom: number;
|
|
97
|
+
right: number;
|
|
98
|
+
top: number;
|
|
99
|
+
}, z: number, limit?: number): TileIndexXYZ[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Tileset2D` a projected map's tiled raster layers use
|
|
3
|
+
* (docs/design/carto-substrate.md §9, Phase 6).
|
|
4
|
+
*
|
|
5
|
+
* deck picks tile indices from the viewport: OSM `{z}/{x}/{y}` when it
|
|
6
|
+
* `isGeospatial`, and a Cartesian tiling of world units when it is not. A
|
|
7
|
+
* plane view is an `OrthographicViewport`, so deck takes the second branch and
|
|
8
|
+
* a DEM served as OSM tiles gets asked for indices that mean nothing.
|
|
9
|
+
*
|
|
10
|
+
* `Tileset2D` names `getTileIndices` and `getTileMetadata` as its public
|
|
11
|
+
* subclassing interface, so this is a supported extension point rather than a
|
|
12
|
+
* reach into deck's internals. Everything else — the LRU, the fetch lifecycle,
|
|
13
|
+
* parent-tile fallback while children load — is inherited untouched.
|
|
14
|
+
*/
|
|
15
|
+
import { _Tileset2D as Tileset2D } from "@deck.gl/geo-layers";
|
|
16
|
+
import type { PlaneFrame } from "./projection";
|
|
17
|
+
interface OrthographicLike {
|
|
18
|
+
/** The plane zoom deck was given — `scale` is 2^zoom, so this is the same fact said once. */
|
|
19
|
+
zoom: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
unproject(xy: number[]): number[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The geographic zoom whose tiles have roughly the ground resolution this plane
|
|
26
|
+
* camera is showing. Tiles are a Mercator pyramid, so "which level" is a
|
|
27
|
+
* question about metres per pixel, and the plane's own zoom is in plane units.
|
|
28
|
+
*/
|
|
29
|
+
export declare function tileZoomForPlane(viewport: OrthographicLike, frame: PlaneFrame, latitude: number, tileSize?: number): number;
|
|
30
|
+
export declare function planeTilesetClass(frame: PlaneFrame): typeof Tileset2D;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raster in the plane: the warp (docs/design/carto-substrate.md §9, Phase 6).
|
|
3
|
+
*
|
|
4
|
+
* A Web Mercator tile is a rectangle in Mercator and a curved quadrilateral in
|
|
5
|
+
* any other projection. To draw it on a projected sheet, the tile is
|
|
6
|
+
* **subdivided** into an N x N grid whose vertices are projected on the CPU
|
|
7
|
+
* through `projection.ts`; the GPU interpolates the texture bilinearly across
|
|
8
|
+
* each warped quad. No projection math in GLSL — the same technique deck's
|
|
9
|
+
* `_GlobeView` and MapLibre's globe use for raster tiles.
|
|
10
|
+
*
|
|
11
|
+
* **Shade first, warp second.** This module moves an ALREADY-SHADED tile. The
|
|
12
|
+
* hillshade shader runs in the tile's own grid exactly as it does on a
|
|
13
|
+
* Mercator map, and nothing about it changes here. The rejected alternative —
|
|
14
|
+
* warp heights into a plane-space heightfield, then shade there — needs a
|
|
15
|
+
* float render target, needs the plane's anisotropic scale factors, and takes
|
|
16
|
+
* a gradient over resampled data, which is precisely where a derivative finds
|
|
17
|
+
* the resampler.
|
|
18
|
+
*
|
|
19
|
+
* The error this introduces is the difference between the true projected
|
|
20
|
+
* position of a point inside a cell and the bilinear interpolation of its
|
|
21
|
+
* four projected corners. It falls as 1/N², and `subdivisionFor` picks N from
|
|
22
|
+
* that. `maxDeviationMetres` is the measurement itself, exported because the
|
|
23
|
+
* phase gate re-runs it rather than trusting the table in the design doc.
|
|
24
|
+
*/
|
|
25
|
+
import type { LngLatPair, PlaneFrame } from "./projection";
|
|
26
|
+
/** A tile's geographic extent, in the order deck's `tile.boundingBox` gives it. */
|
|
27
|
+
export interface TileBoundsLngLat {
|
|
28
|
+
west: number;
|
|
29
|
+
south: number;
|
|
30
|
+
east: number;
|
|
31
|
+
north: number;
|
|
32
|
+
}
|
|
33
|
+
export interface WarpMesh {
|
|
34
|
+
/** Plane metres, 3 per vertex (z is always 0 — relief is a texture, not a surface). */
|
|
35
|
+
positions: Float64Array;
|
|
36
|
+
texCoords: Float32Array;
|
|
37
|
+
indices: Uint32Array;
|
|
38
|
+
vertexCount: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build the mesh for one tile. `n` is the number of CELLS per axis, so the
|
|
42
|
+
* grid has (n+1)² vertices and the classic un-subdivided quad is `n = 1`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildWarpMesh(bounds: TileBoundsLngLat, frame: PlaneFrame, n: number): WarpMesh;
|
|
45
|
+
/**
|
|
46
|
+
* The measurement the subdivision count rests on: the greatest distance, in
|
|
47
|
+
* PLANE METRES, between a point's true projected position and the bilinear
|
|
48
|
+
* interpolation of its cell's four projected corners.
|
|
49
|
+
*
|
|
50
|
+
* Sampled on a grid strictly inside each cell — the corners are exact by
|
|
51
|
+
* construction, so sampling them would report zero and prove nothing. That is
|
|
52
|
+
* the failure mode this function exists to avoid.
|
|
53
|
+
*/
|
|
54
|
+
export declare function maxDeviationMetres(bounds: TileBoundsLngLat, frame: PlaneFrame, n: number, samplesPerCell?: number): number;
|
|
55
|
+
/**
|
|
56
|
+
* Starting subdivision by tile zoom, from the measured table in §9: sub-pixel
|
|
57
|
+
* at 8x8 even at continental zoom, and error falling as 1/N².
|
|
58
|
+
*
|
|
59
|
+
* **The criterion is projection curvature, not capture ratio.** How much the
|
|
60
|
+
* projection bends across a tile is a function of ZOOM — a tile at z=3 spans
|
|
61
|
+
* 45° of longitude and one at z=10 spans a fifth of a degree. The capture
|
|
62
|
+
* ratio enters only through what "half a pixel" means, and only as
|
|
63
|
+
* `N ∝ √ratio`, which is why it is a small multiplier here and not the driver.
|
|
64
|
+
*/
|
|
65
|
+
export declare function subdivisionFor(zoom: number, captureRatio?: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Refine `n` until the deviation is under `budgetMetres`, capped. Used by the
|
|
68
|
+
* gate and available to a caller that would rather state a pixel budget than
|
|
69
|
+
* trust the table; the layer itself uses `subdivisionFor`, because measuring
|
|
70
|
+
* per tile per frame would cost more projections than the subdivision saves.
|
|
71
|
+
*/
|
|
72
|
+
export declare function subdivisionForBudget(bounds: TileBoundsLngLat, frame: PlaneFrame, budgetMetres: number, max?: number): number;
|
|
73
|
+
/**
|
|
74
|
+
* Bearing of the plane's own "up" at a point, in degrees clockwise from TRUE
|
|
75
|
+
* north — the grid convergence, computed against a resolved `PlaneFrame` and
|
|
76
|
+
* synchronously, which `crs.ts`'s numeric version cannot be because it resolves
|
|
77
|
+
* a CRS by EPSG code first.
|
|
78
|
+
*
|
|
79
|
+
* Measured, not derived per projection: step north in PLANE space, unproject,
|
|
80
|
+
* and take the true bearing. Any projection in the registry, including one
|
|
81
|
+
* registered as a bare pair of functions, answers this without a formula.
|
|
82
|
+
*
|
|
83
|
+
* This is what "sheet north" means for illumination (§4a, §12.4). Shading runs
|
|
84
|
+
* in the source Mercator grid, where up IS geographic north, so an azimuth
|
|
85
|
+
* handed to the shader unchanged lights the slope from a geographic bearing.
|
|
86
|
+
* Adding the convergence makes the same authored number mean a bearing from
|
|
87
|
+
* SHEET up instead, which is what relief atlases do — constant apparent
|
|
88
|
+
* illumination across the plate, rather than light that rotates by 34 degrees
|
|
89
|
+
* from one edge of a CONUS sheet to the other.
|
|
90
|
+
*/
|
|
91
|
+
export declare function planeGridConvergence(frame: PlaneFrame, lngLat: LngLatPair, stepMetres?: number): number;
|