@nika-js/onlymap 0.9.0 → 0.10.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 +38 -0
- package/README.md +50 -3
- package/dist/{LercDecode.es-BMcxSLhD.js → LercDecode.es-IEPCRZOv.js} +1 -1
- package/dist/{basemap-m98j2wxG.js → basemap-9lXclX9H.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/dem-decode.d.ts +58 -0
- package/dist/elements/om-map.d.ts +12 -0
- package/dist/{geoparquet-XOwOmChh.js → geoparquet-DFDZDBun.js} +10 -10
- package/dist/globe-view-D9wjfL0T.js +104 -0
- package/dist/hillshade-C2BQr6pd.js +298 -0
- package/dist/hillshade-apron-Bem3DWyJ.js +40 -0
- package/dist/hillshade-apron.d.ts +54 -0
- package/dist/hillshade-shader-DI2uLSNU.js +165 -0
- package/dist/hillshade-shader.d.ts +168 -0
- package/dist/hillshade.d.ts +163 -0
- package/dist/html-data.d.ts +1 -1
- package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
- package/dist/{index-DzOvV-O7.js → index-4Tvlt0iO.js} +57 -57
- package/dist/{index-HZWdgtm4.js → index-Bn66l3KG.js} +1 -1
- package/dist/index-BuXrMq5D.js +322 -0
- package/dist/index-CNRbZHkK.js +459 -0
- package/dist/{index-DDNElBTs.js → index-CkovmN47.js} +1 -1
- package/dist/index-CmuOizAF.js +641 -0
- package/dist/index-CvT5QHBS.js +65 -0
- package/dist/{index-BMbpftvm.js → index-DnVHKI61.js} +1 -1
- package/dist/{index-BSAY6CWm.js → index-JjyDEqAS.js} +18911 -17456
- package/dist/index.d.ts +4 -0
- package/dist/layer-registry.d.ts +27 -0
- package/dist/lerc-C1mQ_Kqq.js +22 -0
- package/dist/onlymap.standalone.js +49075 -45717
- package/dist/onlymapjs.js +73 -70
- 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-DfslKPM6.js +197 -0
- package/dist/programmatic.d.ts +16 -1
- package/dist/projection.d.ts +118 -0
- package/dist/{raster-Dg5p_99H.js → raster-D2NzdjZE.js} +609 -499
- package/dist/raster-hillshade.d.ts +119 -0
- package/dist/{raster-pipeline-DhjkqDYd.js → raster-pipeline-qnD1icOv.js} +511 -484
- package/dist/raster-pipeline.d.ts +10 -0
- package/dist/raster.d.ts +5 -0
- 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/terrain-heightfield.d.ts +0 -16
- package/dist/terrain-sample.d.ts +0 -13
- package/dist/text-on-path-Dm7vtNqt.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/volumetrics.d.ts +7 -0
- package/dist/{zarr-D3CzK1Zm.js → zarr-D5e5agMG.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/docs/design/hillshade.md +290 -0
- package/docs/effects.md +11 -0
- package/docs/hillshade.md +203 -0
- package/llms.txt +4 -2
- package/onlymapjs.attributes.json +45 -2
- package/onlymapjs.html-data.json +213 -25
- package/package.json +13 -9
- package/skills/onlymapjs/SKILL.md +7 -2
- package/skills/onlymapjs/references/syntax.md +31 -3
- package/dist/index-CfPbQUqO.js +0 -511
- package/dist/lerc-qK-nhCaB.js +0 -30
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { av as m, aw as h, ax as P, ay as S, az as C } from "./index-JjyDEqAS.js";
|
|
2
|
+
const x = (
|
|
3
|
+
/* wgsl */
|
|
4
|
+
`struct VertexInputs {
|
|
5
|
+
@location(0) clipSpacePositions: vec2<f32>,
|
|
6
|
+
@location(1) texCoords: vec2<f32>,
|
|
7
|
+
@location(2) coordinates: vec2<f32>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
struct FragmentInputs {
|
|
11
|
+
@builtin(position) Position : vec4<f32>,
|
|
12
|
+
@location(0) position : vec2<f32>,
|
|
13
|
+
@location(1) coordinate : vec2<f32>,
|
|
14
|
+
@location(2) uv : vec2<f32>
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
@vertex
|
|
18
|
+
fn vertexMain(inputs: VertexInputs) -> FragmentInputs {
|
|
19
|
+
var outputs: FragmentInputs;
|
|
20
|
+
outputs.Position = vec4(inputs.clipSpacePositions, 0., 1.);
|
|
21
|
+
outputs.position = inputs.clipSpacePositions;
|
|
22
|
+
outputs.coordinate = inputs.coordinates;
|
|
23
|
+
outputs.uv = inputs.texCoords;
|
|
24
|
+
return outputs;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
), g = (
|
|
28
|
+
/* glsl */
|
|
29
|
+
`#version 300 es
|
|
30
|
+
in vec2 clipSpacePositions;
|
|
31
|
+
in vec2 texCoords;
|
|
32
|
+
in vec2 coordinates;
|
|
33
|
+
|
|
34
|
+
out vec2 position;
|
|
35
|
+
out vec2 coordinate;
|
|
36
|
+
out vec2 uv;
|
|
37
|
+
|
|
38
|
+
void main(void) {
|
|
39
|
+
gl_Position = vec4(clipSpacePositions, 0., 1.);
|
|
40
|
+
position = clipSpacePositions;
|
|
41
|
+
coordinate = coordinates;
|
|
42
|
+
uv = texCoords;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
), u = [-1, -1, 1, -1, -1, 1, 1, 1];
|
|
46
|
+
class E extends m {
|
|
47
|
+
constructor(e, t) {
|
|
48
|
+
const r = u.map((s) => s === -1 ? 0 : s);
|
|
49
|
+
t.source && (t = { ...t, source: `${x}
|
|
50
|
+
${t.source}` }), super(e, {
|
|
51
|
+
id: t.id || P("clip-space"),
|
|
52
|
+
...t,
|
|
53
|
+
vs: g,
|
|
54
|
+
vertexCount: 4,
|
|
55
|
+
geometry: new h({
|
|
56
|
+
topology: "triangle-strip",
|
|
57
|
+
vertexCount: 4,
|
|
58
|
+
attributes: {
|
|
59
|
+
clipSpacePositions: { size: 2, value: new Float32Array(u) },
|
|
60
|
+
texCoords: { size: 2, value: new Float32Array(r) },
|
|
61
|
+
coordinates: { size: 2, value: new Float32Array(r) }
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const _ = `layout(std140) uniform screenUniforms {
|
|
68
|
+
vec2 texSize;
|
|
69
|
+
} screen;
|
|
70
|
+
`, F = {
|
|
71
|
+
name: "screen",
|
|
72
|
+
fs: _,
|
|
73
|
+
uniformTypes: {
|
|
74
|
+
texSize: "vec2<f32>"
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
class A extends S {
|
|
78
|
+
constructor(e, t) {
|
|
79
|
+
super(e, t);
|
|
80
|
+
const { module: r, fs: s, id: i } = t, o = {
|
|
81
|
+
depthWriteEnabled: !1,
|
|
82
|
+
depthCompare: "always",
|
|
83
|
+
depthBias: 0,
|
|
84
|
+
blend: !0,
|
|
85
|
+
blendColorSrcFactor: "one",
|
|
86
|
+
blendColorDstFactor: "one-minus-src-alpha",
|
|
87
|
+
blendAlphaSrcFactor: "one",
|
|
88
|
+
blendAlphaDstFactor: "one-minus-src-alpha",
|
|
89
|
+
blendColorOperation: "add",
|
|
90
|
+
blendAlphaOperation: "add"
|
|
91
|
+
};
|
|
92
|
+
this.model = new E(e, { id: i, fs: s, modules: [r, F], parameters: o });
|
|
93
|
+
}
|
|
94
|
+
render(e) {
|
|
95
|
+
this._renderPass(this.device, e);
|
|
96
|
+
}
|
|
97
|
+
delete() {
|
|
98
|
+
this.model.destroy(), this.model = null;
|
|
99
|
+
}
|
|
100
|
+
// Private methods
|
|
101
|
+
/**
|
|
102
|
+
* Renders the pass.
|
|
103
|
+
* This is an abstract method that should be overridden.
|
|
104
|
+
* @param inputBuffer - Frame buffer that contains the result of the previous pass
|
|
105
|
+
* @param outputBuffer - Frame buffer that serves as the output render target
|
|
106
|
+
*/
|
|
107
|
+
_renderPass(e, t) {
|
|
108
|
+
const { clearCanvas: r, inputBuffer: s, outputBuffer: i } = t, o = [s.width, s.height], c = {
|
|
109
|
+
texSrc: s.colorAttachments[0],
|
|
110
|
+
texSize: o
|
|
111
|
+
};
|
|
112
|
+
this.model.shaderInputs.setProps({
|
|
113
|
+
screen: c,
|
|
114
|
+
...t.moduleProps
|
|
115
|
+
});
|
|
116
|
+
const a = this.device.beginRenderPass({
|
|
117
|
+
framebuffer: i,
|
|
118
|
+
parameters: { viewport: [0, 0, ...o] },
|
|
119
|
+
clearColor: r ? [0, 0, 0, 0] : !1,
|
|
120
|
+
clearDepth: 1,
|
|
121
|
+
clearStencil: !1
|
|
122
|
+
});
|
|
123
|
+
this.model.draw(a), a.end();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
class R {
|
|
127
|
+
constructor(e, t) {
|
|
128
|
+
this.id = `${e.name}-pass`, this.props = t, C(e), this.module = e;
|
|
129
|
+
}
|
|
130
|
+
setup({ device: e }) {
|
|
131
|
+
this.passes = T(e, this.module, this.id);
|
|
132
|
+
}
|
|
133
|
+
setProps(e) {
|
|
134
|
+
this.props = e;
|
|
135
|
+
}
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
137
|
+
preRender() {
|
|
138
|
+
}
|
|
139
|
+
postRender(e) {
|
|
140
|
+
const t = this.passes, { target: r } = e;
|
|
141
|
+
let s = e.inputBuffer, i = e.swapBuffer;
|
|
142
|
+
for (let o = 0; o < t.length; o++) {
|
|
143
|
+
const c = o === t.length - 1, a = r !== void 0 && c;
|
|
144
|
+
a && (i = r);
|
|
145
|
+
const p = !a || !!e.clearCanvas, l = {}, f = this.module.passes[o].uniforms;
|
|
146
|
+
l[this.module.name] = { ...this.props, ...f }, t[o].render({ clearCanvas: p, inputBuffer: s, outputBuffer: i, moduleProps: l });
|
|
147
|
+
const v = i;
|
|
148
|
+
i = s, s = v;
|
|
149
|
+
}
|
|
150
|
+
return s;
|
|
151
|
+
}
|
|
152
|
+
cleanup() {
|
|
153
|
+
if (this.passes) {
|
|
154
|
+
for (const e of this.passes)
|
|
155
|
+
e.delete();
|
|
156
|
+
this.passes = void 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function T(n, e, t) {
|
|
161
|
+
return e.passes.map((r, s) => {
|
|
162
|
+
const i = b(e, r), o = `${t}-${s}`;
|
|
163
|
+
return new A(n, { id: o, module: e, fs: i });
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const d = `#version 300 es
|
|
167
|
+
uniform sampler2D texSrc;
|
|
168
|
+
|
|
169
|
+
in vec2 position;
|
|
170
|
+
in vec2 coordinate;
|
|
171
|
+
in vec2 uv;
|
|
172
|
+
|
|
173
|
+
out vec4 fragColor;
|
|
174
|
+
`, w = (n) => `${d}
|
|
175
|
+
void main() {
|
|
176
|
+
fragColor = texture(texSrc, coordinate);
|
|
177
|
+
fragColor = ${n}(fragColor, screen.texSize, coordinate);
|
|
178
|
+
}
|
|
179
|
+
`, y = (n) => `${d}
|
|
180
|
+
void main() {
|
|
181
|
+
fragColor = ${n}(texSrc, screen.texSize, coordinate);
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
function b(n, e) {
|
|
185
|
+
if (e.filter) {
|
|
186
|
+
const t = typeof e.filter == "string" ? e.filter : `${n.name}_filterColor_ext`;
|
|
187
|
+
return w(t);
|
|
188
|
+
}
|
|
189
|
+
if (e.sampler) {
|
|
190
|
+
const t = typeof e.sampler == "string" ? e.sampler : `${n.name}_sampleColor`;
|
|
191
|
+
return y(t);
|
|
192
|
+
}
|
|
193
|
+
return "";
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
R as P
|
|
197
|
+
};
|
package/dist/programmatic.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { Selection } from "./selection";
|
|
|
14
14
|
import type { ValidationEntry } from "./validation";
|
|
15
15
|
import type { MapViewport } from "./basemap";
|
|
16
16
|
import { type LayerIRSnapshot } from "./ir-snapshot";
|
|
17
|
+
import { type TransformSpec } from "./transform-stage";
|
|
17
18
|
/**
|
|
18
19
|
* A layer, declared as a typed value — the programmatic mirror of one
|
|
19
20
|
* <om-layer> element. First-party callers normally use plain JS accessor
|
|
@@ -74,6 +75,12 @@ export interface LayerDescriptor {
|
|
|
74
75
|
terrain?: "drape" | "offset" | "off";
|
|
75
76
|
/** Per-layer zoom visibility (public issue #38) — the `visible-zoom-range` attribute's twin: hidden outside min ≤ zoom < max (minzoom/maxzoom convention). Composes with `visible`. */
|
|
76
77
|
visibleZoomRange?: [number, number];
|
|
78
|
+
/**
|
|
79
|
+
* Geometry transforms (spec: cartographic substrate, Part B) — the
|
|
80
|
+
* `<om-transform>` children's twin, in order. Millimetre-authored knobs
|
|
81
|
+
* resolve against `MapControllerOptions.referenceScale`.
|
|
82
|
+
*/
|
|
83
|
+
transforms?: readonly TransformSpec[];
|
|
77
84
|
}
|
|
78
85
|
/** Camera state, both an input (options/setView) and an output (getViewState). */
|
|
79
86
|
export interface CameraState {
|
|
@@ -138,6 +145,12 @@ export interface MapControllerOptions {
|
|
|
138
145
|
hasFullMapConversion: boolean;
|
|
139
146
|
approximatePlacement: boolean;
|
|
140
147
|
}) => void;
|
|
148
|
+
/**
|
|
149
|
+
* The scale millimetre-authored geometry transforms resolve against — the
|
|
150
|
+
* `reference-scale` attribute's twin. Either spelling: `"1:50000"`, or the
|
|
151
|
+
* ground metres one millimetre of paper stands for (`50`).
|
|
152
|
+
*/
|
|
153
|
+
referenceScale?: string | number;
|
|
141
154
|
/** @internal Stable React-owned hosts that place required chrome in managed slots. */
|
|
142
155
|
chromeHosts?: MandatedChromeHosts;
|
|
143
156
|
}
|
|
@@ -152,7 +165,7 @@ export interface MapControllerOptions {
|
|
|
152
165
|
* still notifies, but it holds no reference count, so a real owner's release
|
|
153
166
|
* can stop it. `MapController` owns its own transports and does not need this.
|
|
154
167
|
*/
|
|
155
|
-
export declare function descriptorToIR(desc: LayerDescriptor, onDataLoaded: () => void, owner?: DataTransportOwner): LayerIR | null;
|
|
168
|
+
export declare function descriptorToIR(desc: LayerDescriptor, onDataLoaded: () => void, owner?: DataTransportOwner, metresPerMm?: number | null): LayerIR | null;
|
|
156
169
|
/**
|
|
157
170
|
* Resolve JSON-safe/programmatic descriptors to deterministic snapshots.
|
|
158
171
|
* URL data is represented as an empty pending layer and is never fetched.
|
|
@@ -191,6 +204,8 @@ export declare class MapController {
|
|
|
191
204
|
private destroyed;
|
|
192
205
|
private suspended;
|
|
193
206
|
private readonly dataOwner;
|
|
207
|
+
/** Ground metres per millimetre of paper — what a millimetre-authored transform resolves against. Null when the caller declared none. */
|
|
208
|
+
private metresPerMm;
|
|
194
209
|
private firstCommitDone;
|
|
195
210
|
private readonly stores;
|
|
196
211
|
/** Origin of the most recent viewport change FRAME — latched through the settle tracker for snapshot reads. */
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One projection function outside the GPU — the shared piece the plane view and
|
|
3
|
+
* the vector serializer both need (docs/design/carto-substrate.md §3).
|
|
4
|
+
*
|
|
5
|
+
* Before this module the capability existed twice, half each:
|
|
6
|
+
* `cartograph/georef.ts` had a `CrsForward` pair with closed-form Mercator and
|
|
7
|
+
* a lazy proj4 fallback but no batch and no origin; `crs.ts` had the bundled
|
|
8
|
+
* EPSG table and an INVERSE-only path built for placing BIM models. Neither
|
|
9
|
+
* could serve a whole layer of coordinates, and neither knew what a plane
|
|
10
|
+
* unit was worth in metres. This is both of them, plus the two things a plane
|
|
11
|
+
* view cannot do without.
|
|
12
|
+
*
|
|
13
|
+
* THE LOCAL ORIGIN IS NOT OPTIONAL. Eastings near 500 000 and northings near
|
|
14
|
+
* 6 000 000 carry ~24 bits of integer part, so an fp32 attribute buffer has
|
|
15
|
+
* roughly decimetre resolution left at those magnitudes — and the GPU sees
|
|
16
|
+
* fp32 whatever the CPU computed. Geometry jitters visibly at high zoom. The
|
|
17
|
+
* plane therefore holds `(x − x₀, y − y₀)`, with the origin fixed for the
|
|
18
|
+
* map's life and recorded so nothing downstream has to rediscover it.
|
|
19
|
+
*
|
|
20
|
+
* THE INTERFACE IS THE CONTRACT, NOT THE LIBRARY. proj4 covers the conic,
|
|
21
|
+
* cylindrical and azimuthal families most sheets need. Anything it does not —
|
|
22
|
+
* an interrupted or artistic projection — registers as a `Projection` from
|
|
23
|
+
* elsewhere without changing a caller, which is how the cartograph's graticule
|
|
24
|
+
* already works.
|
|
25
|
+
*
|
|
26
|
+
* DIRECTION NAMING IS CROSSED AGAINST proj4, DELIBERATELY. Here `forward`
|
|
27
|
+
* means INTO the plane, because that is the direction every caller thinks in.
|
|
28
|
+
* proj4's `converter.forward` goes from its first argument to its second, so
|
|
29
|
+
* the two get swapped at the boundary below. Getting this backwards produces
|
|
30
|
+
* coordinates that look plausible and are wrong, which is why it is stated
|
|
31
|
+
* here as well as at the call site.
|
|
32
|
+
*/
|
|
33
|
+
/** A planar coordinate: metres for a projected CRS, degrees for a geographic one. */
|
|
34
|
+
export type PlaneXY = [number, number];
|
|
35
|
+
/** `[lng, lat]`, always in that order. */
|
|
36
|
+
export type LngLatPair = [number, number];
|
|
37
|
+
/**
|
|
38
|
+
* Whether a plane's units are angular or linear — the only distinction ground
|
|
39
|
+
* scale actually turns on. A linear CRS converts with one scalar; a geographic
|
|
40
|
+
* one is ANISOTROPIC, because a degree of longitude shrinks with cos φ while a
|
|
41
|
+
* degree of latitude does not, so its two axes need different treatment.
|
|
42
|
+
*/
|
|
43
|
+
export type PlaneUnits = "degree" | "linear";
|
|
44
|
+
export interface Projection {
|
|
45
|
+
/** Normalized code, e.g. `EPSG:5070`. */
|
|
46
|
+
code: string;
|
|
47
|
+
units: PlaneUnits;
|
|
48
|
+
/**
|
|
49
|
+
* Metres per plane unit. For a linear CRS this is exact (1 for metres,
|
|
50
|
+
* 0.3048 for feet). For `"degree"` it is the EQUATORIAL degree — correct for
|
|
51
|
+
* latitude, and correct for longitude only after multiplying by cos φ.
|
|
52
|
+
*/
|
|
53
|
+
metresPerUnit: number;
|
|
54
|
+
/** lng/lat → plane. */
|
|
55
|
+
forward(lngLat: LngLatPair): PlaneXY;
|
|
56
|
+
/** plane → lng/lat. */
|
|
57
|
+
inverse(xy: PlaneXY): LngLatPair;
|
|
58
|
+
}
|
|
59
|
+
/** 2πa/360 — one degree of longitude at the equator. */
|
|
60
|
+
export declare const METRES_PER_EQUATORIAL_DEGREE: number;
|
|
61
|
+
export declare function mercatorForward([lng, lat]: LngLatPair): PlaneXY;
|
|
62
|
+
export declare function mercatorInverse([x, y]: PlaneXY): LngLatPair;
|
|
63
|
+
/** Normalize `3857` / `epsg:3857` / `EPSG::3857` to `EPSG:3857`; null when unparseable. */
|
|
64
|
+
export declare function normalizeCrs(raw: string | null | undefined): string | null;
|
|
65
|
+
/** The CRSs served with no proj4 load at all. */
|
|
66
|
+
export declare function builtinProjection(crs: string | null | undefined): Projection | null;
|
|
67
|
+
/**
|
|
68
|
+
* Teach the library a CRS: either a proj4 definition string, or a complete
|
|
69
|
+
* `Projection` for something proj4 cannot express.
|
|
70
|
+
*
|
|
71
|
+
* The second form is the escape hatch that keeps this module's promise — an
|
|
72
|
+
* interrupted or artistic projection is a function, and a caller that can
|
|
73
|
+
* supply one should not need this file changed.
|
|
74
|
+
*/
|
|
75
|
+
export declare function registerCrs(code: string, def: string | Projection): void;
|
|
76
|
+
/** Registered codes, for diagnostics and validation messages. */
|
|
77
|
+
export declare function registeredCrsCodes(): string[];
|
|
78
|
+
/** Formulaic UTM — the zones no table can enumerate. */
|
|
79
|
+
export declare function utmDef(zone: number, hemisphere: "N" | "S"): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve any CRS to a projection, loading proj4 only for codes without a
|
|
82
|
+
* closed form. `def` is an authored `+proj=…` string for a CRS the library
|
|
83
|
+
* neither bundles nor has registered.
|
|
84
|
+
*
|
|
85
|
+
* Returns null rather than guessing: a wrong projection places data somewhere
|
|
86
|
+
* plausible and wrong, which is indistinguishable from correct until someone
|
|
87
|
+
* measures it.
|
|
88
|
+
*/
|
|
89
|
+
export declare function resolveProjection(crs: string | null | undefined, def?: string | null): Promise<Projection | null>;
|
|
90
|
+
/**
|
|
91
|
+
* A projection plus the local origin everything downstream works relative to.
|
|
92
|
+
*
|
|
93
|
+
* Kept separate from `Projection` on purpose: the projection is a fact about a
|
|
94
|
+
* CRS and is shareable, while the origin is a fact about one map and must not
|
|
95
|
+
* leak between them.
|
|
96
|
+
*/
|
|
97
|
+
export interface PlaneFrame {
|
|
98
|
+
projection: Projection;
|
|
99
|
+
/** The origin in ABSOLUTE plane coordinates — what a consumer adds back to get real eastings. */
|
|
100
|
+
origin: PlaneXY;
|
|
101
|
+
originLngLat: LngLatPair;
|
|
102
|
+
/** lng/lat → plane, relative to the origin. */
|
|
103
|
+
toPlane(lngLat: LngLatPair): PlaneXY;
|
|
104
|
+
/** Origin-relative plane → lng/lat. */
|
|
105
|
+
fromPlane(xy: PlaneXY): LngLatPair;
|
|
106
|
+
/**
|
|
107
|
+
* Batch forward over interleaved coordinates, in place by default.
|
|
108
|
+
*
|
|
109
|
+
* `stride` lets a caller pass `[lng, lat, z]` triples (or wider rows) and
|
|
110
|
+
* have only the first two components transformed — elevation is not a plane
|
|
111
|
+
* coordinate and must survive untouched.
|
|
112
|
+
*/
|
|
113
|
+
forwardCoords(coords: Float64Array, opts?: {
|
|
114
|
+
out?: Float64Array;
|
|
115
|
+
stride?: number;
|
|
116
|
+
}): Float64Array;
|
|
117
|
+
}
|
|
118
|
+
export declare function planeFrame(projection: Projection, originLngLat: LngLatPair): PlaneFrame;
|