@math.gl/geospatial 5.0.0-rc.1 → 5.0.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/README.md +6 -6
- package/dist/coordinates.cjs +2523 -0
- package/dist/coordinates.cjs.map +6 -0
- package/dist/coordinates.d.ts +4 -0
- package/dist/coordinates.d.ts.map +1 -1
- package/dist/coordinates.js +2 -0
- package/dist/coordinates.js.map +1 -1
- package/dist/entries/ellipsoid.cjs +1209 -0
- package/dist/entries/ellipsoid.cjs.map +6 -0
- package/dist/entries/ellipsoid.d.ts +3 -19
- package/dist/entries/ellipsoid.d.ts.map +1 -1
- package/dist/entries/ellipsoid.js +1 -9
- package/dist/entries/ellipsoid.js.map +1 -1
- package/dist/expressions.cjs +726 -0
- package/dist/expressions.cjs.map +6 -0
- package/dist/geodesics.cjs +3195 -0
- package/dist/geodesics.cjs.map +6 -0
- package/dist/geodesics.d.ts +18 -0
- package/dist/geodesics.d.ts.map +1 -0
- package/dist/geodesics.js +13 -0
- package/dist/geodesics.js.map +1 -0
- package/dist/geographic-atlas/sampling.d.ts +1 -1
- package/dist/geographic-atlas/sampling.d.ts.map +1 -1
- package/dist/geographic-atlas/sampling.js +1 -1
- package/dist/geographic-atlas/sampling.js.map +1 -1
- package/dist/geographic-cuts.cjs +4160 -0
- package/dist/geographic-cuts.cjs.map +6 -0
- package/dist/geographic-cuts.d.ts +2 -0
- package/dist/geographic-cuts.d.ts.map +1 -1
- package/dist/geographic-cuts.js +1 -0
- package/dist/geographic-cuts.js.map +1 -1
- package/dist/geographic-seams/subdivide-cut.d.ts +1 -1
- package/dist/geographic-seams/subdivide-cut.d.ts.map +1 -1
- package/dist/geographic-seams/subdivide-cut.js +1 -1
- package/dist/geographic-seams/subdivide-cut.js.map +1 -1
- package/dist/geographic-seams/types.shared.cjs +32 -0
- package/dist/geographic-seams/types.shared.cjs.map +6 -0
- package/dist/globe.cjs +4223 -0
- package/dist/globe.cjs.map +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/maps/map-transition.shared.cjs +364 -0
- package/dist/maps/map-transition.shared.cjs.map +6 -0
- package/dist/maps/myriahedral/unfold.d.ts +1 -1
- package/dist/maps/myriahedral/unfold.d.ts.map +1 -1
- package/dist/maps/myriahedral/unfold.js +1 -1
- package/dist/maps/myriahedral/unfold.js.map +1 -1
- package/dist/maps/presets.cjs +2 -2
- package/dist/maps/presets.cjs.map +2 -2
- package/dist/maps/transitions.cjs +3 -342
- package/dist/maps/transitions.cjs.map +3 -3
- package/dist/maps.cjs +15 -319
- package/dist/maps.cjs.map +3 -3
- package/dist/projection/experimental/core.cjs +63 -1317
- package/dist/projection/experimental/core.cjs.map +3 -3
- package/dist/projection/experimental/core.d.ts +1 -1
- package/dist/projection/experimental/core.d.ts.map +1 -1
- package/dist/projection/experimental/crs/projjson.cjs +26 -45
- package/dist/projection/experimental/crs/projjson.cjs.map +3 -3
- package/dist/projection/experimental/crs/types.shared.cjs +44 -0
- package/dist/projection/experimental/crs/types.shared.cjs.map +6 -0
- package/dist/projection/experimental/crs/wkt.cjs +36 -52
- package/dist/projection/experimental/crs/wkt.cjs.map +3 -3
- package/dist/projection/experimental/entries/projections/ob_tran.cjs +9 -23
- package/dist/projection/experimental/entries/projections/ob_tran.cjs.map +3 -3
- package/dist/projection/experimental/lazy-projections/aea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/aea.js +1 -1
- package/dist/projection/experimental/lazy-projections/aeqd.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/aeqd.js +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.js +1 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/cass.js +1 -1
- package/dist/projection/experimental/lazy-projections/cea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/cea.js +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqc.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js +1 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/equi.js +1 -1
- package/dist/projection/experimental/lazy-projections/etmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/etmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.js +1 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/geos.js +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.js +1 -1
- package/dist/projection/experimental/lazy-projections/gstmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/gstmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/index.cjs +60 -903
- package/dist/projection/experimental/lazy-projections/index.cjs.map +3 -3
- package/dist/projection/experimental/lazy-projections/krovak.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.js +1 -1
- package/dist/projection/experimental/lazy-projections/laea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/laea.js +1 -1
- package/dist/projection/experimental/lazy-projections/lcc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/lcc.js +1 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/merc.js +1 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/mill.js +1 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/moll.js +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js +1 -1
- package/dist/projection/experimental/lazy-projections/ob_tran.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/ob_tran.js +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.js +1 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/poly.js +1 -1
- package/dist/projection/experimental/lazy-projections/qsc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/qsc.js +1 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/robin.js +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.js +1 -1
- package/dist/projection/experimental/lazy-projections/somerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/somerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/stere.js +1 -1
- package/dist/projection/experimental/lazy-projections/sterea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/sterea.js +1 -1
- package/dist/projection/experimental/lazy-projections/tmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/tmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.js +1 -1
- package/dist/projection/experimental/lazy-projections/utm.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/utm.js +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.js +1 -1
- package/dist/projection/experimental/projection-engine.shared.cjs +1184 -0
- package/dist/projection/experimental/projection-engine.shared.cjs.map +6 -0
- package/dist/projection/experimental/typescript-projection.shared.cjs +1703 -0
- package/dist/projection/experimental/typescript-projection.shared.cjs.map +6 -0
- package/dist/projection/index.cjs +622 -1535
- package/dist/projection/index.cjs.map +3 -3
- package/dist/projection/pipeline.cjs +44 -58
- package/dist/projection/pipeline.cjs.map +3 -3
- package/dist/projection/transform-analysis.cjs +20 -936
- package/dist/projection/transform-analysis.cjs.map +3 -3
- package/dist/subdivide-geodesic-polyline.d.ts +1 -1
- package/dist/subdivide-geodesic-polyline.d.ts.map +1 -1
- package/dist/subdivide-geodesic-polyline.js +1 -1
- package/dist/subdivide-geodesic-polyline.js.map +1 -1
- package/dist/subdivide-globe-mesh.d.ts +1 -1
- package/dist/subdivide-globe-mesh.d.ts.map +1 -1
- package/dist/subdivide-globe-mesh.js +1 -1
- package/dist/subdivide-globe-mesh.js.map +1 -1
- package/dist/subdivide-rhumb-polyline.d.ts +1 -1
- package/dist/subdivide-rhumb-polyline.d.ts.map +1 -1
- package/dist/subdivide-rhumb-polyline.js +1 -1
- package/dist/subdivide-rhumb-polyline.js.map +1 -1
- package/dist/tasks/index.cjs +808 -2993
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/terrain/geometry.d.ts +1 -1
- package/dist/terrain/geometry.d.ts.map +1 -1
- package/dist/terrain/geometry.js +1 -1
- package/dist/terrain/geometry.js.map +1 -1
- package/dist/terrain/index.cjs +2 -2
- package/dist/terrain/index.cjs.map +1 -1
- package/dist/tiles.cjs +354 -0
- package/dist/tiles.cjs.map +6 -0
- package/package.json +139 -117
- package/src/coordinates.ts +5 -0
- package/src/entries/ellipsoid.ts +7 -32
- package/src/geodesics.ts +40 -0
- package/src/geographic-atlas/sampling.ts +1 -1
- package/src/geographic-cuts.ts +21 -0
- package/src/geographic-seams/subdivide-cut.ts +1 -1
- package/src/index.ts +2 -0
- package/src/maps/myriahedral/unfold.ts +1 -1
- package/src/projection/experimental/core.ts +1 -1
- package/src/projection/experimental/lazy-projections/aea.ts +1 -1
- package/src/projection/experimental/lazy-projections/aeqd.ts +1 -1
- package/src/projection/experimental/lazy-projections/bonne.ts +1 -1
- package/src/projection/experimental/lazy-projections/cass.ts +1 -1
- package/src/projection/experimental/lazy-projections/cea.ts +1 -1
- package/src/projection/experimental/lazy-projections/eck6.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqc.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqdc.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqearth.ts +1 -1
- package/src/projection/experimental/lazy-projections/equi.ts +1 -1
- package/src/projection/experimental/lazy-projections/etmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/geocent.ts +1 -1
- package/src/projection/experimental/lazy-projections/geos.ts +1 -1
- package/src/projection/experimental/lazy-projections/gnom.ts +1 -1
- package/src/projection/experimental/lazy-projections/gstmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/krovak.ts +1 -1
- package/src/projection/experimental/lazy-projections/laea.ts +1 -1
- package/src/projection/experimental/lazy-projections/lcc.ts +1 -1
- package/src/projection/experimental/lazy-projections/merc.ts +1 -1
- package/src/projection/experimental/lazy-projections/mill.ts +1 -1
- package/src/projection/experimental/lazy-projections/moll.ts +1 -1
- package/src/projection/experimental/lazy-projections/nzmg.ts +1 -1
- package/src/projection/experimental/lazy-projections/ob_tran.ts +1 -1
- package/src/projection/experimental/lazy-projections/omerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/ortho.ts +1 -1
- package/src/projection/experimental/lazy-projections/poly.ts +1 -1
- package/src/projection/experimental/lazy-projections/qsc.ts +1 -1
- package/src/projection/experimental/lazy-projections/robin.ts +1 -1
- package/src/projection/experimental/lazy-projections/sinu.ts +1 -1
- package/src/projection/experimental/lazy-projections/somerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/stere.ts +1 -1
- package/src/projection/experimental/lazy-projections/sterea.ts +1 -1
- package/src/projection/experimental/lazy-projections/tmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/tpers.ts +1 -1
- package/src/projection/experimental/lazy-projections/utm.ts +1 -1
- package/src/projection/experimental/lazy-projections/vandg.ts +1 -1
- package/src/subdivide-geodesic-polyline.ts +2 -2
- package/src/subdivide-globe-mesh.ts +2 -2
- package/src/subdivide-rhumb-polyline.ts +2 -2
- package/src/terrain/geometry.ts +1 -1
- package/dist/index.cjs +0 -18674
- package/dist/index.cjs.map +0 -6
- package/dist/turf-expressions.cjs +0 -1997
- package/dist/turf-expressions.cjs.map +0 -6
- package/dist/turf-expressions.d.ts +0 -3
- package/dist/turf-expressions.d.ts.map +0 -1
- package/dist/turf-expressions.js +0 -7
- package/dist/turf-expressions.js.map +0 -1
- package/src/turf-expressions.ts +0 -7
package/dist/tasks/index.cjs
CHANGED
|
@@ -768,7 +768,7 @@ function gcd(a, b) {
|
|
|
768
768
|
return a;
|
|
769
769
|
}
|
|
770
770
|
function certifyTerrainMeshCoverage(field, mesh, options = {}) {
|
|
771
|
-
var
|
|
771
|
+
var _a2, _b2;
|
|
772
772
|
const { reference = "triangle", maxTriangles = 2e6 } = options;
|
|
773
773
|
const referenceMesh = typeof reference === "object" ? reference : null;
|
|
774
774
|
const validShape = (input) => input.indices.length % 3 === 0 && input.gridCoordinates.length % 2 === 0;
|
|
@@ -809,13 +809,13 @@ function certifyTerrainMeshCoverage(field, mesh, options = {}) {
|
|
|
809
809
|
return id;
|
|
810
810
|
}
|
|
811
811
|
function edge2(a, b, weight) {
|
|
812
|
-
var
|
|
812
|
+
var _a3;
|
|
813
813
|
if (a > b) {
|
|
814
814
|
[a, b] = [b, a];
|
|
815
815
|
weight = -weight;
|
|
816
816
|
}
|
|
817
817
|
const key3 = b < 2 ** 26 ? a * 2 ** 26 + b : `${a},${b}`;
|
|
818
|
-
const sum = (((
|
|
818
|
+
const sum = (((_a3 = edges.get(key3)) == null ? void 0 : _a3.weight) ?? 0) + weight;
|
|
819
819
|
if (sum === 0)
|
|
820
820
|
edges.delete(key3);
|
|
821
821
|
else
|
|
@@ -899,7 +899,7 @@ function certifyTerrainMeshCoverage(field, mesh, options = {}) {
|
|
|
899
899
|
}
|
|
900
900
|
const axis = dx === 0n ? 1 : 0;
|
|
901
901
|
const delta = weight;
|
|
902
|
-
events.set(p[axis], { point: p, delta: (((
|
|
902
|
+
events.set(p[axis], { point: p, delta: (((_a2 = events.get(p[axis])) == null ? void 0 : _a2.delta) ?? 0) + delta });
|
|
903
903
|
events.set(q[axis], { point: q, delta: (((_b2 = events.get(q[axis])) == null ? void 0 : _b2.delta) ?? 0) - delta });
|
|
904
904
|
}
|
|
905
905
|
let unmatchedSegments = 0;
|
|
@@ -931,7 +931,7 @@ var init_mesh_coverage = __esm({
|
|
|
931
931
|
// dist/maps/layout.js
|
|
932
932
|
function getMapLayout(map, options = {}) {
|
|
933
933
|
const regions2 = map.regions.map((region) => {
|
|
934
|
-
var
|
|
934
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
935
935
|
const outlines = map.getRegionOutlines(region.id, options).map((p) => Object.freeze(p.map((point) => Object.freeze([...point]))));
|
|
936
936
|
const points = outlines.flat();
|
|
937
937
|
const interior = map.projectPoint(region.interior, region.id);
|
|
@@ -941,7 +941,7 @@ function getMapLayout(map, options = {}) {
|
|
|
941
941
|
throw new Error(`Cannot measure region ${region.id}`);
|
|
942
942
|
return Object.freeze({
|
|
943
943
|
id: region.id,
|
|
944
|
-
label: ((
|
|
944
|
+
label: ((_a2 = region.layout) == null ? void 0 : _a2.label) ?? region.id,
|
|
945
945
|
kind: ((_b2 = region.layout) == null ? void 0 : _b2.kind) ?? "panel",
|
|
946
946
|
parentId: (_c = region.layout) == null ? void 0 : _c.parentId,
|
|
947
947
|
relativeScale: (_d = region.layout) == null ? void 0 : _d.relativeScale,
|
|
@@ -1129,7 +1129,7 @@ var init_map_engine = __esm({
|
|
|
1129
1129
|
* Rebind custom chart functions locally. Myriahedral setup and sampled bounds are reused.
|
|
1130
1130
|
*/
|
|
1131
1131
|
static fromPrepared(prepared, options) {
|
|
1132
|
-
var
|
|
1132
|
+
var _a2;
|
|
1133
1133
|
if (!prepared.motion) {
|
|
1134
1134
|
const map2 = new _MapEngine(prepared.description, { ...options, sampling: prepared.sampling });
|
|
1135
1135
|
map2.cachedLayout = prepared.layout;
|
|
@@ -1141,7 +1141,7 @@ var init_map_engine = __esm({
|
|
|
1141
1141
|
if (!(preset2 == null ? void 0 : preset2.restore))
|
|
1142
1142
|
throw new Error("Missing prepared-map restoration preset");
|
|
1143
1143
|
const restored = preset2.restore(prepared.motion);
|
|
1144
|
-
Object.assign(restored, { polygonClipping: (
|
|
1144
|
+
Object.assign(restored, { polygonClipping: (_a2 = options.geometry) == null ? void 0 : _a2.polygonClipping });
|
|
1145
1145
|
const motion = restored.layout;
|
|
1146
1146
|
const map = Object.create(_MapEngine.prototype);
|
|
1147
1147
|
Object.assign(map, {
|
|
@@ -1157,7 +1157,7 @@ var init_map_engine = __esm({
|
|
|
1157
1157
|
return map;
|
|
1158
1158
|
}
|
|
1159
1159
|
constructor(description, options) {
|
|
1160
|
-
var
|
|
1160
|
+
var _a2, _b2;
|
|
1161
1161
|
this.description = snapshot(description);
|
|
1162
1162
|
if (description.version !== 1 || typeof description.id !== "string" || !description.id)
|
|
1163
1163
|
throw new Error("Expected MapDescription version 1 and a nonempty id");
|
|
@@ -1166,7 +1166,7 @@ var init_map_engine = __esm({
|
|
|
1166
1166
|
throw new Error("Radius must be finite and positive");
|
|
1167
1167
|
this.sampling = { ...options.sampling };
|
|
1168
1168
|
const d = this.description.definition;
|
|
1169
|
-
const preset2 = (
|
|
1169
|
+
const preset2 = (_a2 = options.presets) == null ? void 0 : _a2.find((p) => p.type === d.type);
|
|
1170
1170
|
if (!preset2)
|
|
1171
1171
|
throw new Error("Missing map preset: " + d.type);
|
|
1172
1172
|
this.map = preset2.create(d, radius2, options);
|
|
@@ -1188,8 +1188,8 @@ var init_map_engine = __esm({
|
|
|
1188
1188
|
this.capabilities = Object.freeze({
|
|
1189
1189
|
hasCuts: this.seams.some((s) => s.kind === "cut"),
|
|
1190
1190
|
hasInsets: this.regions.some((r) => {
|
|
1191
|
-
var
|
|
1192
|
-
return ((
|
|
1191
|
+
var _a3;
|
|
1192
|
+
return ((_a3 = r.layout) == null ? void 0 : _a3.kind) === "inset";
|
|
1193
1193
|
}),
|
|
1194
1194
|
disjoint: new Set(groups.values()).size > 1,
|
|
1195
1195
|
hinged: Boolean(this.motion),
|
|
@@ -1423,7 +1423,7 @@ var init_map_layout = __esm({
|
|
|
1423
1423
|
this.clipping = value2;
|
|
1424
1424
|
}
|
|
1425
1425
|
constructor(definitions) {
|
|
1426
|
-
var
|
|
1426
|
+
var _a2, _b2;
|
|
1427
1427
|
if (!definitions.length)
|
|
1428
1428
|
throw new Error("At least one map region is required");
|
|
1429
1429
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -1490,7 +1490,7 @@ var init_map_layout = __esm({
|
|
|
1490
1490
|
const byId = new Map(this.regions.map((r) => [r.id, r]));
|
|
1491
1491
|
for (const r of this.regions) {
|
|
1492
1492
|
const visited = /* @__PURE__ */ new Set([r.id]);
|
|
1493
|
-
let parent = (
|
|
1493
|
+
let parent = (_a2 = r.layout) == null ? void 0 : _a2.parentId;
|
|
1494
1494
|
while (parent !== void 0) {
|
|
1495
1495
|
if (!byId.has(parent) || visited.has(parent))
|
|
1496
1496
|
throw new Error("Invalid region parent hierarchy");
|
|
@@ -1583,8 +1583,8 @@ var init_map_layout = __esm({
|
|
|
1583
1583
|
if (isEndpoint && angle(p, endpoint) < 1e-12)
|
|
1584
1584
|
return "source-endpoint";
|
|
1585
1585
|
const kinds = r.normals.map((normal, edge2) => {
|
|
1586
|
-
var
|
|
1587
|
-
return Math.abs(dot(normal, p)) < 1e-9 ? (
|
|
1586
|
+
var _a2;
|
|
1587
|
+
return Math.abs(dot(normal, p)) < 1e-9 ? (_a2 = this.seams.find((s) => s.regions.some((id, i2) => id === r.definition.id && s.edges[i2] === edge2))) == null ? void 0 : _a2.kind : void 0;
|
|
1588
1588
|
}).filter(Boolean);
|
|
1589
1589
|
return kinds.includes("boundary") ? "coverage-boundary" : kinds.includes("cut") ? "chart-cut" : kinds.includes("join") ? "continuous-chart-join" : "coverage-boundary";
|
|
1590
1590
|
};
|
|
@@ -1747,8 +1747,8 @@ var init_map_layout = __esm({
|
|
|
1747
1747
|
};
|
|
1748
1748
|
}
|
|
1749
1749
|
const kinds = r.normals.map((n, edge2) => {
|
|
1750
|
-
var
|
|
1751
|
-
return [a, b].every((p) => Math.abs(dot(n, p)) < 1e-9) ? (
|
|
1750
|
+
var _a2;
|
|
1751
|
+
return [a, b].every((p) => Math.abs(dot(n, p)) < 1e-9) ? (_a2 = this.seams.find((s) => s.regions.some((id, i) => id === r.definition.id && s.edges[i] === edge2))) == null ? void 0 : _a2.kind : void 0;
|
|
1752
1752
|
}).filter(Boolean);
|
|
1753
1753
|
if (!kinds.length)
|
|
1754
1754
|
throw new Error("Unknown polygon clipping constraint");
|
|
@@ -2725,12 +2725,12 @@ function tracePolygonConstraints(input, output, tolerance = 1e-10, priorities, a
|
|
|
2725
2725
|
if (exact.length)
|
|
2726
2726
|
candidates = exact;
|
|
2727
2727
|
if (candidates.some((c) => {
|
|
2728
|
-
var
|
|
2729
|
-
return ((_b2 = (
|
|
2728
|
+
var _a2, _b2;
|
|
2729
|
+
return ((_b2 = (_a2 = priorities == null ? void 0 : priorities[c.r]) == null ? void 0 : _a2[c.i]) == null ? void 0 : _b2.kind) === "source-boundary";
|
|
2730
2730
|
}))
|
|
2731
2731
|
candidates = candidates.filter((c) => {
|
|
2732
|
-
var
|
|
2733
|
-
return ((_b2 = (
|
|
2732
|
+
var _a2, _b2;
|
|
2733
|
+
return ((_b2 = (_a2 = priorities == null ? void 0 : priorities[c.r]) == null ? void 0 : _a2[c.i]) == null ? void 0 : _b2.kind) === "source-boundary";
|
|
2734
2734
|
});
|
|
2735
2735
|
if (candidates.length > 1) {
|
|
2736
2736
|
const score = (c) => Math.max(...[a, b].map((p) => {
|
|
@@ -4944,9 +4944,9 @@ function lazy(factory) {
|
|
|
4944
4944
|
return kernel2(x, y);
|
|
4945
4945
|
};
|
|
4946
4946
|
forward33.invert = (x, y) => {
|
|
4947
|
-
var
|
|
4947
|
+
var _a2;
|
|
4948
4948
|
kernel2 ?? (kernel2 = factory());
|
|
4949
|
-
return (
|
|
4949
|
+
return (_a2 = kernel2.invert) == null ? void 0 : _a2.call(kernel2, x, y);
|
|
4950
4950
|
};
|
|
4951
4951
|
return forward33;
|
|
4952
4952
|
}
|
|
@@ -5226,14 +5226,14 @@ function createKernelMap({ kernel: kernel2, radius: radius2 = 1, centralMeridian
|
|
|
5226
5226
|
const inside = (p) => (p == null ? void 0 : p.length) === 2 && p.every(Number.isFinite) && p[0] >= west - 1e-9 && p[0] <= east + 1e-9 && p[1] >= south - 1e-9 && p[1] <= north + 1e-9 && (!clipAngle || Math.cos(p[0]) * Math.cos(p[1]) >= Math.cos(cap2) - 1e-12);
|
|
5227
5227
|
const error = (p, target) => Math.hypot(p[0] - target[0], p[1] - target[1]);
|
|
5228
5228
|
const invert = (target) => {
|
|
5229
|
-
var
|
|
5229
|
+
var _a2;
|
|
5230
5230
|
const pole = sign5 * HALF, left = raw(west, pole), right = raw(east, pole);
|
|
5231
5231
|
const dx = right[0] - left[0], dy = right[1] - left[1], length = dx * dx + dy * dy;
|
|
5232
5232
|
const fraction = length ? clamp(((target[0] - left[0]) * dx + (target[1] - left[1]) * dy) / length, 0, 1) : 0.5;
|
|
5233
5233
|
const poleLambda = west + fraction * (east - west);
|
|
5234
5234
|
if (inside([poleLambda, pole]) && error(raw(poleLambda, pole), target) < 1e-13)
|
|
5235
5235
|
return [poleLambda, pole];
|
|
5236
|
-
const candidate = (
|
|
5236
|
+
const candidate = (_a2 = raw.invert) == null ? void 0 : _a2.call(raw, target[0], target[1]);
|
|
5237
5237
|
if (candidate && inside(candidate) && error(raw(candidate[0], candidate[1]), target) < 1e-10)
|
|
5238
5238
|
return [clamp(candidate[0], west, east), clamp(candidate[1], south, north)];
|
|
5239
5239
|
const ordered2 = seeds.map((p, j) => ({ p, error: error(projectedSeeds[j], target) })).filter((s) => Number.isFinite(s.error) && inside(s.p) && Math.abs(s.p[1]) < HALF - 1e-10).sort((a, b) => a.error - b.error);
|
|
@@ -5711,9 +5711,9 @@ var init_map = __esm({
|
|
|
5711
5711
|
splitter = Object.assign(createKernelMap({ kernel, radius: 1 / RAD }), { polygonClipping: import_polygon_clipping.default });
|
|
5712
5712
|
ElasticMap = class {
|
|
5713
5713
|
constructor(data, radius2) {
|
|
5714
|
-
var
|
|
5714
|
+
var _a2;
|
|
5715
5715
|
this.charts = [];
|
|
5716
|
-
if (data.version !== 1 || typeof data.name !== "string" || !data.name || !Number.isFinite(data.radius) || data.radius <= 0 || !Number.isFinite(radius2) || radius2 <= 0 || !((
|
|
5716
|
+
if (data.version !== 1 || typeof data.name !== "string" || !data.name || !Number.isFinite(data.radius) || data.radius <= 0 || !Number.isFinite(radius2) || radius2 <= 0 || !((_a2 = data.sections) == null ? void 0 : _a2.length) || data.sections.length > 64)
|
|
5717
5717
|
throw new Error("Invalid Elastic dataset");
|
|
5718
5718
|
const ids = /* @__PURE__ */ new Set();
|
|
5719
5719
|
for (const section2 of data.sections) {
|
|
@@ -6533,7 +6533,7 @@ function interruptedMap(kind, value2, goode = false, layout = "default", central
|
|
|
6533
6533
|
return new DiscontinuousMap(regions2);
|
|
6534
6534
|
}
|
|
6535
6535
|
function createInterruptedMap(options) {
|
|
6536
|
-
var
|
|
6536
|
+
var _a2, _b2;
|
|
6537
6537
|
if (![
|
|
6538
6538
|
"sinusoidal",
|
|
6539
6539
|
"mollweide",
|
|
@@ -6549,7 +6549,7 @@ function createInterruptedMap(options) {
|
|
|
6549
6549
|
const centralMeridian = options.centralMeridian ?? 0;
|
|
6550
6550
|
if (!Number.isFinite(centralMeridian))
|
|
6551
6551
|
throw new Error("Expected finite centralMeridian");
|
|
6552
|
-
for (const hemisphere of [(
|
|
6552
|
+
for (const hemisphere of [(_a2 = options.lobes) == null ? void 0 : _a2.north, (_b2 = options.lobes) == null ? void 0 : _b2.south]) {
|
|
6553
6553
|
if (!Array.isArray(hemisphere) || !hemisphere.length)
|
|
6554
6554
|
throw new Error("Expected nonempty north and south lobe arrays");
|
|
6555
6555
|
let edge2 = -180;
|
|
@@ -7482,7 +7482,7 @@ var init_wiechel = __esm({
|
|
|
7482
7482
|
|
|
7483
7483
|
// dist/maps/regional-map.js
|
|
7484
7484
|
function createRegionalMap(options) {
|
|
7485
|
-
var
|
|
7485
|
+
var _a2;
|
|
7486
7486
|
const { projection, radius: radius2 = 1 } = options;
|
|
7487
7487
|
if (!Number.isFinite(radius2) || radius2 <= 0)
|
|
7488
7488
|
throw new Error("Expected positive finite radius");
|
|
@@ -7522,7 +7522,7 @@ function createRegionalMap(options) {
|
|
|
7522
7522
|
"two-point-equidistant": ["controlPoints"]
|
|
7523
7523
|
};
|
|
7524
7524
|
for (const key3 of Object.keys(options))
|
|
7525
|
-
if (!["projection", "radius", "type"].includes(key3) && !((
|
|
7525
|
+
if (!["projection", "radius", "type"].includes(key3) && !((_a2 = allowed[projection]) == null ? void 0 : _a2.includes(key3)))
|
|
7526
7526
|
throw new Error(`Unsupported ${projection} option: ${key3}`);
|
|
7527
7527
|
const value2 = (key3, fallback, low, high) => {
|
|
7528
7528
|
const n = options[key3] ?? fallback;
|
|
@@ -8725,7 +8725,7 @@ function restoreLayout(data) {
|
|
|
8725
8725
|
const { mesh, panels, targetAngles } = data;
|
|
8726
8726
|
if (panels.length !== mesh.faces.length || targetAngles.length !== panels.length || !targetAngles.every(Number.isFinite) || data.rootTransform.length !== 16 || !data.rootTransform.every(Number.isFinite))
|
|
8727
8727
|
throw new Error("Invalid prepared hinge layout");
|
|
8728
|
-
const tree = new
|
|
8728
|
+
const tree = new import_primitives.HingeTree(panels);
|
|
8729
8729
|
const rootTransform = new import_matrix2.Matrix4(data.rootTransform);
|
|
8730
8730
|
const poses = new Float64Array(panels.length * 16), angles = new Float64Array(panels.length);
|
|
8731
8731
|
const evaluate2 = (amount) => {
|
|
@@ -8768,11 +8768,11 @@ function countOverlaps(faces) {
|
|
|
8768
8768
|
}
|
|
8769
8769
|
return count;
|
|
8770
8770
|
}
|
|
8771
|
-
var import_matrix2,
|
|
8771
|
+
var import_matrix2, import_primitives;
|
|
8772
8772
|
var init_unfold = __esm({
|
|
8773
8773
|
"dist/maps/myriahedral/unfold.js"() {
|
|
8774
8774
|
import_matrix2 = require("@math.gl/core/matrix");
|
|
8775
|
-
|
|
8775
|
+
import_primitives = require("@math.gl/geometry/primitives");
|
|
8776
8776
|
init_mesh();
|
|
8777
8777
|
}
|
|
8778
8778
|
});
|
|
@@ -8916,8 +8916,8 @@ function regions(layout) {
|
|
|
8916
8916
|
});
|
|
8917
8917
|
}
|
|
8918
8918
|
function snapshotMesh(input) {
|
|
8919
|
-
var
|
|
8920
|
-
if (!((
|
|
8919
|
+
var _a2, _b2;
|
|
8920
|
+
if (!((_a2 = input.vertices) == null ? void 0 : _a2.length) || !((_b2 = input.faces) == null ? void 0 : _b2.length) || input.faces.length > 2e4)
|
|
8921
8921
|
throw new Error("Expected a nonempty mesh with at most 20000 panels");
|
|
8922
8922
|
const mesh = {
|
|
8923
8923
|
vertices: input.vertices.map((v) => [...v]),
|
|
@@ -9428,8 +9428,8 @@ var init_presets = __esm({
|
|
|
9428
9428
|
create(definition, radius2, options) {
|
|
9429
9429
|
const d = definition;
|
|
9430
9430
|
return new DiscontinuousMap(d.charts.map((chart) => {
|
|
9431
|
-
var
|
|
9432
|
-
const projection = (
|
|
9431
|
+
var _a2, _b2;
|
|
9432
|
+
const projection = (_a2 = options.projections) == null ? void 0 : _a2[chart.projection];
|
|
9433
9433
|
if (!projection)
|
|
9434
9434
|
throw new Error(`Missing projection binding: ${chart.projection}`);
|
|
9435
9435
|
const placement = (chart.placement ?? [1, 0, 0, 1, 0, 0]).map((v) => v * radius2);
|
|
@@ -9807,7 +9807,7 @@ function prepareMapFeatures(map, features, options = {}) {
|
|
|
9807
9807
|
}
|
|
9808
9808
|
};
|
|
9809
9809
|
const addPolygon = (input, featureIndex, geometryPath) => {
|
|
9810
|
-
var
|
|
9810
|
+
var _a2;
|
|
9811
9811
|
if (!input.length)
|
|
9812
9812
|
return;
|
|
9813
9813
|
const rings = input.map((r) => r.map(position));
|
|
@@ -9822,7 +9822,7 @@ function prepareMapFeatures(map, features, options = {}) {
|
|
|
9822
9822
|
for (const p of parts) {
|
|
9823
9823
|
for (let i = 0; i < p.coordinates.length; i++) {
|
|
9824
9824
|
if (provenance == null ? void 0 : provenance.polygonEdges) {
|
|
9825
|
-
const edges = (
|
|
9825
|
+
const edges = (_a2 = p.edgeProvenance) == null ? void 0 : _a2[i];
|
|
9826
9826
|
if (!edges)
|
|
9827
9827
|
throw new Error("Map backend does not support polygon edge provenance");
|
|
9828
9828
|
const kinds = [
|
|
@@ -9962,2807 +9962,12 @@ var init_geometry2 = __esm({
|
|
|
9962
9962
|
}
|
|
9963
9963
|
});
|
|
9964
9964
|
|
|
9965
|
-
// dist/maps/map-transition.js
|
|
9966
|
-
function placed(region, p) {
|
|
9967
|
-
const q = region.project(p), [a, b, c, d, x, y] = region.placement ?? [1, 0, 0, 1, 0, 0];
|
|
9968
|
-
const result = [a * q[0] + c * q[1] + x, b * q[0] + d * q[1] + y];
|
|
9969
|
-
if (!result.every(Number.isFinite))
|
|
9970
|
-
throw new Error("Undefined projection in common transition coverage");
|
|
9971
|
-
return result;
|
|
9972
|
-
}
|
|
9973
|
-
function freezeRings(rings) {
|
|
9974
|
-
return Object.freeze(rings.map((r) => Object.freeze(r.map((p) => Object.freeze([...p])))));
|
|
9975
|
-
}
|
|
9976
|
-
function validateAmount(t) {
|
|
9977
|
-
if (!Number.isFinite(t) || t < 0 || t > 1)
|
|
9978
|
-
throw new Error("Transition amount must be within [0,1]");
|
|
9979
|
-
}
|
|
9980
|
-
function fullCoverage(map) {
|
|
9981
|
-
const cached = coverageCache.get(map);
|
|
9982
|
-
if (cached !== void 0)
|
|
9983
|
-
return cached;
|
|
9984
|
-
const d = map.description.definition;
|
|
9985
|
-
let covered = false;
|
|
9986
|
-
if (d.type === "elastic") {
|
|
9987
|
-
const world = rectangle(-180, -90, 180, 90);
|
|
9988
|
-
let completeSections = true;
|
|
9989
|
-
const domains = d.data.sections.map((s) => {
|
|
9990
|
-
const domain = s.complement ? import_polygon_clipping4.default.difference(world, [s.boundary]) : import_polygon_clipping4.default.intersection(world, [s.boundary]);
|
|
9991
|
-
const runs = [];
|
|
9992
|
-
for (let y = 0; y < s.rows - 1; y++) {
|
|
9993
|
-
let start = -1;
|
|
9994
|
-
for (let x = 0; x < s.columns; x++) {
|
|
9995
|
-
const valid2 = x < s.columns - 1 && [
|
|
9996
|
-
y * s.columns + x,
|
|
9997
|
-
y * s.columns + x + 1,
|
|
9998
|
-
(y + 1) * s.columns + x,
|
|
9999
|
-
(y + 1) * s.columns + x + 1
|
|
10000
|
-
].every((i) => s.values[2 * i] !== null);
|
|
10001
|
-
if (valid2 && start < 0)
|
|
10002
|
-
start = x;
|
|
10003
|
-
if (!valid2 && start >= 0) {
|
|
10004
|
-
runs.push(rectangle(-180 + 360 * start / (s.columns - 1), -90 + 180 * y / (s.rows - 1), -180 + 360 * x / (s.columns - 1), -90 + 180 * (y + 1) / (s.rows - 1)));
|
|
10005
|
-
start = -1;
|
|
10006
|
-
}
|
|
10007
|
-
}
|
|
10008
|
-
}
|
|
10009
|
-
const valid = runs.length ? import_polygon_clipping4.default.union(runs[0], ...runs.slice(1)) : [];
|
|
10010
|
-
if (!valid.length || import_polygon_clipping4.default.difference(domain, valid).length)
|
|
10011
|
-
completeSections = false;
|
|
10012
|
-
return valid.length ? import_polygon_clipping4.default.intersection(domain, valid) : [];
|
|
10013
|
-
});
|
|
10014
|
-
const overlaps2 = domains.some((domain, i) => domains.slice(i + 1).some((other) => import_polygon_clipping4.default.intersection(domain, other).length > 0));
|
|
10015
|
-
covered = completeSections && !overlaps2 && import_polygon_clipping4.default.difference(world, ...domains).length === 0;
|
|
10016
|
-
} else if (d.type === "world") {
|
|
10017
|
-
covered = directWorldProjections.has(d.projection) && Object.keys(d.parameters ?? {}).length === 0;
|
|
10018
|
-
}
|
|
10019
|
-
coverageCache.set(map, covered);
|
|
10020
|
-
return covered;
|
|
10021
|
-
}
|
|
10022
|
-
function geographicRings(rings, center3) {
|
|
10023
|
-
return rings.map((ring) => {
|
|
10024
|
-
let previous = center3 ?? ring[0][0];
|
|
10025
|
-
return ring.map(([lon, lat]) => {
|
|
10026
|
-
const x = lon + 360 * Math.round((previous - lon) / 360);
|
|
10027
|
-
previous = x;
|
|
10028
|
-
return [Math.round(x * 1e9) / 1e9, Math.round(lat * 1e9) / 1e9];
|
|
10029
|
-
});
|
|
10030
|
-
});
|
|
10031
|
-
}
|
|
10032
|
-
var import_polygon_clipping4, directWorldProjections, MapTransitionGeometry, MapTransition, coverageCache;
|
|
10033
|
-
var init_map_transition = __esm({
|
|
10034
|
-
"dist/maps/map-transition.js"() {
|
|
10035
|
-
import_polygon_clipping4 = __toESM(require("polygon-clipping"), 1);
|
|
10036
|
-
init_math();
|
|
10037
|
-
init_geometry();
|
|
10038
|
-
directWorldProjections = /* @__PURE__ */ new Set([
|
|
10039
|
-
"gilbert",
|
|
10040
|
-
"aitoff",
|
|
10041
|
-
"august",
|
|
10042
|
-
"baker",
|
|
10043
|
-
"boggs",
|
|
10044
|
-
"bromley",
|
|
10045
|
-
"collignon",
|
|
10046
|
-
"craster",
|
|
10047
|
-
"eckert1",
|
|
10048
|
-
"eckert2",
|
|
10049
|
-
"eckert3",
|
|
10050
|
-
"eckert4",
|
|
10051
|
-
"eckert5",
|
|
10052
|
-
"eckert6",
|
|
10053
|
-
"fahey",
|
|
10054
|
-
"foucaut",
|
|
10055
|
-
"ginzburg4",
|
|
10056
|
-
"ginzburg5",
|
|
10057
|
-
"ginzburg6",
|
|
10058
|
-
"ginzburg8",
|
|
10059
|
-
"ginzburg9",
|
|
10060
|
-
"homolosine",
|
|
10061
|
-
"kavrayskiy7",
|
|
10062
|
-
"larrivee",
|
|
10063
|
-
"laskowski",
|
|
10064
|
-
"miller",
|
|
10065
|
-
"mollweide",
|
|
10066
|
-
"mt-flat-polar-parabolic",
|
|
10067
|
-
"mt-flat-polar-quartic",
|
|
10068
|
-
"mt-flat-polar-sinusoidal",
|
|
10069
|
-
"natural-earth2",
|
|
10070
|
-
"nell-hammer",
|
|
10071
|
-
"patterson",
|
|
10072
|
-
"robinson",
|
|
10073
|
-
"sinusoidal",
|
|
10074
|
-
"times",
|
|
10075
|
-
"van-der-grinten",
|
|
10076
|
-
"van-der-grinten2",
|
|
10077
|
-
"van-der-grinten3",
|
|
10078
|
-
"van-der-grinten4",
|
|
10079
|
-
"wagner4",
|
|
10080
|
-
"wagner6",
|
|
10081
|
-
"winkel3",
|
|
10082
|
-
"bonne",
|
|
10083
|
-
"bottomley",
|
|
10084
|
-
"cylindrical-equal-area",
|
|
10085
|
-
"cylindrical-stereographic",
|
|
10086
|
-
"foucaut-sinusoidal",
|
|
10087
|
-
"hammer",
|
|
10088
|
-
"hill",
|
|
10089
|
-
"hufnagel",
|
|
10090
|
-
"hyperelliptical",
|
|
10091
|
-
"lagrange",
|
|
10092
|
-
"loximuthal",
|
|
10093
|
-
"wagner7",
|
|
10094
|
-
"quartic-authalic",
|
|
10095
|
-
"wagner"
|
|
10096
|
-
]);
|
|
10097
|
-
MapTransitionGeometry = class {
|
|
10098
|
-
constructor(parts, strategy, radius2) {
|
|
10099
|
-
this.strategy = strategy;
|
|
10100
|
-
this.radius = radius2;
|
|
10101
|
-
this.parts = Object.freeze(parts.map((p) => Object.freeze({
|
|
10102
|
-
...p,
|
|
10103
|
-
sourceCoordinates: freezeRings(p.sourceCoordinates),
|
|
10104
|
-
from: freezeRings(p.from),
|
|
10105
|
-
to: freezeRings(p.to)
|
|
10106
|
-
})));
|
|
10107
|
-
}
|
|
10108
|
-
evaluate(amount) {
|
|
10109
|
-
validateAmount(amount);
|
|
10110
|
-
return this.parts.flatMap((part) => {
|
|
10111
|
-
const sourcePhase = part.sourceRegionId !== void 0;
|
|
10112
|
-
const blend = Math.max(0, Math.min(1, (amount - 0.4) / 0.2));
|
|
10113
|
-
const opacity = this.strategy === "direct" ? 1 : sourcePhase ? 1 - blend : blend;
|
|
10114
|
-
if (!opacity)
|
|
10115
|
-
return [];
|
|
10116
|
-
const t = this.strategy === "direct" ? amount : sourcePhase ? Math.min(1, amount / 0.4) : Math.max(0, (amount - 0.6) / 0.4);
|
|
10117
|
-
return [
|
|
10118
|
-
{
|
|
10119
|
-
kind: part.kind,
|
|
10120
|
-
sourceRegionId: part.sourceRegionId,
|
|
10121
|
-
targetRegionId: part.targetRegionId,
|
|
10122
|
-
opacity,
|
|
10123
|
-
coordinates: part.sourceCoordinates.map((ring, j) => ring.map((p, i) => {
|
|
10124
|
-
const a = part.from[j][i], b = part.to[j][i];
|
|
10125
|
-
if (this.strategy === "direct")
|
|
10126
|
-
return [a[0] * (1 - t) + b[0] * t, a[1] * (1 - t) + b[1] * t, 0];
|
|
10127
|
-
const globe = geographic(p).map((v) => v * this.radius);
|
|
10128
|
-
const flat = sourcePhase ? a : b, weight = sourcePhase ? 1 - t : t;
|
|
10129
|
-
return [
|
|
10130
|
-
flat[0] * weight + globe[0] * (1 - weight),
|
|
10131
|
-
flat[1] * weight + globe[1] * (1 - weight),
|
|
10132
|
-
globe[2] * (1 - weight)
|
|
10133
|
-
];
|
|
10134
|
-
}))
|
|
10135
|
-
}
|
|
10136
|
-
];
|
|
10137
|
-
});
|
|
10138
|
-
}
|
|
10139
|
-
};
|
|
10140
|
-
MapTransition = class {
|
|
10141
|
-
constructor(source, target, options = {}) {
|
|
10142
|
-
this.source = source;
|
|
10143
|
-
this.target = target;
|
|
10144
|
-
const requested = options.strategy ?? "auto";
|
|
10145
|
-
if (!["auto", "direct", "via-globe"].includes(requested))
|
|
10146
|
-
throw new Error("Unknown transition strategy");
|
|
10147
|
-
const compatible = source === target || fullCoverage(source) && fullCoverage(target);
|
|
10148
|
-
if (requested === "direct" && !compatible)
|
|
10149
|
-
throw new Error("Direct morph requires complete supported geographic coverage; use auto or via-globe");
|
|
10150
|
-
this.strategy = requested === "via-globe" ? "via-globe" : compatible ? "direct" : "via-globe";
|
|
10151
|
-
this.reason = this.strategy === "direct" ? "Geometry is refined against both maps before interpolating corresponding geographic positions." : "Coverage or surface topology requires separate source and destination geometry through the globe.";
|
|
10152
|
-
}
|
|
10153
|
-
projectPoint(position2, amount) {
|
|
10154
|
-
validateAmount(amount);
|
|
10155
|
-
const a = this.source.projectPoint(position2), b = this.target.projectPoint(position2);
|
|
10156
|
-
if (this.strategy === "direct")
|
|
10157
|
-
return a && b ? [
|
|
10158
|
-
a.position[0] * (1 - amount) + b.position[0] * amount,
|
|
10159
|
-
a.position[1] * (1 - amount) + b.position[1] * amount,
|
|
10160
|
-
0
|
|
10161
|
-
] : null;
|
|
10162
|
-
const hit = amount < 0.5 ? a : b;
|
|
10163
|
-
if (!hit)
|
|
10164
|
-
return null;
|
|
10165
|
-
const t = amount < 0.5 ? Math.max(0, 1 - amount / 0.4) : Math.max(0, (amount - 0.6) / 0.4);
|
|
10166
|
-
const globe = geographic(position2).map((v) => v * this.globeRadius);
|
|
10167
|
-
return [
|
|
10168
|
-
hit.position[0] * t + globe[0] * (1 - t),
|
|
10169
|
-
hit.position[1] * t + globe[1] * (1 - t),
|
|
10170
|
-
globe[2] * (1 - t)
|
|
10171
|
-
];
|
|
10172
|
-
}
|
|
10173
|
-
get globeRadius() {
|
|
10174
|
-
return Math.max(this.source.description.radius ?? 1, this.target.description.radius ?? 1);
|
|
10175
|
-
}
|
|
10176
|
-
prepareLine(line, options) {
|
|
10177
|
-
const first = this.source.projectLine(line, options), last = this.target.projectLine(line, options);
|
|
10178
|
-
const parts = [];
|
|
10179
|
-
if (this.strategy === "direct" && this.source === this.target) {
|
|
10180
|
-
for (const p of first)
|
|
10181
|
-
parts.push({
|
|
10182
|
-
kind: "line",
|
|
10183
|
-
sourceRegionId: p.regionId,
|
|
10184
|
-
targetRegionId: p.regionId,
|
|
10185
|
-
sourceCoordinates: [p.sourceCoordinates],
|
|
10186
|
-
from: [p.coordinates],
|
|
10187
|
-
to: [p.coordinates]
|
|
10188
|
-
});
|
|
10189
|
-
} else if (this.strategy === "direct") {
|
|
10190
|
-
for (const a of first)
|
|
10191
|
-
for (const b of this.target.projectLine(a.sourceCoordinates, options)) {
|
|
10192
|
-
const source = this.source.regions.find((r) => r.id === a.regionId);
|
|
10193
|
-
parts.push({
|
|
10194
|
-
kind: "line",
|
|
10195
|
-
sourceRegionId: a.regionId,
|
|
10196
|
-
targetRegionId: b.regionId,
|
|
10197
|
-
sourceCoordinates: [b.sourceCoordinates],
|
|
10198
|
-
from: [b.sourceCoordinates.map((p) => placed(source, p))],
|
|
10199
|
-
to: [b.coordinates]
|
|
10200
|
-
});
|
|
10201
|
-
}
|
|
10202
|
-
} else {
|
|
10203
|
-
for (const p of first)
|
|
10204
|
-
parts.push({
|
|
10205
|
-
kind: "line",
|
|
10206
|
-
sourceRegionId: p.regionId,
|
|
10207
|
-
sourceCoordinates: [p.sourceCoordinates],
|
|
10208
|
-
from: [p.coordinates],
|
|
10209
|
-
to: [p.coordinates]
|
|
10210
|
-
});
|
|
10211
|
-
for (const p of last)
|
|
10212
|
-
parts.push({
|
|
10213
|
-
kind: "line",
|
|
10214
|
-
targetRegionId: p.regionId,
|
|
10215
|
-
sourceCoordinates: [p.sourceCoordinates],
|
|
10216
|
-
from: [p.coordinates],
|
|
10217
|
-
to: [p.coordinates]
|
|
10218
|
-
});
|
|
10219
|
-
}
|
|
10220
|
-
return new MapTransitionGeometry(parts, this.strategy, this.globeRadius);
|
|
10221
|
-
}
|
|
10222
|
-
preparePolygon(rings, options) {
|
|
10223
|
-
const first = this.source.projectPolygon(rings, options), last = this.target.projectPolygon(rings, options), parts = [];
|
|
10224
|
-
if (this.strategy === "direct" && this.source === this.target) {
|
|
10225
|
-
for (const p of first)
|
|
10226
|
-
parts.push({
|
|
10227
|
-
kind: "polygon",
|
|
10228
|
-
sourceRegionId: p.regionId,
|
|
10229
|
-
targetRegionId: p.regionId,
|
|
10230
|
-
sourceCoordinates: p.sourceCoordinates,
|
|
10231
|
-
from: p.coordinates,
|
|
10232
|
-
to: p.coordinates
|
|
10233
|
-
});
|
|
10234
|
-
} else if (this.strategy === "direct") {
|
|
10235
|
-
for (const a of first) {
|
|
10236
|
-
const source = this.source.regions.find((r) => r.id === a.regionId);
|
|
10237
|
-
const left = geographicRings(a.sourceCoordinates);
|
|
10238
|
-
const center3 = left[0][0][0];
|
|
10239
|
-
for (const b of last) {
|
|
10240
|
-
const target = this.target.regions.find((r) => r.id === b.regionId);
|
|
10241
|
-
const right = geographicRings(b.sourceCoordinates, center3);
|
|
10242
|
-
for (const rings2 of import_polygon_clipping4.default.intersection(left, right)) {
|
|
10243
|
-
const coordinates2 = rings2;
|
|
10244
|
-
parts.push({
|
|
10245
|
-
kind: "polygon",
|
|
10246
|
-
sourceRegionId: a.regionId,
|
|
10247
|
-
targetRegionId: b.regionId,
|
|
10248
|
-
sourceCoordinates: coordinates2,
|
|
10249
|
-
from: coordinates2.map((r) => r.map((p) => placed(source, p))),
|
|
10250
|
-
to: coordinates2.map((r) => r.map((p) => placed(target, p)))
|
|
10251
|
-
});
|
|
10252
|
-
}
|
|
10253
|
-
}
|
|
10254
|
-
}
|
|
10255
|
-
} else {
|
|
10256
|
-
for (const p of first)
|
|
10257
|
-
parts.push({
|
|
10258
|
-
kind: "polygon",
|
|
10259
|
-
sourceRegionId: p.regionId,
|
|
10260
|
-
sourceCoordinates: p.sourceCoordinates,
|
|
10261
|
-
from: p.coordinates,
|
|
10262
|
-
to: p.coordinates
|
|
10263
|
-
});
|
|
10264
|
-
for (const p of last)
|
|
10265
|
-
parts.push({
|
|
10266
|
-
kind: "polygon",
|
|
10267
|
-
targetRegionId: p.regionId,
|
|
10268
|
-
sourceCoordinates: p.sourceCoordinates,
|
|
10269
|
-
from: p.coordinates,
|
|
10270
|
-
to: p.coordinates
|
|
10271
|
-
});
|
|
10272
|
-
}
|
|
10273
|
-
return new MapTransitionGeometry(parts, this.strategy, this.globeRadius);
|
|
10274
|
-
}
|
|
10275
|
-
};
|
|
10276
|
-
coverageCache = /* @__PURE__ */ new WeakMap();
|
|
10277
|
-
}
|
|
10278
|
-
});
|
|
10279
|
-
|
|
10280
9965
|
// dist/maps/transitions.js
|
|
10281
|
-
var mapTransitions;
|
|
9966
|
+
var import_map_transition, mapTransitions;
|
|
10282
9967
|
var init_transitions = __esm({
|
|
10283
9968
|
"dist/maps/transitions.js"() {
|
|
10284
|
-
|
|
10285
|
-
mapTransitions = { MapTransition };
|
|
10286
|
-
}
|
|
10287
|
-
});
|
|
10288
|
-
|
|
10289
|
-
// dist/crs/spatial-reference.js
|
|
10290
|
-
function inferCRSRepresentation(definition) {
|
|
10291
|
-
if (typeof definition === "object") {
|
|
10292
|
-
return "projjson";
|
|
10293
|
-
}
|
|
10294
|
-
const text = definition.trim();
|
|
10295
|
-
if (/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(text)) {
|
|
10296
|
-
return "wkt";
|
|
10297
|
-
}
|
|
10298
|
-
if (/(?:^|\s)\+?proj=/i.test(text)) {
|
|
10299
|
-
return "proj-string";
|
|
10300
|
-
}
|
|
10301
|
-
if (/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(text) || /^urn:ogc:def:crs:/i.test(text) || /^https?:\/\//i.test(text) || /^[A-Z][A-Z0-9._-]*$/i.test(text)) {
|
|
10302
|
-
return "identifier";
|
|
10303
|
-
}
|
|
10304
|
-
return "opaque";
|
|
10305
|
-
}
|
|
10306
|
-
var init_spatial_reference = __esm({
|
|
10307
|
-
"dist/crs/spatial-reference.js"() {
|
|
10308
|
-
}
|
|
10309
|
-
});
|
|
10310
|
-
|
|
10311
|
-
// dist/crs/proj-string.js
|
|
10312
|
-
function parsePROJString(text) {
|
|
10313
|
-
const tokens = tokenizePROJString(text);
|
|
10314
|
-
if (tokens.length === 0) {
|
|
10315
|
-
throw new PROJStringSyntaxError("PROJ string is empty", text, 0);
|
|
10316
|
-
}
|
|
10317
|
-
const parameters = tokens.map((token) => parseParameter(token.raw, token.offset, text));
|
|
10318
|
-
return { type: "proj-string", parameters };
|
|
10319
|
-
}
|
|
10320
|
-
function parseParameter(rawToken, offset, source) {
|
|
10321
|
-
const token = rawToken.startsWith("+") ? rawToken.slice(1) : rawToken;
|
|
10322
|
-
if (!token) {
|
|
10323
|
-
throw new PROJStringSyntaxError("Expected a parameter after '+'", source, offset);
|
|
10324
|
-
}
|
|
10325
|
-
const equalsIndex = token.indexOf("=");
|
|
10326
|
-
const name = equalsIndex < 0 ? token : token.slice(0, equalsIndex);
|
|
10327
|
-
if (!name || /[\s+=]/.test(name)) {
|
|
10328
|
-
throw new PROJStringSyntaxError(`Invalid PROJ parameter name '${name}'`, source, offset);
|
|
10329
|
-
}
|
|
10330
|
-
if (equalsIndex < 0) {
|
|
10331
|
-
return { type: "parameter", name };
|
|
10332
|
-
}
|
|
10333
|
-
const rawValue = token.slice(equalsIndex + 1);
|
|
10334
|
-
const value2 = decodeParameterValue(rawValue, source, offset + equalsIndex + 1);
|
|
10335
|
-
return { type: "parameter", name, value: value2, rawValue };
|
|
10336
|
-
}
|
|
10337
|
-
function tokenizePROJString(source) {
|
|
10338
|
-
const tokens = [];
|
|
10339
|
-
let offset = 0;
|
|
10340
|
-
while (offset < source.length) {
|
|
10341
|
-
while (offset < source.length && /\s/.test(source[offset])) {
|
|
10342
|
-
offset++;
|
|
10343
|
-
}
|
|
10344
|
-
if (offset >= source.length) {
|
|
10345
|
-
break;
|
|
10346
|
-
}
|
|
10347
|
-
const start = offset;
|
|
10348
|
-
let quote = null;
|
|
10349
|
-
let escaped = false;
|
|
10350
|
-
while (offset < source.length) {
|
|
10351
|
-
const character = source[offset];
|
|
10352
|
-
if (escaped) {
|
|
10353
|
-
escaped = false;
|
|
10354
|
-
offset++;
|
|
10355
|
-
continue;
|
|
10356
|
-
}
|
|
10357
|
-
if (character === "\\" && quote) {
|
|
10358
|
-
escaped = true;
|
|
10359
|
-
offset++;
|
|
10360
|
-
continue;
|
|
10361
|
-
}
|
|
10362
|
-
if (quote) {
|
|
10363
|
-
if (character === quote) {
|
|
10364
|
-
quote = null;
|
|
10365
|
-
}
|
|
10366
|
-
offset++;
|
|
10367
|
-
continue;
|
|
10368
|
-
}
|
|
10369
|
-
if ((character === '"' || character === "'") && source[offset - 1] === "=") {
|
|
10370
|
-
quote = character;
|
|
10371
|
-
offset++;
|
|
10372
|
-
continue;
|
|
10373
|
-
}
|
|
10374
|
-
if (/\s/.test(character)) {
|
|
10375
|
-
break;
|
|
10376
|
-
}
|
|
10377
|
-
offset++;
|
|
10378
|
-
}
|
|
10379
|
-
if (quote) {
|
|
10380
|
-
throw new PROJStringSyntaxError("Unterminated quoted PROJ value", source, start);
|
|
10381
|
-
}
|
|
10382
|
-
tokens.push({ raw: source.slice(start, offset), offset: start });
|
|
10383
|
-
}
|
|
10384
|
-
return tokens;
|
|
10385
|
-
}
|
|
10386
|
-
function decodeParameterValue(rawValue, source, offset) {
|
|
10387
|
-
if (!rawValue) {
|
|
10388
|
-
return "";
|
|
10389
|
-
}
|
|
10390
|
-
const first = rawValue[0];
|
|
10391
|
-
if (first !== '"' && first !== "'") {
|
|
10392
|
-
if ((rawValue.includes('"') || rawValue.includes("'")) && !DMS_VALUE.test(rawValue)) {
|
|
10393
|
-
throw new PROJStringSyntaxError("Quote must begin a PROJ parameter value", source, offset);
|
|
10394
|
-
}
|
|
10395
|
-
return rawValue;
|
|
10396
|
-
}
|
|
10397
|
-
if (rawValue[rawValue.length - 1] !== first) {
|
|
10398
|
-
throw new PROJStringSyntaxError("Unterminated quoted PROJ value", source, offset);
|
|
10399
|
-
}
|
|
10400
|
-
let value2 = "";
|
|
10401
|
-
for (let index = 1; index < rawValue.length - 1; index++) {
|
|
10402
|
-
const character = rawValue[index];
|
|
10403
|
-
if (character === "\\" && index + 1 < rawValue.length - 1) {
|
|
10404
|
-
value2 += rawValue[++index];
|
|
10405
|
-
} else {
|
|
10406
|
-
value2 += character;
|
|
10407
|
-
}
|
|
10408
|
-
}
|
|
10409
|
-
return value2;
|
|
10410
|
-
}
|
|
10411
|
-
function getSourceLocation(source, offset) {
|
|
10412
|
-
let line = 1;
|
|
10413
|
-
let column = 1;
|
|
10414
|
-
for (let index = 0; index < offset && index < source.length; index++) {
|
|
10415
|
-
if (source[index] === "\n") {
|
|
10416
|
-
line++;
|
|
10417
|
-
column = 1;
|
|
10418
|
-
} else {
|
|
10419
|
-
column++;
|
|
10420
|
-
}
|
|
10421
|
-
}
|
|
10422
|
-
return { line, column };
|
|
10423
|
-
}
|
|
10424
|
-
var PROJStringSyntaxError, DMS_VALUE;
|
|
10425
|
-
var init_proj_string = __esm({
|
|
10426
|
-
"dist/crs/proj-string.js"() {
|
|
10427
|
-
PROJStringSyntaxError = class extends SyntaxError {
|
|
10428
|
-
/** Create a PROJ string syntax error at a source location. */
|
|
10429
|
-
constructor(message, source, offset) {
|
|
10430
|
-
const location = getSourceLocation(source, offset);
|
|
10431
|
-
super(`${message} at ${location.line}:${location.column}`);
|
|
10432
|
-
this.name = "PROJStringSyntaxError";
|
|
10433
|
-
this.offset = offset;
|
|
10434
|
-
this.line = location.line;
|
|
10435
|
-
this.column = location.column;
|
|
10436
|
-
}
|
|
10437
|
-
};
|
|
10438
|
-
DMS_VALUE = /^[+-]?\d+(?:\.\d*)?d(?:\d+(?:\.\d*)?'(?:\d+(?:\.\d*)?")?)?[NSEW]?$/i;
|
|
10439
|
-
}
|
|
10440
|
-
});
|
|
10441
|
-
|
|
10442
|
-
// dist/projection/experimental/crs/types.js
|
|
10443
|
-
function unsupportedStage(message) {
|
|
10444
|
-
throw new TypeScriptCRSError("missing-transform-stage", message);
|
|
10445
|
-
}
|
|
10446
|
-
var _a, CRS_ERROR, TypeScriptCRSError;
|
|
10447
|
-
var init_types2 = __esm({
|
|
10448
|
-
"dist/projection/experimental/crs/types.js"() {
|
|
10449
|
-
CRS_ERROR = /* @__PURE__ */ Symbol.for("@math.gl/projection/TypeScriptCRSError");
|
|
10450
|
-
TypeScriptCRSError = class _TypeScriptCRSError extends Error {
|
|
10451
|
-
static [(_a = CRS_ERROR, Symbol.hasInstance)](value2) {
|
|
10452
|
-
if (this !== _TypeScriptCRSError)
|
|
10453
|
-
return Function.prototype[Symbol.hasInstance].call(this, value2);
|
|
10454
|
-
return value2 instanceof Error && value2[CRS_ERROR] === true;
|
|
10455
|
-
}
|
|
10456
|
-
constructor(reason, message) {
|
|
10457
|
-
super(message);
|
|
10458
|
-
this.reason = reason;
|
|
10459
|
-
this[_a] = true;
|
|
10460
|
-
this.name = "TypeScriptCRSError";
|
|
10461
|
-
}
|
|
10462
|
-
};
|
|
10463
|
-
}
|
|
10464
|
-
});
|
|
10465
|
-
|
|
10466
|
-
// dist/projection/experimental/crs/spatial-reference.js
|
|
10467
|
-
function resolveCRSInput(input, options) {
|
|
10468
|
-
if (typeof input === "string" || "type" in input)
|
|
10469
|
-
return { definition: input, lossy: false };
|
|
10470
|
-
const metadata = input;
|
|
10471
|
-
const spatialReference = "crs" in metadata ? metadata : void 0;
|
|
10472
|
-
const reference = "crs" in metadata ? metadata.crs : metadata;
|
|
10473
|
-
if (reference.state !== "explicit" && reference.state !== "default")
|
|
10474
|
-
throw new TypeScriptCRSError("unknown-syntax", "Cannot transform an " + reference.state + " CRS reference");
|
|
10475
|
-
let lossy = false;
|
|
10476
|
-
if ((spatialReference == null ? void 0 : spatialReference.coordinateEpoch) !== void 0)
|
|
10477
|
-
unsupportedStage("Coordinate epochs require a time-dependent transformation");
|
|
10478
|
-
if ((spatialReference == null ? void 0 : spatialReference.vertical) && spatialReference.vertical.state !== "absent") {
|
|
10479
|
-
if (options.mode !== "horizontal")
|
|
10480
|
-
unsupportedStage("A separately declared vertical CRS requires explicit horizontal extraction");
|
|
10481
|
-
lossy = true;
|
|
10482
|
-
}
|
|
10483
|
-
return { definition: reference.definition, spatialReference, lossy };
|
|
10484
|
-
}
|
|
10485
|
-
function applySpatialReference(crs, reference) {
|
|
10486
|
-
var _a3;
|
|
10487
|
-
if (!reference)
|
|
10488
|
-
return crs;
|
|
10489
|
-
if (reference.coordinateFrame !== "unknown" && reference.coordinateFrame !== crs.kind)
|
|
10490
|
-
throw new Error("SpatialReference coordinate frame disagrees with its CRS");
|
|
10491
|
-
const order = reference.coordinateOrder;
|
|
10492
|
-
const names = crs.kind === "geocentric" ? { x: "e", y: "n", z: "u" } : {
|
|
10493
|
-
longitude: "e",
|
|
10494
|
-
lon: "e",
|
|
10495
|
-
latitude: "n",
|
|
10496
|
-
lat: "n",
|
|
10497
|
-
easting: "e",
|
|
10498
|
-
northing: "n",
|
|
10499
|
-
height: "u",
|
|
10500
|
-
altitude: "u",
|
|
10501
|
-
x: "e",
|
|
10502
|
-
y: "n",
|
|
10503
|
-
z: "u"
|
|
10504
|
-
};
|
|
10505
|
-
let storedAxis;
|
|
10506
|
-
if (order.length) {
|
|
10507
|
-
storedAxis = order.slice(0, 3).map((name) => names[name.toLowerCase()] || "?").join("");
|
|
10508
|
-
if (storedAxis.length === 2)
|
|
10509
|
-
storedAxis += "u";
|
|
10510
|
-
if (storedAxis.length !== 3 || !storedAxis.includes("e") || !storedAxis.includes("n") || !storedAxis.includes("u"))
|
|
10511
|
-
unsupportedStage("Unsupported SpatialReference coordinate order");
|
|
10512
|
-
if (order.length > 4 || order.length > 3 && !["m", "measure"].includes(order[3]))
|
|
10513
|
-
unsupportedStage("Unsupported fourth coordinate component");
|
|
10514
|
-
}
|
|
10515
|
-
if ((_a3 = reference.units) == null ? void 0 : _a3.length) {
|
|
10516
|
-
const units2 = {
|
|
10517
|
-
m: 1,
|
|
10518
|
-
meter: 1,
|
|
10519
|
-
metre: 1,
|
|
10520
|
-
meters: 1,
|
|
10521
|
-
metres: 1,
|
|
10522
|
-
km: 1e3,
|
|
10523
|
-
ft: 0.3048,
|
|
10524
|
-
"us-ft": 1200 / 3937,
|
|
10525
|
-
degree: Math.PI / 180,
|
|
10526
|
-
degrees: Math.PI / 180,
|
|
10527
|
-
radian: 1,
|
|
10528
|
-
radians: 1,
|
|
10529
|
-
grad: Math.PI / 200
|
|
10530
|
-
};
|
|
10531
|
-
for (let i = 0; i < Math.min(reference.units.length, 3); i++) {
|
|
10532
|
-
const vertical = (storedAxis || "enu")[i] === "u";
|
|
10533
|
-
const expected = crs.kind === "geocentric" ? crs.toMeter : vertical ? crs.verticalUnit : crs.kind === "geographic" ? crs.angularUnit : crs.toMeter;
|
|
10534
|
-
if (Math.abs((units2[reference.units[i]] ?? NaN) - expected) > 1e-12 || units2[reference.units[i]] === void 0)
|
|
10535
|
-
unsupportedStage("SpatialReference units disagree with its CRS");
|
|
10536
|
-
}
|
|
10537
|
-
}
|
|
10538
|
-
return Object.freeze({ ...crs, storedAxis });
|
|
10539
|
-
}
|
|
10540
|
-
var init_spatial_reference2 = __esm({
|
|
10541
|
-
"dist/projection/experimental/crs/spatial-reference.js"() {
|
|
10542
|
-
init_types2();
|
|
10543
|
-
}
|
|
10544
|
-
});
|
|
10545
|
-
|
|
10546
|
-
// dist/projection/experimental/parameters.js
|
|
10547
|
-
function numberParameter(parameters, name, fallback) {
|
|
10548
|
-
if (!Object.prototype.hasOwnProperty.call(parameters, name))
|
|
10549
|
-
return fallback;
|
|
10550
|
-
const value2 = parameters[name];
|
|
10551
|
-
if (typeof value2 !== "string" || !/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(value2)) {
|
|
10552
|
-
throw new Error(`Invalid numeric PROJ parameter: +${name}`);
|
|
10553
|
-
}
|
|
10554
|
-
const number = Number(value2);
|
|
10555
|
-
if (!Number.isFinite(number))
|
|
10556
|
-
throw new Error(`Invalid numeric PROJ parameter: +${name}`);
|
|
10557
|
-
return number;
|
|
10558
|
-
}
|
|
10559
|
-
function latitudeParameter(parameters, name) {
|
|
10560
|
-
const degrees4 = numberParameter(parameters, name, 0);
|
|
10561
|
-
if (Math.abs(degrees4) >= 90)
|
|
10562
|
-
throw new Error(`+${name} must be between -90 and 90 degrees`);
|
|
10563
|
-
return degrees4 * DEGREES_TO_RADIANS;
|
|
10564
|
-
}
|
|
10565
|
-
function wrapLongitude(longitude3, over = false) {
|
|
10566
|
-
if (over || Math.abs(longitude3) <= Math.PI)
|
|
10567
|
-
return longitude3;
|
|
10568
|
-
const circle = 2 * Math.PI;
|
|
10569
|
-
return ((longitude3 + Math.PI) % circle + circle) % circle - Math.PI;
|
|
10570
|
-
}
|
|
10571
|
-
var DEGREES_TO_RADIANS;
|
|
10572
|
-
var init_parameters = __esm({
|
|
10573
|
-
"dist/projection/experimental/parameters.js"() {
|
|
10574
|
-
DEGREES_TO_RADIANS = Math.PI / 180;
|
|
10575
|
-
}
|
|
10576
|
-
});
|
|
10577
|
-
|
|
10578
|
-
// dist/projection/experimental/crs/datum-catalog.js
|
|
10579
|
-
function getDatumDefinitions(options) {
|
|
10580
|
-
var _a3;
|
|
10581
|
-
if (!((_a3 = options.datumCatalogs) == null ? void 0 : _a3.length))
|
|
10582
|
-
return builtins;
|
|
10583
|
-
const cached = resolved.get(options);
|
|
10584
|
-
if ((cached == null ? void 0 : cached.catalogs) === options.datumCatalogs)
|
|
10585
|
-
return cached.definitions;
|
|
10586
|
-
const definitions = Object.assign(/* @__PURE__ */ Object.create(null), builtins);
|
|
10587
|
-
const names = new Map(Object.entries(builtins).map(([name, definition]) => [
|
|
10588
|
-
datumNameKey(name),
|
|
10589
|
-
{ definition, owner: -1 }
|
|
10590
|
-
]));
|
|
10591
|
-
options.datumCatalogs.forEach((catalog, owner) => {
|
|
10592
|
-
if (!catalog.name || !catalog.datums)
|
|
10593
|
-
throw new Error("Invalid datum catalogue plugin");
|
|
10594
|
-
for (const [name, definition] of Object.entries(catalog.datums)) {
|
|
10595
|
-
const key3 = datumNameKey(name);
|
|
10596
|
-
if (!key3 || key3 === "none" || !definition || ["ellipse", "towgs84", "nadgrids"].some((field) => definition[field] !== void 0 && typeof definition[field] !== "string"))
|
|
10597
|
-
throw new Error("Invalid datum definition: " + name);
|
|
10598
|
-
const previous = names.get(key3);
|
|
10599
|
-
if (previous && (previous.owner !== owner || previous.definition.ellipse !== definition.ellipse || previous.definition.towgs84 !== definition.towgs84 || previous.definition.nadgrids !== definition.nadgrids))
|
|
10600
|
-
throw new Error("Conflicting datum registration: " + name);
|
|
10601
|
-
names.set(key3, { definition, owner });
|
|
10602
|
-
definitions[name] = definition;
|
|
10603
|
-
}
|
|
10604
|
-
});
|
|
10605
|
-
resolved.set(options, { catalogs: options.datumCatalogs, definitions });
|
|
10606
|
-
return definitions;
|
|
10607
|
-
}
|
|
10608
|
-
var wgs84, nad83, builtins, resolved, datumNameKey;
|
|
10609
|
-
var init_datum_catalog = __esm({
|
|
10610
|
-
"dist/projection/experimental/crs/datum-catalog.js"() {
|
|
10611
|
-
wgs84 = { towgs84: "0,0,0", ellipse: "WGS84" };
|
|
10612
|
-
nad83 = { towgs84: "0,0,0", ellipse: "GRS80" };
|
|
10613
|
-
builtins = {
|
|
10614
|
-
wgs84,
|
|
10615
|
-
WGS84: wgs84,
|
|
10616
|
-
nad83,
|
|
10617
|
-
North_American_Datum_1983: nad83
|
|
10618
|
-
};
|
|
10619
|
-
resolved = /* @__PURE__ */ new WeakMap();
|
|
10620
|
-
datumNameKey = (name) => name.toLowerCase().replace(/[\s_-]/g, "");
|
|
10621
|
-
}
|
|
10622
|
-
});
|
|
10623
|
-
|
|
10624
|
-
// dist/projection/experimental/crs/ellipsoid-table.js
|
|
10625
|
-
var ellipsoids, ellipsoid_table_default;
|
|
10626
|
-
var init_ellipsoid_table = __esm({
|
|
10627
|
-
"dist/projection/experimental/crs/ellipsoid-table.js"() {
|
|
10628
|
-
ellipsoids = {
|
|
10629
|
-
MERIT: {
|
|
10630
|
-
a: 6378137,
|
|
10631
|
-
rf: 298.257,
|
|
10632
|
-
ellipseName: "MERIT 1983"
|
|
10633
|
-
},
|
|
10634
|
-
SGS85: {
|
|
10635
|
-
a: 6378136,
|
|
10636
|
-
rf: 298.257,
|
|
10637
|
-
ellipseName: "Soviet Geodetic System 85"
|
|
10638
|
-
},
|
|
10639
|
-
GRS80: {
|
|
10640
|
-
a: 6378137,
|
|
10641
|
-
rf: 298.257222101,
|
|
10642
|
-
ellipseName: "GRS 1980(IUGG, 1980)"
|
|
10643
|
-
},
|
|
10644
|
-
IAU76: {
|
|
10645
|
-
a: 6378140,
|
|
10646
|
-
rf: 298.257,
|
|
10647
|
-
ellipseName: "IAU 1976"
|
|
10648
|
-
},
|
|
10649
|
-
airy: {
|
|
10650
|
-
a: 6377563396e-3,
|
|
10651
|
-
b: 635625691e-2,
|
|
10652
|
-
ellipseName: "Airy 1830"
|
|
10653
|
-
},
|
|
10654
|
-
APL4: {
|
|
10655
|
-
a: 6378137,
|
|
10656
|
-
rf: 298.25,
|
|
10657
|
-
ellipseName: "Appl. Physics. 1965"
|
|
10658
|
-
},
|
|
10659
|
-
NWL9D: {
|
|
10660
|
-
a: 6378145,
|
|
10661
|
-
rf: 298.25,
|
|
10662
|
-
ellipseName: "Naval Weapons Lab., 1965"
|
|
10663
|
-
},
|
|
10664
|
-
mod_airy: {
|
|
10665
|
-
a: 6377340189e-3,
|
|
10666
|
-
b: 6356034446e-3,
|
|
10667
|
-
ellipseName: "Modified Airy"
|
|
10668
|
-
},
|
|
10669
|
-
andrae: {
|
|
10670
|
-
a: 637710443e-2,
|
|
10671
|
-
rf: 300,
|
|
10672
|
-
ellipseName: "Andrae 1876 (Den., Iclnd.)"
|
|
10673
|
-
},
|
|
10674
|
-
aust_SA: {
|
|
10675
|
-
a: 6378160,
|
|
10676
|
-
rf: 298.25,
|
|
10677
|
-
ellipseName: "Australian Natl & S. Amer. 1969"
|
|
10678
|
-
},
|
|
10679
|
-
GRS67: {
|
|
10680
|
-
a: 6378160,
|
|
10681
|
-
rf: 298.247167427,
|
|
10682
|
-
ellipseName: "GRS 67(IUGG 1967)"
|
|
10683
|
-
},
|
|
10684
|
-
bessel: {
|
|
10685
|
-
a: 6377397155e-3,
|
|
10686
|
-
rf: 299.1528128,
|
|
10687
|
-
ellipseName: "Bessel 1841"
|
|
10688
|
-
},
|
|
10689
|
-
bess_nam: {
|
|
10690
|
-
a: 6377483865e-3,
|
|
10691
|
-
rf: 299.1528128,
|
|
10692
|
-
ellipseName: "Bessel 1841 (Namibia)"
|
|
10693
|
-
},
|
|
10694
|
-
clrk66: {
|
|
10695
|
-
a: 63782064e-1,
|
|
10696
|
-
b: 63565838e-1,
|
|
10697
|
-
ellipseName: "Clarke 1866"
|
|
10698
|
-
},
|
|
10699
|
-
clrk80: {
|
|
10700
|
-
a: 6378249145e-3,
|
|
10701
|
-
rf: 293.4663,
|
|
10702
|
-
ellipseName: "Clarke 1880 mod."
|
|
10703
|
-
},
|
|
10704
|
-
clrk80ign: {
|
|
10705
|
-
a: 63782492e-1,
|
|
10706
|
-
b: 6356515,
|
|
10707
|
-
rf: 293.4660213,
|
|
10708
|
-
ellipseName: "Clarke 1880 (IGN)"
|
|
10709
|
-
},
|
|
10710
|
-
clrk58: {
|
|
10711
|
-
a: 6378293645208759e-9,
|
|
10712
|
-
rf: 294.2606763692654,
|
|
10713
|
-
ellipseName: "Clarke 1858"
|
|
10714
|
-
},
|
|
10715
|
-
CPM: {
|
|
10716
|
-
a: 63757387e-1,
|
|
10717
|
-
rf: 334.29,
|
|
10718
|
-
ellipseName: "Comm. des Poids et Mesures 1799"
|
|
10719
|
-
},
|
|
10720
|
-
delmbr: {
|
|
10721
|
-
a: 6376428,
|
|
10722
|
-
rf: 311.5,
|
|
10723
|
-
ellipseName: "Delambre 1810 (Belgium)"
|
|
10724
|
-
},
|
|
10725
|
-
engelis: {
|
|
10726
|
-
a: 637813605e-2,
|
|
10727
|
-
rf: 298.2566,
|
|
10728
|
-
ellipseName: "Engelis 1985"
|
|
10729
|
-
},
|
|
10730
|
-
evrst30: {
|
|
10731
|
-
a: 6377276345e-3,
|
|
10732
|
-
rf: 300.8017,
|
|
10733
|
-
ellipseName: "Everest 1830"
|
|
10734
|
-
},
|
|
10735
|
-
evrst48: {
|
|
10736
|
-
a: 6377304063e-3,
|
|
10737
|
-
rf: 300.8017,
|
|
10738
|
-
ellipseName: "Everest 1948"
|
|
10739
|
-
},
|
|
10740
|
-
evrst56: {
|
|
10741
|
-
a: 6377301243e-3,
|
|
10742
|
-
rf: 300.8017,
|
|
10743
|
-
ellipseName: "Everest 1956"
|
|
10744
|
-
},
|
|
10745
|
-
evrst69: {
|
|
10746
|
-
a: 6377295664e-3,
|
|
10747
|
-
rf: 300.8017,
|
|
10748
|
-
ellipseName: "Everest 1969"
|
|
10749
|
-
},
|
|
10750
|
-
evrstSS: {
|
|
10751
|
-
a: 6377298556e-3,
|
|
10752
|
-
rf: 300.8017,
|
|
10753
|
-
ellipseName: "Everest (Sabah & Sarawak)"
|
|
10754
|
-
},
|
|
10755
|
-
fschr60: {
|
|
10756
|
-
a: 6378166,
|
|
10757
|
-
rf: 298.3,
|
|
10758
|
-
ellipseName: "Fischer (Mercury Datum) 1960"
|
|
10759
|
-
},
|
|
10760
|
-
fschr60m: {
|
|
10761
|
-
a: 6378155,
|
|
10762
|
-
rf: 298.3,
|
|
10763
|
-
ellipseName: "Fischer 1960"
|
|
10764
|
-
},
|
|
10765
|
-
fschr68: {
|
|
10766
|
-
a: 6378150,
|
|
10767
|
-
rf: 298.3,
|
|
10768
|
-
ellipseName: "Fischer 1968"
|
|
10769
|
-
},
|
|
10770
|
-
helmert: {
|
|
10771
|
-
a: 6378200,
|
|
10772
|
-
rf: 298.3,
|
|
10773
|
-
ellipseName: "Helmert 1906"
|
|
10774
|
-
},
|
|
10775
|
-
hough: {
|
|
10776
|
-
a: 6378270,
|
|
10777
|
-
rf: 297,
|
|
10778
|
-
ellipseName: "Hough"
|
|
10779
|
-
},
|
|
10780
|
-
intl: {
|
|
10781
|
-
a: 6378388,
|
|
10782
|
-
rf: 297,
|
|
10783
|
-
ellipseName: "International 1909 (Hayford)"
|
|
10784
|
-
},
|
|
10785
|
-
kaula: {
|
|
10786
|
-
a: 6378163,
|
|
10787
|
-
rf: 298.24,
|
|
10788
|
-
ellipseName: "Kaula 1961"
|
|
10789
|
-
},
|
|
10790
|
-
lerch: {
|
|
10791
|
-
a: 6378139,
|
|
10792
|
-
rf: 298.257,
|
|
10793
|
-
ellipseName: "Lerch 1979"
|
|
10794
|
-
},
|
|
10795
|
-
mprts: {
|
|
10796
|
-
a: 6397300,
|
|
10797
|
-
rf: 191,
|
|
10798
|
-
ellipseName: "Maupertius 1738"
|
|
10799
|
-
},
|
|
10800
|
-
new_intl: {
|
|
10801
|
-
a: 63781575e-1,
|
|
10802
|
-
b: 63567722e-1,
|
|
10803
|
-
ellipseName: "New International 1967"
|
|
10804
|
-
},
|
|
10805
|
-
plessis: {
|
|
10806
|
-
a: 6376523,
|
|
10807
|
-
b: 6355863,
|
|
10808
|
-
ellipseName: "Plessis 1817 (France)"
|
|
10809
|
-
},
|
|
10810
|
-
krass: {
|
|
10811
|
-
a: 6378245,
|
|
10812
|
-
rf: 298.3,
|
|
10813
|
-
ellipseName: "Krassovsky, 1942"
|
|
10814
|
-
},
|
|
10815
|
-
SEasia: {
|
|
10816
|
-
a: 6378155,
|
|
10817
|
-
b: 63567733205e-4,
|
|
10818
|
-
ellipseName: "Southeast Asia"
|
|
10819
|
-
},
|
|
10820
|
-
walbeck: {
|
|
10821
|
-
a: 6376896,
|
|
10822
|
-
b: 63558348467e-4,
|
|
10823
|
-
ellipseName: "Walbeck"
|
|
10824
|
-
},
|
|
10825
|
-
WGS60: {
|
|
10826
|
-
a: 6378165,
|
|
10827
|
-
rf: 298.3,
|
|
10828
|
-
ellipseName: "WGS 60"
|
|
10829
|
-
},
|
|
10830
|
-
WGS66: {
|
|
10831
|
-
a: 6378145,
|
|
10832
|
-
rf: 298.25,
|
|
10833
|
-
ellipseName: "WGS 66"
|
|
10834
|
-
},
|
|
10835
|
-
WGS72: {
|
|
10836
|
-
a: 6378135,
|
|
10837
|
-
rf: 298.26,
|
|
10838
|
-
ellipseName: "WGS 72"
|
|
10839
|
-
},
|
|
10840
|
-
WGS84: {
|
|
10841
|
-
a: 6378137,
|
|
10842
|
-
rf: 298.257223563,
|
|
10843
|
-
ellipseName: "WGS 84"
|
|
10844
|
-
},
|
|
10845
|
-
sphere: {
|
|
10846
|
-
a: 6370997,
|
|
10847
|
-
b: 6370997,
|
|
10848
|
-
ellipseName: "Normal Sphere (r=6370997)"
|
|
10849
|
-
}
|
|
10850
|
-
};
|
|
10851
|
-
ellipsoid_table_default = ellipsoids;
|
|
10852
|
-
}
|
|
10853
|
-
});
|
|
10854
|
-
|
|
10855
|
-
// dist/projection/experimental/crs/primemeridian-table.js
|
|
10856
|
-
var primeMeridian, primemeridian_table_default;
|
|
10857
|
-
var init_primemeridian_table = __esm({
|
|
10858
|
-
"dist/projection/experimental/crs/primemeridian-table.js"() {
|
|
10859
|
-
primeMeridian = {};
|
|
10860
|
-
primeMeridian["greenwich"] = 0;
|
|
10861
|
-
primeMeridian["lisbon"] = -9.131906111111;
|
|
10862
|
-
primeMeridian["paris"] = 2.337229166667;
|
|
10863
|
-
primeMeridian["bogota"] = -74.080916666667;
|
|
10864
|
-
primeMeridian["madrid"] = -3.687938888889;
|
|
10865
|
-
primeMeridian["rome"] = 12.452333333333;
|
|
10866
|
-
primeMeridian["bern"] = 7.439583333333;
|
|
10867
|
-
primeMeridian["jakarta"] = 106.807719444444;
|
|
10868
|
-
primeMeridian["ferro"] = -17.666666666667;
|
|
10869
|
-
primeMeridian["brussels"] = 4.367975;
|
|
10870
|
-
primeMeridian["stockholm"] = 18.058277777778;
|
|
10871
|
-
primeMeridian["athens"] = 23.7163375;
|
|
10872
|
-
primeMeridian["oslo"] = 10.722916666667;
|
|
10873
|
-
primemeridian_table_default = primeMeridian;
|
|
10874
|
-
}
|
|
10875
|
-
});
|
|
10876
|
-
|
|
10877
|
-
// dist/crs/units-table.js
|
|
10878
|
-
var linearUnits;
|
|
10879
|
-
var init_units_table = __esm({
|
|
10880
|
-
"dist/crs/units-table.js"() {
|
|
10881
|
-
linearUnits = {
|
|
10882
|
-
m: { name: "meters", metersPerUnit: 1 },
|
|
10883
|
-
mm: { name: "millimeters", metersPerUnit: 1e-3 },
|
|
10884
|
-
cm: { name: "centimeters", metersPerUnit: 0.01 },
|
|
10885
|
-
ft: { name: "feet", metersPerUnit: 0.3048 },
|
|
10886
|
-
"us-ft": { name: "us-survey-feet", metersPerUnit: 1200 / 3937 },
|
|
10887
|
-
fath: { name: "fathoms", metersPerUnit: 1.8288 },
|
|
10888
|
-
kmi: { name: "nautical-miles", metersPerUnit: 1852 },
|
|
10889
|
-
"us-ch": { name: "us-survey-chains", metersPerUnit: 20.1168402336805 },
|
|
10890
|
-
"us-mi": { name: "us-survey-miles", metersPerUnit: 1609.34721869444 },
|
|
10891
|
-
km: { name: "kilometers", metersPerUnit: 1e3 },
|
|
10892
|
-
"ind-ft": { name: "indian-feet", metersPerUnit: 0.30479841 },
|
|
10893
|
-
"ind-yd": { name: "indian-yards", metersPerUnit: 0.91439523 },
|
|
10894
|
-
mi: { name: "miles", metersPerUnit: 1609.344 },
|
|
10895
|
-
yd: { name: "yards", metersPerUnit: 0.9144 },
|
|
10896
|
-
ch: { name: "chains", metersPerUnit: 20.1168 },
|
|
10897
|
-
link: { name: "links", metersPerUnit: 0.201168 },
|
|
10898
|
-
dm: { name: "decimeters", metersPerUnit: 0.1 },
|
|
10899
|
-
in: { name: "inches", metersPerUnit: 0.0254 },
|
|
10900
|
-
"ind-ch": { name: "indian-chains", metersPerUnit: 20.11669506 },
|
|
10901
|
-
"us-in": { name: "us-survey-inches", metersPerUnit: 0.025400050800101 },
|
|
10902
|
-
"us-yd": { name: "us-survey-yards", metersPerUnit: 0.914401828803658 }
|
|
10903
|
-
};
|
|
10904
|
-
}
|
|
10905
|
-
});
|
|
10906
|
-
|
|
10907
|
-
// dist/crs/crs-metadata.js
|
|
10908
|
-
function getCRSSignature(crs) {
|
|
10909
|
-
return JSON.stringify([
|
|
10910
|
-
crs.coordinateFrame,
|
|
10911
|
-
crs.projection,
|
|
10912
|
-
Object.keys(crs.parameters).sort().map((key3) => [key3, crs.parameters[key3]]),
|
|
10913
|
-
[crs.ellipsoid.semiMajorAxis, crs.ellipsoid.semiMinorAxis],
|
|
10914
|
-
crs.axis,
|
|
10915
|
-
[crs.xUnit.name, crs.xUnit.metersPerUnit, crs.xUnit.degreesPerUnit],
|
|
10916
|
-
[crs.yUnit.name, crs.yUnit.metersPerUnit, crs.yUnit.degreesPerUnit],
|
|
10917
|
-
[crs.zUnit.name, crs.zUnit.metersPerUnit, crs.zUnit.degreesPerUnit],
|
|
10918
|
-
crs.lossy,
|
|
10919
|
-
crs.areaOfUse
|
|
10920
|
-
]);
|
|
10921
|
-
}
|
|
10922
|
-
var init_crs_metadata = __esm({
|
|
10923
|
-
"dist/crs/crs-metadata.js"() {
|
|
10924
|
-
init_units_table();
|
|
10925
|
-
}
|
|
10926
|
-
});
|
|
10927
|
-
|
|
10928
|
-
// dist/projection/experimental/crs/normalize.js
|
|
10929
|
-
function lookup(table, name) {
|
|
10930
|
-
const key3 = Object.keys(table).find((key4) => keyOf(key4) === keyOf(name));
|
|
10931
|
-
return key3 === void 0 ? void 0 : table[key3];
|
|
10932
|
-
}
|
|
10933
|
-
function parseAngle(text) {
|
|
10934
|
-
if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(text)) {
|
|
10935
|
-
const value2 = Number(text);
|
|
10936
|
-
if (Number.isFinite(value2))
|
|
10937
|
-
return value2;
|
|
10938
|
-
}
|
|
10939
|
-
if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?r$/i.test(text)) {
|
|
10940
|
-
const value2 = Number(text.slice(0, -1)) / DEGREES_TO_RADIANS;
|
|
10941
|
-
if (Number.isFinite(value2))
|
|
10942
|
-
return value2;
|
|
10943
|
-
}
|
|
10944
|
-
const dms = /^([+-]?)(\d+(?:\.\d*)?)(?:d(?:(\d+(?:\.\d*)?)'(?:(\d+(?:\.\d*)?)")?)?)?([NSEW])?$/i.exec(text);
|
|
10945
|
-
if (dms && (/d/i.test(text) || dms[5])) {
|
|
10946
|
-
const minutes = Number(dms[3] || 0), seconds = Number(dms[4] || 0);
|
|
10947
|
-
if (minutes < 60 && seconds < 60) {
|
|
10948
|
-
const sign5 = dms[1] === "-" ? -1 : 1;
|
|
10949
|
-
const direction = /[SW]/i.test(dms[5] || "") ? -1 : 1;
|
|
10950
|
-
const value2 = sign5 * direction * (Number(dms[2]) + minutes / 60 + seconds / 3600);
|
|
10951
|
-
if (Number.isFinite(value2))
|
|
10952
|
-
return value2;
|
|
10953
|
-
}
|
|
10954
|
-
}
|
|
10955
|
-
throw new Error("Invalid angular parameter: " + text);
|
|
10956
|
-
}
|
|
10957
|
-
function resolveLocalCRSDefinition(input, options = {}) {
|
|
10958
|
-
let definition = input;
|
|
10959
|
-
const aliases = options.aliases || {};
|
|
10960
|
-
const visited = /* @__PURE__ */ new Set();
|
|
10961
|
-
while (typeof definition === "string" && (own(aliases, definition) || own(ALIASES, definition))) {
|
|
10962
|
-
if (visited.has(definition))
|
|
10963
|
-
throw new Error("Circular CRS alias: " + definition);
|
|
10964
|
-
visited.add(definition);
|
|
10965
|
-
definition = own(aliases, definition) ? aliases[definition] : ALIASES[definition];
|
|
10966
|
-
}
|
|
10967
|
-
if (typeof definition === "string") {
|
|
10968
|
-
const utm = /^EPSG:(326|327)(\d{2})$/.exec(definition);
|
|
10969
|
-
if (utm && Number(utm[2]) >= 1 && Number(utm[2]) <= 60) {
|
|
10970
|
-
definition = "+proj=utm +datum=WGS84 +zone=" + Number(utm[2]) + (utm[1] === "327" ? " +south" : "");
|
|
10971
|
-
}
|
|
10972
|
-
if (definition === "EPSG:5041" || definition === "EPSG:5042") {
|
|
10973
|
-
definition = "+proj=stere +datum=WGS84 +lat_0=" + (definition === "EPSG:5041" ? 90 : -90) + " +k_0=0.994 +x_0=2000000 +y_0=2000000";
|
|
10974
|
-
}
|
|
10975
|
-
}
|
|
10976
|
-
return definition;
|
|
10977
|
-
}
|
|
10978
|
-
function normalizeCRS(input, options = {}) {
|
|
10979
|
-
var _a3;
|
|
10980
|
-
const datums2 = getDatumDefinitions(options);
|
|
10981
|
-
const resolved2 = resolveCRSInput(input, options);
|
|
10982
|
-
const definition = resolveLocalCRSDefinition(resolved2.definition, options);
|
|
10983
|
-
let parsed;
|
|
10984
|
-
if (inferCRSRepresentation(definition) === "proj-string" && typeof definition === "string") {
|
|
10985
|
-
const parameters2 = /* @__PURE__ */ Object.create(null);
|
|
10986
|
-
for (const parameter of parsePROJString(definition).parameters) {
|
|
10987
|
-
if (own(parameters2, parameter.name))
|
|
10988
|
-
throw new Error("Duplicate PROJ parameter: +" + parameter.name);
|
|
10989
|
-
parameters2[parameter.name] = parameter.value;
|
|
10990
|
-
}
|
|
10991
|
-
parsed = { parameters: parameters2 };
|
|
10992
|
-
} else {
|
|
10993
|
-
const parser = (_a3 = options.parsers) == null ? void 0 : _a3.find((candidate) => candidate.canParse(definition));
|
|
10994
|
-
if (!parser) {
|
|
10995
|
-
const serialized = ["wkt", "projjson"].includes(inferCRSRepresentation(definition));
|
|
10996
|
-
throw new TypeScriptCRSError(serialized ? "missing-parser" : "unknown-syntax", inferCRSRepresentation(definition) === "identifier" ? "Unsupported CRS definition: " + definition + "; resolve it first" : "Unsupported CRS definition; register a WKT or PROJJSON parser for structured definitions");
|
|
10997
|
-
}
|
|
10998
|
-
parsed = parser.parse(definition, options);
|
|
10999
|
-
}
|
|
11000
|
-
const parameters = { ...parsed.parameters };
|
|
11001
|
-
for (const name2 of [
|
|
11002
|
-
"lon_0",
|
|
11003
|
-
"lat_0",
|
|
11004
|
-
"lat_1",
|
|
11005
|
-
"lat_2",
|
|
11006
|
-
"lat_ts",
|
|
11007
|
-
"lon_wrap",
|
|
11008
|
-
"lon_1",
|
|
11009
|
-
"lon_2",
|
|
11010
|
-
"lonc",
|
|
11011
|
-
"alpha",
|
|
11012
|
-
"gamma",
|
|
11013
|
-
"tilt",
|
|
11014
|
-
"azi",
|
|
11015
|
-
"o_alpha",
|
|
11016
|
-
"o_lon_c",
|
|
11017
|
-
"o_lat_c",
|
|
11018
|
-
"o_lon_p",
|
|
11019
|
-
"o_lat_p",
|
|
11020
|
-
"o_lon_1",
|
|
11021
|
-
"o_lat_1",
|
|
11022
|
-
"o_lon_2",
|
|
11023
|
-
"o_lat_2"
|
|
11024
|
-
]) {
|
|
11025
|
-
if (parameters[name2] !== void 0)
|
|
11026
|
-
parameters[name2] = String(parseAngle(parameters[name2]));
|
|
11027
|
-
}
|
|
11028
|
-
const suppliedName = parameters["proj"];
|
|
11029
|
-
const lowerName = suppliedName == null ? void 0 : suppliedName.toLowerCase();
|
|
11030
|
-
const name = lowerName === "geocentric" ? "geocent" : ["longlat", "latlong", "latlon", "lonlat", "identity", "geocent"].includes(lowerName) ? lowerName : suppliedName;
|
|
11031
|
-
if (!name)
|
|
11032
|
-
throw new Error("CRS requires +proj");
|
|
11033
|
-
const kind = ["longlat", "latlong", "latlon", "lonlat"].includes(name) ? "geographic" : name === "geocent" ? "geocentric" : name === "identity" ? "identity" : "projected";
|
|
11034
|
-
const datumName = parameters["datum"];
|
|
11035
|
-
const datum = datumName && datumName !== "none" ? lookup(datums2, datumName) : void 0;
|
|
11036
|
-
if (datumName && datumName !== "none" && !datum)
|
|
11037
|
-
unsupportedStage("Unknown datum: " + datumName + "; register a datumCatalogs plugin");
|
|
11038
|
-
const ellipsoid = getEllipsoid(parameters, datum == null ? void 0 : datum.ellipse);
|
|
11039
|
-
const grids = parameters["nadgrids"] ?? (datum == null ? void 0 : datum.nadgrids);
|
|
11040
|
-
const gridReferences = grids === void 0 ? void 0 : grids.split(",").map((entry) => {
|
|
11041
|
-
const optional = entry.startsWith("@");
|
|
11042
|
-
const name2 = optional ? entry.slice(1) : entry;
|
|
11043
|
-
if (!name2 || /\s/.test(name2))
|
|
11044
|
-
throw new Error("Invalid datum grid name");
|
|
11045
|
-
return Object.freeze({ name: name2, optional });
|
|
11046
|
-
});
|
|
11047
|
-
const rawShift = parameters["towgs84"] ?? (datum == null ? void 0 : datum.towgs84);
|
|
11048
|
-
let shift;
|
|
11049
|
-
if (rawShift !== void 0) {
|
|
11050
|
-
shift = rawShift.split(",").map((value2) => numberParameter({ value: value2 }, "value", NaN));
|
|
11051
|
-
if (![3, 7].includes(shift.length) || shift.some((value2) => !Number.isFinite(value2)) || shift.length === 7 && shift[6] <= -1e6) {
|
|
11052
|
-
throw new Error("+towgs84 requires three or seven finite values and positive scale");
|
|
11053
|
-
}
|
|
11054
|
-
}
|
|
11055
|
-
if (datumName === "none")
|
|
11056
|
-
shift = void 0;
|
|
11057
|
-
if (gridReferences && datumName !== "none")
|
|
11058
|
-
shift = [0, 0, 0];
|
|
11059
|
-
const datumEllipsoid = grids === "@null" || grids === "null" ? getEllipsoid({ ellps: "WGS84" }) : ellipsoid;
|
|
11060
|
-
const axis = parameters["axis"] || "enu";
|
|
11061
|
-
if (axis.length !== 3 || !/[ew]/.test(axis) || !/[ns]/.test(axis) || !/[ud]/.test(axis))
|
|
11062
|
-
throw new Error("Invalid axis: " + axis);
|
|
11063
|
-
const angularUnit = parsed.angularUnit ?? DEGREES_TO_RADIANS;
|
|
11064
|
-
if (kind === "geographic" && (parameters["units"] && parameters["units"] !== "degrees" || own(parameters, "to_meter")))
|
|
11065
|
-
throw new Error("Geographic coordinates must use angular units");
|
|
11066
|
-
if (kind !== "geographic" && parameters["units"] === "degrees")
|
|
11067
|
-
throw new Error("Linear coordinates require linear units");
|
|
11068
|
-
const toMeter = unitFactor(parameters, "units", "to_meter");
|
|
11069
|
-
const verticalUnit = parsed.verticalUnit ?? unitFactor(parameters, "vunits", "vto_meter");
|
|
11070
|
-
if (!(verticalUnit > 0) || !Number.isFinite(verticalUnit))
|
|
11071
|
-
throw new Error("Invalid vertical unit");
|
|
11072
|
-
if (!(angularUnit > 0) || !Number.isFinite(angularUnit))
|
|
11073
|
-
throw new Error("Invalid angular unit");
|
|
11074
|
-
const pm = parameters["pm"];
|
|
11075
|
-
const primeMeridian2 = pm === void 0 ? 0 : (lookup(primemeridian_table_default, pm) ?? parseAngle(pm)) * DEGREES_TO_RADIANS;
|
|
11076
|
-
return applySpatialReference(Object.freeze({
|
|
11077
|
-
kind,
|
|
11078
|
-
projection: name,
|
|
11079
|
-
parameters: Object.freeze(parameters),
|
|
11080
|
-
ellipsoid,
|
|
11081
|
-
datum: Object.freeze({
|
|
11082
|
-
ellipsoid: datumEllipsoid,
|
|
11083
|
-
towgs84: shift && Object.freeze(shift),
|
|
11084
|
-
grids: datumName === "none" || grids === "@null" || grids === "null" ? void 0 : gridReferences && Object.freeze(gridReferences)
|
|
11085
|
-
}),
|
|
11086
|
-
areaOfUse: parsed.areaOfUse,
|
|
11087
|
-
angularUnit,
|
|
11088
|
-
toMeter,
|
|
11089
|
-
verticalUnit,
|
|
11090
|
-
primeMeridian: primeMeridian2,
|
|
11091
|
-
axis,
|
|
11092
|
-
longitudeWrap: parameters["lon_wrap"] === void 0 ? void 0 : Number(parameters["lon_wrap"]) * DEGREES_TO_RADIANS,
|
|
11093
|
-
lossy: Boolean(parsed.lossy || resolved2.lossy)
|
|
11094
|
-
}), resolved2.spatialReference);
|
|
11095
|
-
}
|
|
11096
|
-
function unitFactor(parameters, unitKey, factorKey) {
|
|
11097
|
-
const unit3 = parameters[unitKey];
|
|
11098
|
-
const table = linearUnits;
|
|
11099
|
-
if (unitKey === "vunits" && unit3 === "degrees")
|
|
11100
|
-
throw new Error("Height requires linear units");
|
|
11101
|
-
if (unit3 && !["m", "degrees"].includes(unit3) && !own(table, unit3))
|
|
11102
|
-
throw new Error("Unsupported units: " + unit3);
|
|
11103
|
-
const factor = numberParameter(parameters, factorKey, unit3 && table[unit3] ? table[unit3].metersPerUnit : 1);
|
|
11104
|
-
if (!(factor > 0))
|
|
11105
|
-
throw new Error("+" + factorKey + " must be positive");
|
|
11106
|
-
return factor;
|
|
11107
|
-
}
|
|
11108
|
-
function getEllipsoid(parameters, datumEllipsoid) {
|
|
11109
|
-
const name = datumEllipsoid || parameters["ellps"] || "WGS84";
|
|
11110
|
-
const definition = lookup(ellipsoid_table_default, name);
|
|
11111
|
-
if (!definition)
|
|
11112
|
-
throw new Error("Unsupported ellipsoid: " + name);
|
|
11113
|
-
const a = numberParameter(parameters, "a", definition.a);
|
|
11114
|
-
const f = numberParameter(parameters, "f", NaN);
|
|
11115
|
-
const rf = numberParameter(parameters, "rf", Number.isNaN(f) ? definition.rf || 0 : f === 0 ? 0 : 1 / f);
|
|
11116
|
-
const b = numberParameter(parameters, "b", rf ? a * (1 - 1 / rf) : own(parameters, "f") || own(parameters, "rf") || own(parameters, "a") ? a : definition.b || a);
|
|
11117
|
-
const radius2 = numberParameter(parameters, "R", 0);
|
|
11118
|
-
if (a <= 0 || b <= 0 || b > a || rf < 0 || rf > 0 && rf <= 1 || own(parameters, "R") && radius2 <= 0 || !Number.isNaN(f) && (f < 0 || f >= 1))
|
|
11119
|
-
throw new Error("Invalid ellipsoid dimensions");
|
|
11120
|
-
return Object.freeze({
|
|
11121
|
-
semiMajorAxis: radius2 || a,
|
|
11122
|
-
semiMinorAxis: radius2 || b,
|
|
11123
|
-
eccentricitySquared: radius2 ? 0 : 1 - (b / a) ** 2
|
|
11124
|
-
});
|
|
11125
|
-
}
|
|
11126
|
-
var ALIASES, CORE_PARAMETERS, CORE_FLAGS, own, keyOf;
|
|
11127
|
-
var init_normalize = __esm({
|
|
11128
|
-
"dist/projection/experimental/crs/normalize.js"() {
|
|
11129
|
-
init_spatial_reference();
|
|
11130
|
-
init_proj_string();
|
|
11131
|
-
init_spatial_reference2();
|
|
11132
|
-
init_parameters();
|
|
11133
|
-
init_datum_catalog();
|
|
11134
|
-
init_ellipsoid_table();
|
|
11135
|
-
init_primemeridian_table();
|
|
11136
|
-
init_crs_metadata();
|
|
11137
|
-
init_types2();
|
|
11138
|
-
ALIASES = {
|
|
11139
|
-
WGS84: "+proj=longlat +datum=WGS84",
|
|
11140
|
-
"EPSG:4326": "+proj=longlat +datum=WGS84",
|
|
11141
|
-
"EPSG:4269": "+proj=longlat +datum=NAD83",
|
|
11142
|
-
"EPSG:4978": "+proj=geocent +datum=WGS84",
|
|
11143
|
-
"EPSG:4979": "+proj=longlat +datum=WGS84",
|
|
11144
|
-
"EPSG:3857": "+proj=merc +a=6378137 +b=6378137 +nadgrids=@null +units=m",
|
|
11145
|
-
"EPSG:3785": "EPSG:3857",
|
|
11146
|
-
GOOGLE: "EPSG:3857",
|
|
11147
|
-
"EPSG:900913": "EPSG:3857",
|
|
11148
|
-
"EPSG:102113": "EPSG:3857"
|
|
11149
|
-
};
|
|
11150
|
-
CORE_PARAMETERS = [
|
|
11151
|
-
"proj",
|
|
11152
|
-
"datum",
|
|
11153
|
-
"ellps",
|
|
11154
|
-
"a",
|
|
11155
|
-
"b",
|
|
11156
|
-
"rf",
|
|
11157
|
-
"f",
|
|
11158
|
-
"R",
|
|
11159
|
-
"units",
|
|
11160
|
-
"to_meter",
|
|
11161
|
-
"vunits",
|
|
11162
|
-
"vto_meter",
|
|
11163
|
-
"no_defs",
|
|
11164
|
-
"type",
|
|
11165
|
-
"title",
|
|
11166
|
-
"towgs84",
|
|
11167
|
-
"nadgrids",
|
|
11168
|
-
"geoidgrids",
|
|
11169
|
-
"axis",
|
|
11170
|
-
"pm",
|
|
11171
|
-
"over",
|
|
11172
|
-
"lon_wrap"
|
|
11173
|
-
];
|
|
11174
|
-
CORE_FLAGS = ["no_defs", "over"];
|
|
11175
|
-
own = (object2, key3) => Object.prototype.hasOwnProperty.call(object2, key3);
|
|
11176
|
-
keyOf = (value2) => value2.toLowerCase().replace(/[\s_-]/g, "");
|
|
11177
|
-
}
|
|
11178
|
-
});
|
|
11179
|
-
|
|
11180
|
-
// dist/projection/numerical-derivative.js
|
|
11181
|
-
var NumericalDerivative;
|
|
11182
|
-
var init_numerical_derivative = __esm({
|
|
11183
|
-
"dist/projection/numerical-derivative.js"() {
|
|
11184
|
-
NumericalDerivative = class {
|
|
11185
|
-
constructor(sample2) {
|
|
11186
|
-
this.sample = sample2;
|
|
11187
|
-
this.result = [0, 0, 0];
|
|
11188
|
-
this.samples = Array.from({ length: 4 }, () => [0, 0, 0]);
|
|
11189
|
-
this.coarse = [0, 0, 0];
|
|
11190
|
-
this.fine = [0, 0, 0];
|
|
11191
|
-
}
|
|
11192
|
-
evaluate(step, referenceScale, tolerance = 1e-6) {
|
|
11193
|
-
if (!this.difference(step, this.coarse) || !this.difference(step / 2, this.fine))
|
|
11194
|
-
return false;
|
|
11195
|
-
const bound = tolerance * Math.max(referenceScale, Math.abs(this.fine[0]), Math.abs(this.fine[1]), Math.abs(this.fine[2]));
|
|
11196
|
-
for (let i = 0; i < 3; i++) {
|
|
11197
|
-
if (Math.abs(this.coarse[i] - this.fine[i]) > bound)
|
|
11198
|
-
return false;
|
|
11199
|
-
this.fine[i] += (this.fine[i] - this.coarse[i]) / 15;
|
|
11200
|
-
if (!Number.isFinite(this.fine[i]))
|
|
11201
|
-
return false;
|
|
11202
|
-
}
|
|
11203
|
-
for (let i = 0; i < 3; i++)
|
|
11204
|
-
this.result[i] = this.fine[i];
|
|
11205
|
-
return true;
|
|
11206
|
-
}
|
|
11207
|
-
difference(step, output) {
|
|
11208
|
-
const [a, b, c, d] = this.samples;
|
|
11209
|
-
if (!this.sample(-2 * step, a) || !this.sample(-step, b) || !this.sample(step, c) || !this.sample(2 * step, d))
|
|
11210
|
-
return false;
|
|
11211
|
-
for (let i = 0; i < 3; i++) {
|
|
11212
|
-
output[i] = (a[i] - d[i] + 8 * (c[i] - b[i])) / (12 * step);
|
|
11213
|
-
if (!Number.isFinite(output[i]))
|
|
11214
|
-
return false;
|
|
11215
|
-
}
|
|
11216
|
-
return true;
|
|
11217
|
-
}
|
|
11218
|
-
};
|
|
11219
|
-
}
|
|
11220
|
-
});
|
|
11221
|
-
|
|
11222
|
-
// dist/projection/experimental/crs-rendering-scale.js
|
|
11223
|
-
function isEarth(ellipsoid) {
|
|
11224
|
-
return Math.abs(ellipsoid.semiMajorAxis - 6375e3) < 7e-3 * 6375e3;
|
|
11225
|
-
}
|
|
11226
|
-
function validateScale(scale3) {
|
|
11227
|
-
if (scale3.length !== 3 || scale3.some((value2) => !Number.isFinite(value2) || value2 <= 0))
|
|
11228
|
-
throw new Error("Invalid CRS rendering scale");
|
|
11229
|
-
return scale3;
|
|
11230
|
-
}
|
|
11231
|
-
function createRenderingScale(crs, projection, axis, center3) {
|
|
11232
|
-
if (crs.kind === "geocentric")
|
|
11233
|
-
return validateScale([crs.toMeter, crs.toMeter, crs.toMeter]);
|
|
11234
|
-
if (crs.kind === "identity") {
|
|
11235
|
-
return validateScale([...axis].map((direction) => /[ud]/.test(direction) ? crs.verticalUnit : crs.toMeter));
|
|
11236
|
-
}
|
|
11237
|
-
const anchor = [0, 0, 0], input = [0, 0, 0], geographic2 = [0, 0, 0], sample2 = [0, 0, 0];
|
|
11238
|
-
const derivatives = Array.from({ length: 3 }, () => [0, 0, 0]);
|
|
11239
|
-
const body = isEarth(crs.ellipsoid) ? WGS84 : crs.ellipsoid;
|
|
11240
|
-
let component = 0, longitudeMeters = 0, latitudeMeters = 0, busy = false;
|
|
11241
|
-
const numerical = new NumericalDerivative((offset, output) => {
|
|
11242
|
-
for (let i = 0; i < 3; i++)
|
|
11243
|
-
input[i] = anchor[i];
|
|
11244
|
-
input[component] += offset;
|
|
11245
|
-
projection.unprojectTo(input, sample2);
|
|
11246
|
-
const rawDelta = sample2[0] - geographic2[0];
|
|
11247
|
-
const delta = Math.abs(rawDelta) <= 180 ? rawDelta : ((rawDelta + 180) % 360 + 360) % 360 - 180;
|
|
11248
|
-
if (Math.abs(sample2[1]) >= 90)
|
|
11249
|
-
return false;
|
|
11250
|
-
output[0] = delta * longitudeMeters;
|
|
11251
|
-
output[1] = (sample2[1] - geographic2[1]) * latitudeMeters;
|
|
11252
|
-
output[2] = sample2[2] - geographic2[2];
|
|
11253
|
-
return output.every(Number.isFinite);
|
|
11254
|
-
});
|
|
11255
|
-
return (coordinate) => {
|
|
11256
|
-
if (busy || coordinate.length < 2)
|
|
11257
|
-
return null;
|
|
11258
|
-
busy = true;
|
|
11259
|
-
let scale3;
|
|
11260
|
-
try {
|
|
11261
|
-
anchor[0] = coordinate[0];
|
|
11262
|
-
anchor[1] = coordinate[1];
|
|
11263
|
-
anchor[2] = coordinate[2] ?? 0;
|
|
11264
|
-
if (!anchor.every(Number.isFinite))
|
|
11265
|
-
return null;
|
|
11266
|
-
projection.unprojectTo(anchor, geographic2);
|
|
11267
|
-
const latitude = geographic2[1] * RADIANS;
|
|
11268
|
-
const a = body.semiMajorAxis, es = body.eccentricitySquared;
|
|
11269
|
-
const denominator = 1 - es * Math.sin(latitude) ** 2;
|
|
11270
|
-
longitudeMeters = a * Math.cos(latitude) / Math.sqrt(denominator) * RADIANS;
|
|
11271
|
-
latitudeMeters = a * (1 - es) / denominator ** 1.5 * RADIANS;
|
|
11272
|
-
if (!(longitudeMeters > a * RADIANS * 1e-8) || !(latitudeMeters > 0))
|
|
11273
|
-
return null;
|
|
11274
|
-
const offset = ((geographic2[0] - center3 + 180) % 360 + 360) % 360 - 180;
|
|
11275
|
-
const hasLongitudeSeam = crs.kind === "geographic" ? crs.longitudeWrap !== void 0 : !Object.prototype.hasOwnProperty.call(crs.parameters, "over");
|
|
11276
|
-
if (hasLongitudeSeam && Math.abs(offset) + 2 / longitudeMeters >= 180 || Math.abs(geographic2[1]) + 2 / latitudeMeters >= 90)
|
|
11277
|
-
return null;
|
|
11278
|
-
for (component = 0; component < 3; component++) {
|
|
11279
|
-
const direction = axis[component];
|
|
11280
|
-
const nominalMeters = /[ud]/.test(direction) ? crs.verticalUnit : crs.kind === "geographic" ? (/[ew]/.test(direction) ? longitudeMeters : latitudeMeters) * crs.angularUnit / RADIANS : crs.toMeter;
|
|
11281
|
-
if (!numerical.evaluate(1 / nominalMeters, nominalMeters))
|
|
11282
|
-
return null;
|
|
11283
|
-
for (let i = 0; i < 3; i++)
|
|
11284
|
-
derivatives[component][i] = numerical.result[i];
|
|
11285
|
-
}
|
|
11286
|
-
scale3 = derivatives.map((derivative) => Math.hypot(...derivative));
|
|
11287
|
-
if (crs.kind === "projected") {
|
|
11288
|
-
const east = derivatives[axis.search(/[ew]/)];
|
|
11289
|
-
const north = derivatives[axis.search(/[ns]/)];
|
|
11290
|
-
const inverseArea = Math.abs(east[0] * north[1] - east[1] * north[0]) / crs.toMeter ** 2;
|
|
11291
|
-
scale3[axis.search(/[ud]/)] = crs.verticalUnit * Math.sqrt(inverseArea);
|
|
11292
|
-
}
|
|
11293
|
-
} catch {
|
|
11294
|
-
return null;
|
|
11295
|
-
} finally {
|
|
11296
|
-
busy = false;
|
|
11297
|
-
}
|
|
11298
|
-
return validateScale(scale3);
|
|
11299
|
-
};
|
|
11300
|
-
}
|
|
11301
|
-
var RADIANS, WGS84;
|
|
11302
|
-
var init_crs_rendering_scale = __esm({
|
|
11303
|
-
"dist/projection/experimental/crs-rendering-scale.js"() {
|
|
11304
|
-
init_numerical_derivative();
|
|
11305
|
-
init_normalize();
|
|
11306
|
-
RADIANS = Math.PI / 180;
|
|
11307
|
-
WGS84 = normalizeCRS("WGS84").ellipsoid;
|
|
11308
|
-
}
|
|
11309
|
-
});
|
|
11310
|
-
|
|
11311
|
-
// dist/projection/experimental/scalar-output.js
|
|
11312
|
-
function validateScalarOutput(coordinate, output, length) {
|
|
11313
|
-
if (!(Array.isArray(coordinate) || coordinate instanceof Float32Array || coordinate instanceof Float64Array))
|
|
11314
|
-
throw new Error("Scalar input requires a number array, Float32Array or Float64Array");
|
|
11315
|
-
if (!(Array.isArray(output) || output instanceof Float32Array || output instanceof Float64Array) || output.length < length)
|
|
11316
|
-
throw new Error("Scalar output requires a preallocated number array, Float32Array or Float64Array with sufficient capacity");
|
|
11317
|
-
if (coordinate === output || Array.isArray(coordinate) || Array.isArray(output))
|
|
11318
|
-
return;
|
|
11319
|
-
const input = coordinate;
|
|
11320
|
-
const result = output;
|
|
11321
|
-
const shared = typeof SharedArrayBuffer !== "undefined" && input.buffer instanceof SharedArrayBuffer && result.buffer instanceof SharedArrayBuffer;
|
|
11322
|
-
if ((input.buffer === result.buffer || shared) && input.byteOffset < result.byteOffset + length * result.BYTES_PER_ELEMENT && result.byteOffset < input.byteOffset + input.byteLength)
|
|
11323
|
-
throw new Error("Scalar input/output views overlap; use the same view for in-place projection");
|
|
11324
|
-
}
|
|
11325
|
-
function writeScalarOutput(coordinate, output, point, length) {
|
|
11326
|
-
if (output instanceof Float32Array) {
|
|
11327
|
-
if (Math.abs(point.x) > FLOAT32_MAX || Math.abs(point.y) > FLOAT32_MAX || length >= 3 && Math.abs(point.z) > FLOAT32_MAX)
|
|
11328
|
-
throw new Error("Projected coordinate exceeds Float32 range");
|
|
11329
|
-
for (let i = 3; i < coordinate.length; i++) {
|
|
11330
|
-
const value2 = coordinate[i];
|
|
11331
|
-
if (Number.isFinite(value2) && Math.abs(value2) > FLOAT32_MAX)
|
|
11332
|
-
throw new Error("Trailing ordinate exceeds Float32 range");
|
|
11333
|
-
}
|
|
11334
|
-
}
|
|
11335
|
-
for (let i = 3; i < coordinate.length; i++)
|
|
11336
|
-
output[i] = coordinate[i];
|
|
11337
|
-
output[0] = point.x;
|
|
11338
|
-
output[1] = point.y;
|
|
11339
|
-
if (length >= 3)
|
|
11340
|
-
output[2] = point.z;
|
|
11341
|
-
return output;
|
|
11342
|
-
}
|
|
11343
|
-
var FLOAT32_MAX;
|
|
11344
|
-
var init_scalar_output = __esm({
|
|
11345
|
-
"dist/projection/experimental/scalar-output.js"() {
|
|
11346
|
-
FLOAT32_MAX = 34028234663852886e22;
|
|
11347
|
-
}
|
|
11348
|
-
});
|
|
11349
|
-
|
|
11350
|
-
// dist/projection/experimental/crs-descriptor.js
|
|
11351
|
-
async function resolveCRSDescriptor(engine, definition, normalization, options = {}, useDefinitionSignature = false, prepareInput) {
|
|
11352
|
-
const captured = typeof definition === "string" ? definition : JSON.parse(JSON.stringify(definition));
|
|
11353
|
-
const conventions = {
|
|
11354
|
-
enforceAxis: normalization.enforceAxis,
|
|
11355
|
-
mode: normalization.mode,
|
|
11356
|
-
...options,
|
|
11357
|
-
converters: options.converters && [...options.converters]
|
|
11358
|
-
};
|
|
11359
|
-
const input = prepareInput ? await prepareInput(captured, { ...normalization, ...conventions }) : captured;
|
|
11360
|
-
const crs = normalizeCRS(input, { ...normalization, ...conventions });
|
|
11361
|
-
const projection = await engine.createProjectionAsync({
|
|
11362
|
-
...conventions,
|
|
11363
|
-
from: "WGS84",
|
|
11364
|
-
to: input
|
|
11365
|
-
});
|
|
11366
|
-
const axis = crs.storedAxis || (conventions.enforceAxis ? crs.axis : "enu");
|
|
11367
|
-
const horizontalUnit = getUnit(crs.kind === "geographic" ? crs.angularUnit : crs.toMeter, crs.kind === "geographic");
|
|
11368
|
-
const heightUnit = getUnit(crs.verticalUnit, false);
|
|
11369
|
-
const units2 = [...axis].map((direction) => crs.kind !== "geocentric" && /[ud]/.test(direction) ? heightUnit : horizontalUnit);
|
|
11370
|
-
const profile = projection.targetProfile;
|
|
11371
|
-
if (!profile)
|
|
11372
|
-
throw new Error("Projection must define a rendering profile for CRS retrieval");
|
|
11373
|
-
const center3 = (projection.targetLongitudeOrigin + crs.primeMeridian) * 180 / Math.PI;
|
|
11374
|
-
const bounds2 = adaptBounds(profile, crs, axis);
|
|
11375
|
-
const normalizeWGS84 = createNormalization(profile.normalize);
|
|
11376
|
-
const renderingScale = createRenderingScale(crs, projection, axis, center3);
|
|
11377
|
-
const sources = [.../* @__PURE__ */ new Set(["WGS84", ...conventions.converters || []])];
|
|
11378
|
-
if (sources.some((source) => typeof source !== "string" || !source.trim()))
|
|
11379
|
-
throw new Error("Converter source CRS must be a nonempty string");
|
|
11380
|
-
const entries = await Promise.all(sources.map(async (source) => {
|
|
11381
|
-
if (source === "WGS84")
|
|
11382
|
-
return [source, createConverter(projection, normalizeWGS84)];
|
|
11383
|
-
const [pair2, geographic2] = await Promise.all([
|
|
11384
|
-
engine.createProjectionAsync({ ...conventions, from: source, to: input }),
|
|
11385
|
-
engine.createProjectionAsync({ ...conventions, from: "WGS84", to: source })
|
|
11386
|
-
]);
|
|
11387
|
-
return [
|
|
11388
|
-
source,
|
|
11389
|
-
createConverter(pair2, createSourceNormalization(geographic2, normalizeWGS84))
|
|
11390
|
-
];
|
|
11391
|
-
}));
|
|
11392
|
-
const converter = Object.assign(/* @__PURE__ */ Object.create(null), Object.fromEntries(entries));
|
|
11393
|
-
const metadata = {
|
|
11394
|
-
coordinateFrame: crs.kind,
|
|
11395
|
-
projection: crs.projection,
|
|
11396
|
-
parameters: crs.parameters,
|
|
11397
|
-
ellipsoid: {
|
|
11398
|
-
semiMajorAxis: crs.ellipsoid.semiMajorAxis,
|
|
11399
|
-
semiMinorAxis: crs.ellipsoid.semiMinorAxis
|
|
11400
|
-
},
|
|
11401
|
-
axis,
|
|
11402
|
-
xUnit: units2[0],
|
|
11403
|
-
yUnit: units2[1],
|
|
11404
|
-
zUnit: units2[2],
|
|
11405
|
-
areaOfUse: crs.areaOfUse,
|
|
11406
|
-
lossy: crs.lossy
|
|
11407
|
-
};
|
|
11408
|
-
return {
|
|
11409
|
-
...metadata,
|
|
11410
|
-
// Exact caller identity is sufficient under default execution conventions.
|
|
11411
|
-
// Additional source converters do not change the target CRS.
|
|
11412
|
-
signature: useDefinitionSignature && typeof input === "string" && !conventions.enforceAxis && !crs.lossy ? input : getCRSSignature(metadata),
|
|
11413
|
-
renderingBounds: bounds2,
|
|
11414
|
-
renderingScale,
|
|
11415
|
-
getRenderingScale: (coordinate) => typeof renderingScale === "function" ? renderingScale(coordinate) : renderingScale,
|
|
11416
|
-
converter
|
|
11417
|
-
};
|
|
11418
|
-
}
|
|
11419
|
-
function createConverter(projection, normalize2) {
|
|
11420
|
-
return {
|
|
11421
|
-
from: createConversion(projection.project.bind(projection), projection.projectTo.bind(projection)),
|
|
11422
|
-
to: createConversion(projection.unproject.bind(projection), projection.unprojectTo.bind(projection)),
|
|
11423
|
-
normalize: normalize2
|
|
11424
|
-
};
|
|
11425
|
-
}
|
|
11426
|
-
function createSourceNormalization(geographic2, normalizeWGS84) {
|
|
11427
|
-
function normalize2(coordinate, output) {
|
|
11428
|
-
if (output !== void 0)
|
|
11429
|
-
validateScalarOutput(coordinate, output, coordinate.length);
|
|
11430
|
-
const wgs842 = geographic2.unproject(Array.from(coordinate));
|
|
11431
|
-
const [longitude3, latitude, altitude] = wgs842;
|
|
11432
|
-
normalizeWGS84(wgs842, wgs842);
|
|
11433
|
-
if (wgs842[0] === longitude3 && wgs842[1] === latitude && wgs842[2] === altitude) {
|
|
11434
|
-
return output === void 0 ? Array.from(coordinate) : writeScalarOutput(coordinate, output, { x: coordinate[0], y: coordinate[1], z: coordinate[2] ?? 0 }, coordinate.length);
|
|
11435
|
-
}
|
|
11436
|
-
return output === void 0 ? geographic2.project(wgs842) : geographic2.projectTo(wgs842, output);
|
|
11437
|
-
}
|
|
11438
|
-
return normalize2;
|
|
11439
|
-
}
|
|
11440
|
-
function createConversion(allocate, write) {
|
|
11441
|
-
function convert(coordinate, output) {
|
|
11442
|
-
return output === void 0 ? allocate(Array.isArray(coordinate) ? coordinate : Array.from(coordinate)) : write(coordinate, output);
|
|
11443
|
-
}
|
|
11444
|
-
return convert;
|
|
11445
|
-
}
|
|
11446
|
-
function createNormalization(normalizeDomain) {
|
|
11447
|
-
function normalize2(coordinate, output) {
|
|
11448
|
-
const result = output ?? new Array(coordinate.length);
|
|
11449
|
-
validateScalarOutput(coordinate, result, coordinate.length);
|
|
11450
|
-
const longitude3 = coordinate[0], latitude = coordinate[1], altitude = coordinate[2] ?? 0;
|
|
11451
|
-
if (coordinate.length < 2 || !Number.isFinite(longitude3) || !Number.isFinite(latitude) || !Number.isFinite(altitude))
|
|
11452
|
-
throw new Error("Normalization requires finite longitude, latitude and altitude");
|
|
11453
|
-
const point = { x: longitude3, y: latitude, z: altitude };
|
|
11454
|
-
normalizeDomain == null ? void 0 : normalizeDomain(point);
|
|
11455
|
-
return writeScalarOutput(coordinate, result, point, coordinate.length);
|
|
11456
|
-
}
|
|
11457
|
-
return normalize2;
|
|
11458
|
-
}
|
|
11459
|
-
function adaptBounds(profile, crs, axis) {
|
|
11460
|
-
const horizontalUnit = crs.kind === "geographic" ? crs.angularUnit : crs.toMeter;
|
|
11461
|
-
const units2 = [
|
|
11462
|
-
horizontalUnit,
|
|
11463
|
-
horizontalUnit,
|
|
11464
|
-
crs.kind === "geocentric" ? crs.toMeter : crs.verticalUnit
|
|
11465
|
-
];
|
|
11466
|
-
const bounds2 = profile.bounds;
|
|
11467
|
-
const limits = [...axis].map((direction) => {
|
|
11468
|
-
const index = /[ew]/.test(direction) ? 0 : /[ns]/.test(direction) ? 1 : 2;
|
|
11469
|
-
const minimum = bounds2[0][index] / units2[index];
|
|
11470
|
-
const maximum = bounds2[1][index] / units2[index];
|
|
11471
|
-
return /[wsd]/.test(direction) ? [-maximum, -minimum] : [minimum, maximum];
|
|
11472
|
-
});
|
|
11473
|
-
return [
|
|
11474
|
-
[limits[0][0], limits[1][0], limits[2][0]],
|
|
11475
|
-
[limits[0][1], limits[1][1], limits[2][1]]
|
|
11476
|
-
];
|
|
11477
|
-
}
|
|
11478
|
-
function getUnit(factor, angular) {
|
|
11479
|
-
const units2 = angular ? ANGULAR_UNITS : LINEAR_UNITS;
|
|
11480
|
-
const name = Object.keys(units2).find((candidate) => units2[candidate] === factor) || "custom";
|
|
11481
|
-
return angular ? { name, degreesPerUnit: factor / ANGULAR_UNITS["degrees"] } : { name, metersPerUnit: factor };
|
|
11482
|
-
}
|
|
11483
|
-
var ANGULAR_UNITS, LINEAR_UNITS;
|
|
11484
|
-
var init_crs_descriptor = __esm({
|
|
11485
|
-
"dist/projection/experimental/crs-descriptor.js"() {
|
|
11486
|
-
init_normalize();
|
|
11487
|
-
init_crs_rendering_scale();
|
|
11488
|
-
init_scalar_output();
|
|
11489
|
-
init_crs_metadata();
|
|
11490
|
-
ANGULAR_UNITS = {
|
|
11491
|
-
degrees: Math.PI / 180,
|
|
11492
|
-
radians: 1,
|
|
11493
|
-
gradians: Math.PI / 200
|
|
11494
|
-
};
|
|
11495
|
-
LINEAR_UNITS = {
|
|
11496
|
-
...Object.fromEntries(Object.values(linearUnits).map((unit3) => [unit3.name, unit3.metersPerUnit]))
|
|
11497
|
-
};
|
|
11498
|
-
}
|
|
11499
|
-
});
|
|
11500
|
-
|
|
11501
|
-
// dist/projection/experimental/engine-options.js
|
|
11502
|
-
function snapshotEngineOptions(options) {
|
|
11503
|
-
return {
|
|
11504
|
-
...options,
|
|
11505
|
-
projections: options.projections && [...options.projections],
|
|
11506
|
-
parsers: options.parsers && [...options.parsers],
|
|
11507
|
-
datumCatalogs: options.datumCatalogs && [...options.datumCatalogs],
|
|
11508
|
-
aliases: options.aliases && JSON.parse(JSON.stringify(options.aliases)),
|
|
11509
|
-
datumGrids: options.datumGrids && { ...options.datumGrids },
|
|
11510
|
-
verticalGrids: options.verticalGrids && { ...options.verticalGrids }
|
|
11511
|
-
};
|
|
11512
|
-
}
|
|
11513
|
-
function hasCRSOverrides(options) {
|
|
11514
|
-
return Boolean(options.projections || options.parsers || options.datumCatalogs || options.aliases || options.datumGrids || options.verticalGrids || options.resolver);
|
|
11515
|
-
}
|
|
11516
|
-
var init_engine_options = __esm({
|
|
11517
|
-
"dist/projection/experimental/engine-options.js"() {
|
|
11518
|
-
}
|
|
11519
|
-
});
|
|
11520
|
-
|
|
11521
|
-
// dist/projection/experimental/crs/resolve.js
|
|
11522
|
-
async function prepareEngineOptions(options) {
|
|
11523
|
-
const captured = {
|
|
11524
|
-
...options,
|
|
11525
|
-
from: capture(options.from ?? "WGS84"),
|
|
11526
|
-
to: capture(options.to ?? "WGS84")
|
|
11527
|
-
};
|
|
11528
|
-
const [from, to] = await Promise.all([
|
|
11529
|
-
prepareCRSInput(captured.from, captured),
|
|
11530
|
-
prepareCRSInput(captured.to, captured)
|
|
11531
|
-
]);
|
|
11532
|
-
return { ...captured, from, to };
|
|
11533
|
-
}
|
|
11534
|
-
async function prepareCRSInput(captured, options) {
|
|
11535
|
-
var _a3;
|
|
11536
|
-
const source = resolveCRSInput(captured, options);
|
|
11537
|
-
const local = resolveLocalCRSDefinition(source.definition, options);
|
|
11538
|
-
const reference = typeof captured === "string" || "type" in captured ? void 0 : "crs" in captured ? captured.crs : captured;
|
|
11539
|
-
const representation = local === source.definition && reference ? reference.representation : inferCRSRepresentation(local);
|
|
11540
|
-
if (representation !== "identifier" || ((_a3 = options.parsers) == null ? void 0 : _a3.some((p) => p.canParse(local)))) {
|
|
11541
|
-
return captured;
|
|
11542
|
-
}
|
|
11543
|
-
const result = await options.resolver.resolve({
|
|
11544
|
-
state: "explicit",
|
|
11545
|
-
provenance: (reference == null ? void 0 : reference.provenance) ?? "unknown",
|
|
11546
|
-
definition: local,
|
|
11547
|
-
representation
|
|
11548
|
-
});
|
|
11549
|
-
const definition = resolveCRSInput(result.input, options).definition;
|
|
11550
|
-
if (!reference)
|
|
11551
|
-
return definition;
|
|
11552
|
-
const metadata = captured;
|
|
11553
|
-
const resolved2 = {
|
|
11554
|
-
...reference,
|
|
11555
|
-
definition,
|
|
11556
|
-
representation: inferCRSRepresentation(definition),
|
|
11557
|
-
alternatives: [
|
|
11558
|
-
{ definition: reference.definition, representation: reference.representation },
|
|
11559
|
-
...reference.alternatives ?? []
|
|
11560
|
-
]
|
|
11561
|
-
};
|
|
11562
|
-
return "crs" in metadata ? { ...metadata, crs: resolved2 } : resolved2;
|
|
11563
|
-
}
|
|
11564
|
-
function capture(input) {
|
|
11565
|
-
return typeof input === "string" ? input : JSON.parse(JSON.stringify(input));
|
|
11566
|
-
}
|
|
11567
|
-
var init_resolve = __esm({
|
|
11568
|
-
"dist/projection/experimental/crs/resolve.js"() {
|
|
11569
|
-
init_spatial_reference();
|
|
11570
|
-
init_normalize();
|
|
11571
|
-
init_spatial_reference2();
|
|
11572
|
-
}
|
|
11573
|
-
});
|
|
11574
|
-
|
|
11575
|
-
// dist/projection/experimental/rendering-profile/geographic-bounds.js
|
|
11576
|
-
function createAngularRanges(west, south, east, north) {
|
|
11577
|
-
return [
|
|
11578
|
-
[west, south],
|
|
11579
|
-
[east, north]
|
|
11580
|
-
];
|
|
11581
|
-
}
|
|
11582
|
-
function normalizeLongitude(longitude3) {
|
|
11583
|
-
return longitude3 >= -180 && longitude3 < 180 ? longitude3 : ((longitude3 + 180) % 360 + 360) % 360 - 180;
|
|
11584
|
-
}
|
|
11585
|
-
function createGeographicBounds(west, south, east, north) {
|
|
11586
|
-
if (![west, south, east, north].every(Number.isFinite) || south < -90 || north > 90 || south > north || east - west < -360 || east - west > 360 + 1e-10)
|
|
11587
|
-
throw new Error("Invalid geographic coverage");
|
|
11588
|
-
if (east - west >= 360 - 1e-10)
|
|
11589
|
-
return [-180, south, 180, north];
|
|
11590
|
-
const wrappedEast = normalizeLongitude(east);
|
|
11591
|
-
return [
|
|
11592
|
-
normalizeLongitude(west),
|
|
11593
|
-
south,
|
|
11594
|
-
wrappedEast === -180 && east > west ? 180 : wrappedEast,
|
|
11595
|
-
north
|
|
11596
|
-
];
|
|
11597
|
-
}
|
|
11598
|
-
function getLongitudeSpan(bounds2) {
|
|
11599
|
-
const span = bounds2[2] - bounds2[0];
|
|
11600
|
-
return span < 0 ? span + 360 : span;
|
|
11601
|
-
}
|
|
11602
|
-
function splitGeographicBounds(bounds2) {
|
|
11603
|
-
const [west, south, east, north] = bounds2;
|
|
11604
|
-
return west <= east ? [bounds2] : [
|
|
11605
|
-
[west, south, 180, north],
|
|
11606
|
-
[-180, south, east, north]
|
|
11607
|
-
];
|
|
11608
|
-
}
|
|
11609
|
-
function containsGeographicPoint(bounds2, point) {
|
|
11610
|
-
const [west, south, east, north] = bounds2;
|
|
11611
|
-
const longitude3 = normalizeLongitude(point[0]);
|
|
11612
|
-
return point[1] >= south && point[1] <= north && (west <= east ? longitude3 >= west && longitude3 <= east || longitude3 === -180 && east === 180 : longitude3 >= west || longitude3 <= east);
|
|
11613
|
-
}
|
|
11614
|
-
function intersectGeographicBounds(a, b) {
|
|
11615
|
-
const south = Math.max(a[1], b[1]), north = Math.min(a[3], b[3]);
|
|
11616
|
-
if (south > north)
|
|
11617
|
-
return [];
|
|
11618
|
-
const intervals = [];
|
|
11619
|
-
for (const left of splitGeographicBounds(a))
|
|
11620
|
-
for (const right of splitGeographicBounds(b)) {
|
|
11621
|
-
const west = Math.max(left[0], right[0]), east = Math.min(left[2], right[2]);
|
|
11622
|
-
if (west <= east)
|
|
11623
|
-
intervals.push([west, east]);
|
|
11624
|
-
else if (left[2] === 180 && right[0] === -180 || right[2] === 180 && left[0] === -180)
|
|
11625
|
-
intervals.push([-180, -180]);
|
|
11626
|
-
}
|
|
11627
|
-
intervals.sort((left, right) => left[0] - right[0]);
|
|
11628
|
-
const merged = [];
|
|
11629
|
-
for (const interval of intervals) {
|
|
11630
|
-
const last = merged[merged.length - 1];
|
|
11631
|
-
if (last && interval[0] <= last[1])
|
|
11632
|
-
last[1] = Math.max(last[1], interval[1]);
|
|
11633
|
-
else
|
|
11634
|
-
merged.push([...interval]);
|
|
11635
|
-
}
|
|
11636
|
-
if (merged.length > 1 && merged[0][0] === -180 && merged[merged.length - 1][1] === 180) {
|
|
11637
|
-
const first = merged.shift(), last = merged.pop();
|
|
11638
|
-
return [
|
|
11639
|
-
[last[0], south, first[1], north],
|
|
11640
|
-
...merged.map(([west, east]) => [west, south, east, north])
|
|
11641
|
-
];
|
|
11642
|
-
}
|
|
11643
|
-
return merged.map(([west, east]) => [west, south, east, north]);
|
|
11644
|
-
}
|
|
11645
|
-
function clampGeographicPoint(bounds2, point) {
|
|
11646
|
-
let longitude3 = normalizeLongitude(point[0]);
|
|
11647
|
-
const latitude = Math.max(bounds2[1], Math.min(bounds2[3], point[1]));
|
|
11648
|
-
if (!containsGeographicPoint(bounds2, [longitude3, latitude])) {
|
|
11649
|
-
const westDistance = Math.abs(normalizeLongitude(longitude3 - bounds2[0]));
|
|
11650
|
-
const eastDistance = Math.abs(normalizeLongitude(longitude3 - bounds2[2]));
|
|
11651
|
-
longitude3 = westDistance <= eastDistance ? bounds2[0] : bounds2[2];
|
|
11652
|
-
}
|
|
11653
|
-
return [longitude3, latitude];
|
|
11654
|
-
}
|
|
11655
|
-
function getAngularRanges(bounds2, primeMeridian2 = 0, origin = 0) {
|
|
11656
|
-
const width = getLongitudeSpan(bounds2);
|
|
11657
|
-
const west = bounds2[0] * RADIANS2 - primeMeridian2;
|
|
11658
|
-
const middle = west + width * RADIANS2 / 2;
|
|
11659
|
-
const shift = Math.round((origin - middle) / (2 * Math.PI)) * 2 * Math.PI;
|
|
11660
|
-
return createAngularRanges(width === 360 ? origin - Math.PI : west + shift, bounds2[1] * RADIANS2, width === 360 ? origin + Math.PI : west + shift + width * RADIANS2, bounds2[3] * RADIANS2);
|
|
11661
|
-
}
|
|
11662
|
-
function getGeographicBounds(ranges, primeMeridian2 = 0) {
|
|
11663
|
-
return createGeographicBounds((ranges[0][0] + primeMeridian2) / RADIANS2, ranges[0][1] / RADIANS2, (ranges[1][0] + primeMeridian2) / RADIANS2, ranges[1][1] / RADIANS2);
|
|
11664
|
-
}
|
|
11665
|
-
function unionRenderingBounds(bounds2) {
|
|
11666
|
-
if (!bounds2.length)
|
|
11667
|
-
throw new Error("CRS coverage does not intersect the rendering target");
|
|
11668
|
-
return [
|
|
11669
|
-
[0, 1, 2].map((axis) => Math.min(...bounds2.map((pair2) => pair2[0][axis]))),
|
|
11670
|
-
[0, 1, 2].map((axis) => Math.max(...bounds2.map((pair2) => pair2[1][axis])))
|
|
11671
|
-
];
|
|
11672
|
-
}
|
|
11673
|
-
var RADIANS2;
|
|
11674
|
-
var init_geographic_bounds = __esm({
|
|
11675
|
-
"dist/projection/experimental/rendering-profile/geographic-bounds.js"() {
|
|
11676
|
-
RADIANS2 = Math.PI / 180;
|
|
11677
|
-
}
|
|
11678
|
-
});
|
|
11679
|
-
|
|
11680
|
-
// dist/projection/experimental/rendering-profile/rendering-profile.js
|
|
11681
|
-
function resolveRenderingProfile(getRenderingProfile, coverage) {
|
|
11682
|
-
if (coverage) {
|
|
11683
|
-
try {
|
|
11684
|
-
const profile2 = getRenderingProfile(coverage);
|
|
11685
|
-
return resolveBounds(profile2);
|
|
11686
|
-
} catch {
|
|
11687
|
-
}
|
|
11688
|
-
}
|
|
11689
|
-
const profile = getRenderingProfile();
|
|
11690
|
-
return resolveBounds(profile);
|
|
11691
|
-
}
|
|
11692
|
-
function resolveBounds(profile) {
|
|
11693
|
-
var _a3;
|
|
11694
|
-
const bounds2 = profile.bounds;
|
|
11695
|
-
if (bounds2.some((corner) => corner.some((value2) => !Number.isFinite(value2))))
|
|
11696
|
-
throw new Error("Projection rendering bounds must be finite");
|
|
11697
|
-
return { bounds: bounds2, normalize: (_a3 = profile.normalize) == null ? void 0 : _a3.bind(profile) };
|
|
11698
|
-
}
|
|
11699
|
-
function createAngularNormalization(normalize2, primeMeridian2 = 0) {
|
|
11700
|
-
return (point) => {
|
|
11701
|
-
const x = point.x * Math.PI / 180 - primeMeridian2;
|
|
11702
|
-
const y = point.y * Math.PI / 180;
|
|
11703
|
-
const native = { x, y, z: point.z };
|
|
11704
|
-
normalize2(native);
|
|
11705
|
-
if (native.x !== x)
|
|
11706
|
-
point.x = (native.x + primeMeridian2) * 180 / Math.PI;
|
|
11707
|
-
if (native.y !== y)
|
|
11708
|
-
point.y = native.y * 180 / Math.PI;
|
|
11709
|
-
};
|
|
11710
|
-
}
|
|
11711
|
-
function combineRenderingProfiles(regions2, getProfile) {
|
|
11712
|
-
const profiles = [];
|
|
11713
|
-
for (const region of regions2) {
|
|
11714
|
-
const profile = getProfile(region);
|
|
11715
|
-
if (profile !== null)
|
|
11716
|
-
profiles.push(resolveBounds(profile));
|
|
11717
|
-
}
|
|
11718
|
-
if (!profiles.length)
|
|
11719
|
-
return null;
|
|
11720
|
-
if (profiles.length === 1)
|
|
11721
|
-
return profiles[0];
|
|
11722
|
-
return {
|
|
11723
|
-
bounds: unionRenderingBounds(profiles.map((profile) => profile.bounds)),
|
|
11724
|
-
normalize(point) {
|
|
11725
|
-
var _a3;
|
|
11726
|
-
let bestX = point.x, bestY = point.y, best = Infinity;
|
|
11727
|
-
for (const profile of profiles) {
|
|
11728
|
-
const candidate = { x: point.x, y: point.y, z: point.z };
|
|
11729
|
-
(_a3 = profile.normalize) == null ? void 0 : _a3.call(profile, candidate);
|
|
11730
|
-
const distance3 = Math.sin((candidate.y - point.y) * Math.PI / 360) ** 2 + Math.cos(point.y * Math.PI / 180) * Math.cos(candidate.y * Math.PI / 180) * Math.sin((candidate.x - point.x) * Math.PI / 360) ** 2;
|
|
11731
|
-
if (distance3 < best) {
|
|
11732
|
-
best = distance3;
|
|
11733
|
-
bestX = candidate.x;
|
|
11734
|
-
bestY = candidate.y;
|
|
11735
|
-
}
|
|
11736
|
-
}
|
|
11737
|
-
point.x = bestX;
|
|
11738
|
-
point.y = bestY;
|
|
11739
|
-
}
|
|
11740
|
-
};
|
|
11741
|
-
}
|
|
11742
|
-
var init_rendering_profile = __esm({
|
|
11743
|
-
"dist/projection/experimental/rendering-profile/rendering-profile.js"() {
|
|
11744
|
-
init_geographic_bounds();
|
|
11745
|
-
}
|
|
11746
|
-
});
|
|
11747
|
-
|
|
11748
|
-
// dist/projection/experimental/rendering-profile/identity-rendering-profile.js
|
|
11749
|
-
function getIdentityRenderingProfile() {
|
|
11750
|
-
return {
|
|
11751
|
-
bounds: [
|
|
11752
|
-
[-1, -1, 0],
|
|
11753
|
-
[1, 1, 0]
|
|
11754
|
-
]
|
|
11755
|
-
};
|
|
11756
|
-
}
|
|
11757
|
-
var init_identity_rendering_profile = __esm({
|
|
11758
|
-
"dist/projection/experimental/rendering-profile/identity-rendering-profile.js"() {
|
|
11759
|
-
}
|
|
11760
|
-
});
|
|
11761
|
-
|
|
11762
|
-
// dist/projection/experimental/projection-descriptor.js
|
|
11763
|
-
function cache() {
|
|
11764
|
-
const scope = globalThis;
|
|
11765
|
-
scope[CACHE_KEY] || (scope[CACHE_KEY] = /* @__PURE__ */ new WeakMap());
|
|
11766
|
-
return scope[CACHE_KEY];
|
|
11767
|
-
}
|
|
11768
|
-
function getLoadedProjection(projection) {
|
|
11769
|
-
var _a3;
|
|
11770
|
-
return "create" in projection ? projection : (_a3 = cache().get(projection)) == null ? void 0 : _a3.implementation;
|
|
11771
|
-
}
|
|
11772
|
-
function preloadProjection(projection) {
|
|
11773
|
-
if ("create" in projection)
|
|
11774
|
-
return Promise.resolve(projection);
|
|
11775
|
-
let state = cache().get(projection);
|
|
11776
|
-
if (!state) {
|
|
11777
|
-
state = { load: () => projection.preload() };
|
|
11778
|
-
cache().set(projection, state);
|
|
11779
|
-
}
|
|
11780
|
-
if (state.implementation)
|
|
11781
|
-
return Promise.resolve(state.implementation);
|
|
11782
|
-
const entry = state;
|
|
11783
|
-
entry.pending || (entry.pending = Promise.resolve().then(entry.load).then((plugin) => {
|
|
11784
|
-
const key3 = (value2) => value2.toLowerCase().replace(/[\s_-]/g, "");
|
|
11785
|
-
const supported = new Set([plugin.name, ...plugin.aliases || []].map(key3));
|
|
11786
|
-
if (typeof plugin.create !== "function" || ![projection.name, ...projection.aliases || []].every((name) => supported.has(key3(name))))
|
|
11787
|
-
throw new Error("Loaded projection does not match descriptor: " + projection.name);
|
|
11788
|
-
entry.implementation = plugin;
|
|
11789
|
-
return plugin;
|
|
11790
|
-
}).catch((error) => {
|
|
11791
|
-
entry.pending = void 0;
|
|
11792
|
-
throw error;
|
|
11793
|
-
}));
|
|
11794
|
-
return entry.pending;
|
|
11795
|
-
}
|
|
11796
|
-
var CACHE_KEY;
|
|
11797
|
-
var init_projection_descriptor = __esm({
|
|
11798
|
-
"dist/projection/experimental/projection-descriptor.js"() {
|
|
11799
|
-
CACHE_KEY = /* @__PURE__ */ Symbol.for("@math.gl/projection/projection-implementations");
|
|
11800
|
-
}
|
|
11801
|
-
});
|
|
11802
|
-
|
|
11803
|
-
// dist/projection/experimental/projection-scratch.js
|
|
11804
|
-
function createPoint() {
|
|
11805
|
-
return { x: 0, y: 0, z: 0 };
|
|
11806
|
-
}
|
|
11807
|
-
var ProjectionScratch;
|
|
11808
|
-
var init_projection_scratch = __esm({
|
|
11809
|
-
"dist/projection/experimental/projection-scratch.js"() {
|
|
11810
|
-
ProjectionScratch = class {
|
|
11811
|
-
constructor() {
|
|
11812
|
-
this.point = createPoint();
|
|
11813
|
-
this.points = [this.point];
|
|
11814
|
-
this.active = 0;
|
|
11815
|
-
}
|
|
11816
|
-
get depth() {
|
|
11817
|
-
return this.active;
|
|
11818
|
-
}
|
|
11819
|
-
acquire() {
|
|
11820
|
-
var _a3;
|
|
11821
|
-
const index = this.active++;
|
|
11822
|
-
(_a3 = this.points)[index] || (_a3[index] = createPoint());
|
|
11823
|
-
return this.points[index];
|
|
11824
|
-
}
|
|
11825
|
-
release(point) {
|
|
11826
|
-
if (this.active > 0 && this.points[this.active - 1] === point)
|
|
11827
|
-
this.active--;
|
|
11828
|
-
}
|
|
11829
|
-
};
|
|
11830
|
-
}
|
|
11831
|
-
});
|
|
11832
|
-
|
|
11833
|
-
// dist/projection/experimental/mutable-projection.js
|
|
11834
|
-
function createProjection(forward33, inverse34) {
|
|
11835
|
-
const scratch = new ProjectionScratch();
|
|
11836
|
-
const scalar = (x, y, operation2) => {
|
|
11837
|
-
const point = scratch.acquire();
|
|
11838
|
-
try {
|
|
11839
|
-
point.x = x;
|
|
11840
|
-
point.y = y;
|
|
11841
|
-
point.z = 0;
|
|
11842
|
-
operation2(point);
|
|
11843
|
-
return [point.x, point.y];
|
|
11844
|
-
} finally {
|
|
11845
|
-
scratch.release(point);
|
|
11846
|
-
}
|
|
11847
|
-
};
|
|
11848
|
-
return {
|
|
11849
|
-
forward(x, y) {
|
|
11850
|
-
return scalar(x, y, forward33);
|
|
11851
|
-
},
|
|
11852
|
-
inverse(x, y) {
|
|
11853
|
-
return scalar(x, y, inverse34);
|
|
11854
|
-
},
|
|
11855
|
-
forwardInPlace: forward33,
|
|
11856
|
-
inverseInPlace: inverse34
|
|
11857
|
-
};
|
|
11858
|
-
}
|
|
11859
|
-
function projectionOperation(implementation, inverse34, geocentric2 = false) {
|
|
11860
|
-
const mutable = inverse34 ? implementation.inverseInPlace : implementation.forwardInPlace;
|
|
11861
|
-
if (mutable)
|
|
11862
|
-
return mutable.bind(implementation);
|
|
11863
|
-
if (geocentric2) {
|
|
11864
|
-
const operation3 = inverse34 ? implementation.inverse3D : implementation.forward3D;
|
|
11865
|
-
return (point) => {
|
|
11866
|
-
const output = operation3.call(implementation, [point.x, point.y, point.z]);
|
|
11867
|
-
point.x = output[0];
|
|
11868
|
-
point.y = output[1];
|
|
11869
|
-
point.z = output[2];
|
|
11870
|
-
};
|
|
11871
|
-
}
|
|
11872
|
-
const operation2 = inverse34 ? implementation.inverse : implementation.forward;
|
|
11873
|
-
return (point) => {
|
|
11874
|
-
const output = operation2.call(implementation, point.x, point.y);
|
|
11875
|
-
point.x = output[0];
|
|
11876
|
-
point.y = output[1];
|
|
11877
|
-
};
|
|
11878
|
-
}
|
|
11879
|
-
var init_mutable_projection = __esm({
|
|
11880
|
-
"dist/projection/experimental/mutable-projection.js"() {
|
|
11881
|
-
init_projection_scratch();
|
|
11882
|
-
}
|
|
11883
|
-
});
|
|
11884
|
-
|
|
11885
|
-
// dist/projection/experimental/datum.js
|
|
11886
|
-
function geodeticToGeocentricInPlace(point, ellipsoid) {
|
|
11887
|
-
if (Math.abs(point.y) > Math.PI / 2)
|
|
11888
|
-
throw new Error("Latitude outside geocentric domain");
|
|
11889
|
-
if (!(0, import_matrix3.spheroidToCartesian)(point, ellipsoid))
|
|
11890
|
-
throw new Error("Geocentric coordinate must be finite");
|
|
11891
|
-
}
|
|
11892
|
-
function geocentricToGeodeticInPlace(point, ellipsoid) {
|
|
11893
|
-
const x = point.x, y = point.y, z = point.z;
|
|
11894
|
-
const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = ellipsoid;
|
|
11895
|
-
if (x === 0 && y === 0 && z === 0)
|
|
11896
|
-
throw new Error("Geodetic coordinates are undefined at the Earth center");
|
|
11897
|
-
if (es !== 0 && Math.abs(x) < 1e-12 * a && Math.abs(y) < 1e-12 * a && Math.hypot(x, y) < 1e-12 * a) {
|
|
11898
|
-
if (!Number.isFinite(Math.hypot(x, y, z)))
|
|
11899
|
-
throw new Error("Geocentric radius must be finite");
|
|
11900
|
-
point.x = 0;
|
|
11901
|
-
point.y = Math.sign(z) * Math.PI / 2;
|
|
11902
|
-
point.z = Math.abs(z) - b;
|
|
11903
|
-
return;
|
|
11904
|
-
}
|
|
11905
|
-
if (!(0, import_matrix3.cartesianToSpheroid)(point, ellipsoid)) {
|
|
11906
|
-
if (!Number.isFinite(Math.hypot(x, y, z)))
|
|
11907
|
-
throw new Error("Geocentric radius must be finite");
|
|
11908
|
-
throw new Error("Geocentric inverse did not converge");
|
|
11909
|
-
}
|
|
11910
|
-
}
|
|
11911
|
-
function createHelmert(values, inverse34) {
|
|
11912
|
-
const dx = values[0], dy = values[1], dz = values[2];
|
|
11913
|
-
const rx = (values[3] || 0) * ARC_SECOND, ry = (values[4] || 0) * ARC_SECOND, rz = (values[5] || 0) * ARC_SECOND;
|
|
11914
|
-
const scale3 = 1 + (values[6] || 0) / 1e6;
|
|
11915
|
-
return inverse34 ? (point) => {
|
|
11916
|
-
const x = (point.x - dx) / scale3, y = (point.y - dy) / scale3, z = (point.z - dz) / scale3;
|
|
11917
|
-
point.x = x + rz * y - ry * z;
|
|
11918
|
-
point.y = -rz * x + y + rx * z;
|
|
11919
|
-
point.z = ry * x - rx * y + z;
|
|
11920
|
-
} : (point) => {
|
|
11921
|
-
const x = point.x, y = point.y, z = point.z;
|
|
11922
|
-
point.x = scale3 * (x - rz * y + ry * z) + dx;
|
|
11923
|
-
point.y = scale3 * (rz * x + y - rx * z) + dy;
|
|
11924
|
-
point.z = scale3 * (-ry * x + rx * y + z) + dz;
|
|
11925
|
-
};
|
|
11926
|
-
}
|
|
11927
|
-
function shifted(datum) {
|
|
11928
|
-
var _a3;
|
|
11929
|
-
return Boolean((_a3 = datum.towgs84) == null ? void 0 : _a3.some((value2) => value2 !== 0));
|
|
11930
|
-
}
|
|
11931
|
-
function createDatumTransform(source, destination) {
|
|
11932
|
-
if (!source.towgs84 || !destination.towgs84)
|
|
11933
|
-
return void 0;
|
|
11934
|
-
if (source.grids || destination.grids) {
|
|
11935
|
-
if (source.grids && destination.grids && source.ellipsoid.semiMajorAxis === destination.ellipsoid.semiMajorAxis && source.ellipsoid.eccentricitySquared === destination.ellipsoid.eccentricitySquared && source.grids.length === destination.grids.length && source.grids.every((entry, i) => entry.name === destination.grids[i].name && entry.optional === destination.grids[i].optional && entry.grid === destination.grids[i].grid))
|
|
11936
|
-
return void 0;
|
|
11937
|
-
const middle = createDatumTransform(source.grids ? WGS842 : source, destination.grids ? WGS842 : destination);
|
|
11938
|
-
return (point) => {
|
|
11939
|
-
if (source.grids)
|
|
11940
|
-
applyDatumGrids(point, source, false);
|
|
11941
|
-
middle == null ? void 0 : middle(point);
|
|
11942
|
-
if (destination.grids)
|
|
11943
|
-
applyDatumGrids(point, destination, true);
|
|
11944
|
-
};
|
|
11945
|
-
}
|
|
11946
|
-
if (shifted(source) || shifted(destination)) {
|
|
11947
|
-
const first = convertDatum(source, WGS842), second = convertDatum(WGS842, destination);
|
|
11948
|
-
return (point) => {
|
|
11949
|
-
first == null ? void 0 : first(point);
|
|
11950
|
-
second == null ? void 0 : second(point);
|
|
11951
|
-
};
|
|
11952
|
-
}
|
|
11953
|
-
return convertDatum(source, destination);
|
|
11954
|
-
}
|
|
11955
|
-
function convertDatum(from, to) {
|
|
11956
|
-
if (!from.towgs84 || !to.towgs84)
|
|
11957
|
-
return void 0;
|
|
11958
|
-
const a = from.ellipsoid, b = to.ellipsoid;
|
|
11959
|
-
let sameParameters = true;
|
|
11960
|
-
for (let i = 0; i < 7; i++)
|
|
11961
|
-
if ((from.towgs84[i] || 0) !== (to.towgs84[i] || 0))
|
|
11962
|
-
sameParameters = false;
|
|
11963
|
-
if (a.semiMajorAxis === b.semiMajorAxis && Math.abs(a.eccentricitySquared - b.eccentricitySquared) <= 5e-11 && sameParameters)
|
|
11964
|
-
return void 0;
|
|
11965
|
-
const sourceShift = shifted(from) ? createHelmert(from.towgs84, false) : void 0, targetShift = shifted(to) ? createHelmert(to.towgs84, true) : void 0;
|
|
11966
|
-
return (point) => {
|
|
11967
|
-
geodeticToGeocentricInPlace(point, a);
|
|
11968
|
-
sourceShift == null ? void 0 : sourceShift(point);
|
|
11969
|
-
targetShift == null ? void 0 : targetShift(point);
|
|
11970
|
-
geocentricToGeodeticInPlace(point, b);
|
|
11971
|
-
};
|
|
11972
|
-
}
|
|
11973
|
-
function applyDatumGrids(point, datum, inverse34) {
|
|
11974
|
-
for (const reference of datum.grids) {
|
|
11975
|
-
if (reference.name === "null")
|
|
11976
|
-
return;
|
|
11977
|
-
if (!reference.grid) {
|
|
11978
|
-
if (reference.optional)
|
|
11979
|
-
continue;
|
|
11980
|
-
throw new Error("Required datum grid is not registered: " + reference.name);
|
|
11981
|
-
}
|
|
11982
|
-
let found = false;
|
|
11983
|
-
if (reference.grid.shiftInPlace)
|
|
11984
|
-
found = reference.grid.shiftInPlace(point, inverse34);
|
|
11985
|
-
else {
|
|
11986
|
-
const output = reference.grid.shift(point.x, point.y, inverse34);
|
|
11987
|
-
if (output) {
|
|
11988
|
-
point.x = output[0];
|
|
11989
|
-
point.y = output[1];
|
|
11990
|
-
found = true;
|
|
11991
|
-
}
|
|
11992
|
-
}
|
|
11993
|
-
if (found) {
|
|
11994
|
-
if (!Number.isFinite(point.x) || !Number.isFinite(point.y) || Math.abs(point.y) > Math.PI / 2)
|
|
11995
|
-
throw new Error("Datum grid produced a coordinate outside the geographic domain");
|
|
11996
|
-
return;
|
|
11997
|
-
}
|
|
11998
|
-
}
|
|
11999
|
-
throw new Error("No datum grid covers coordinate: " + datum.grids.map((grid) => grid.name).join(","));
|
|
12000
|
-
}
|
|
12001
|
-
function geodeticToGeocentric(coordinate, ellipsoid) {
|
|
12002
|
-
const point = { x: coordinate[0], y: coordinate[1], z: coordinate[2] };
|
|
12003
|
-
geodeticToGeocentricInPlace(point, ellipsoid);
|
|
12004
|
-
return [point.x, point.y, point.z];
|
|
12005
|
-
}
|
|
12006
|
-
function geocentricToGeodetic(coordinate, ellipsoid) {
|
|
12007
|
-
const point = { x: coordinate[0], y: coordinate[1], z: coordinate[2] };
|
|
12008
|
-
geocentricToGeodeticInPlace(point, ellipsoid);
|
|
12009
|
-
return [point.x, point.y, point.z];
|
|
12010
|
-
}
|
|
12011
|
-
var import_matrix3, ARC_SECOND, WGS842;
|
|
12012
|
-
var init_datum = __esm({
|
|
12013
|
-
"dist/projection/experimental/datum.js"() {
|
|
12014
|
-
import_matrix3 = require("@math.gl/core/matrix");
|
|
12015
|
-
ARC_SECOND = Math.PI / (180 * 3600);
|
|
12016
|
-
WGS842 = {
|
|
12017
|
-
ellipsoid: {
|
|
12018
|
-
semiMajorAxis: 6378137,
|
|
12019
|
-
semiMinorAxis: 6356752314245179e-9,
|
|
12020
|
-
eccentricitySquared: 0.0066943799901413165
|
|
12021
|
-
},
|
|
12022
|
-
towgs84: [0, 0, 0]
|
|
12023
|
-
};
|
|
12024
|
-
}
|
|
12025
|
-
});
|
|
12026
|
-
|
|
12027
|
-
// dist/projection/experimental/rendering-profile/rectangular-rendering-profile.js
|
|
12028
|
-
function normalizeCoverage(point, coverage, center3 = 0, over = false) {
|
|
12029
|
-
const span = getLongitudeSpan(coverage);
|
|
12030
|
-
const west = span === 360 ? center3 - 180 : coverage[0] + Math.round((center3 - coverage[0] - span / 2) / 360) * 360;
|
|
12031
|
-
const east = west + span;
|
|
12032
|
-
if (over) {
|
|
12033
|
-
point.x = Math.max(west, Math.min(east, point.x));
|
|
12034
|
-
point.y = Math.max(coverage[1], Math.min(coverage[3], point.y));
|
|
12035
|
-
return;
|
|
12036
|
-
}
|
|
12037
|
-
const best = clampGeographicPoint(coverage, [point.x, point.y]);
|
|
12038
|
-
let longitude3 = best[0];
|
|
12039
|
-
if (best[0] === normalizeLongitude(point.x) && point.x >= west && point.x <= east)
|
|
12040
|
-
longitude3 = point.x;
|
|
12041
|
-
else if (longitude3 < west || longitude3 > east)
|
|
12042
|
-
longitude3 += Math.round(((west + east) / 2 - longitude3) / 360) * 360;
|
|
12043
|
-
const offset = longitude3 - center3;
|
|
12044
|
-
point.x = Math.abs(offset) <= 180 ? longitude3 : center3 + normalizeLongitude(offset);
|
|
12045
|
-
point.y = best[1];
|
|
12046
|
-
}
|
|
12047
|
-
function createRectangleRenderingProfile(resolveBounds2, coverage, origin = 0, primeMeridian2 = 0, over = false) {
|
|
12048
|
-
const center3 = (origin + primeMeridian2) * 180 / Math.PI;
|
|
12049
|
-
return {
|
|
12050
|
-
get bounds() {
|
|
12051
|
-
return resolveBounds2(getAngularRanges(coverage, primeMeridian2, origin));
|
|
12052
|
-
},
|
|
12053
|
-
normalize(point) {
|
|
12054
|
-
normalizeCoverage(point, coverage, center3, over);
|
|
12055
|
-
}
|
|
12056
|
-
};
|
|
12057
|
-
}
|
|
12058
|
-
function createRegionsRenderingProfile(resolveBounds2, regions2, origin, primeMeridian2, over) {
|
|
12059
|
-
const profile = combineRenderingProfiles(regions2, (region) => createRectangleRenderingProfile(resolveBounds2, region, origin, primeMeridian2, over));
|
|
12060
|
-
if (!profile)
|
|
12061
|
-
throw new Error("CRS coverage does not intersect the rendering target");
|
|
12062
|
-
return profile;
|
|
12063
|
-
}
|
|
12064
|
-
function withRectangleRenderingProfile(implementation, parameters, resolveBounds2, primeMeridian2 = 0, over = false) {
|
|
12065
|
-
const origin = (parameters[0][0] + parameters[1][0]) / 2;
|
|
12066
|
-
const defaults = getGeographicBounds(parameters, primeMeridian2);
|
|
12067
|
-
const center3 = (origin + primeMeridian2) * 180 / Math.PI;
|
|
12068
|
-
return {
|
|
12069
|
-
...implementation,
|
|
12070
|
-
longitudeOrigin: origin,
|
|
12071
|
-
getRenderingProfile(coverage) {
|
|
12072
|
-
if (!coverage)
|
|
12073
|
-
return {
|
|
12074
|
-
bounds: resolveBounds2(parameters),
|
|
12075
|
-
normalize(point) {
|
|
12076
|
-
normalizeCoverage(point, defaults, center3, over);
|
|
12077
|
-
}
|
|
12078
|
-
};
|
|
12079
|
-
try {
|
|
12080
|
-
const profile = createRectangleRenderingProfile(resolveBounds2, coverage, origin, primeMeridian2, over);
|
|
12081
|
-
const bounds2 = profile.bounds;
|
|
12082
|
-
return { bounds: bounds2, normalize: profile.normalize };
|
|
12083
|
-
} catch {
|
|
12084
|
-
return createRegionsRenderingProfile(resolveBounds2, intersectGeographicBounds(coverage, defaults), origin, primeMeridian2, over);
|
|
12085
|
-
}
|
|
12086
|
-
}
|
|
12087
|
-
};
|
|
12088
|
-
}
|
|
12089
|
-
var init_rectangular_rendering_profile = __esm({
|
|
12090
|
-
"dist/projection/experimental/rendering-profile/rectangular-rendering-profile.js"() {
|
|
12091
|
-
init_geographic_bounds();
|
|
12092
|
-
init_rendering_profile();
|
|
12093
|
-
}
|
|
12094
|
-
});
|
|
12095
|
-
|
|
12096
|
-
// dist/projection/experimental/rendering-profile/rendering-bounds.js
|
|
12097
|
-
function multiply(a, b) {
|
|
12098
|
-
const values = [a[0] * b[0], a[0] * b[1], a[1] * b[0], a[1] * b[1]];
|
|
12099
|
-
return [Math.min(...values), Math.max(...values)];
|
|
12100
|
-
}
|
|
12101
|
-
function sine([low, high]) {
|
|
12102
|
-
const values = [Math.sin(low), Math.sin(high)];
|
|
12103
|
-
for (const [phase, value2] of [
|
|
12104
|
-
[Math.PI / 2, 1],
|
|
12105
|
-
[-Math.PI / 2, -1]
|
|
12106
|
-
]) {
|
|
12107
|
-
if (Math.ceil((low - phase) / (2 * Math.PI)) <= Math.floor((high - phase) / (2 * Math.PI)))
|
|
12108
|
-
values.push(value2);
|
|
12109
|
-
}
|
|
12110
|
-
return [Math.min(...values), Math.max(...values)];
|
|
12111
|
-
}
|
|
12112
|
-
function envelope(x, y) {
|
|
12113
|
-
const padding = (range) => Math.max(1, maxAbs(range)) * 1e-12;
|
|
12114
|
-
if (![...x, ...y].every(Number.isFinite))
|
|
12115
|
-
throw new Error("Projection rendering bounds are not finite");
|
|
12116
|
-
return [
|
|
12117
|
-
[x[0] - padding(x), y[0] - padding(y), 0],
|
|
12118
|
-
[x[1] + padding(x), y[1] + padding(y), 0]
|
|
12119
|
-
];
|
|
12120
|
-
}
|
|
12121
|
-
function longitudeRange(parameters, origin, over = false) {
|
|
12122
|
-
const low = parameters[0][0] - origin, high = parameters[1][0] - origin;
|
|
12123
|
-
if (over)
|
|
12124
|
-
return [low, high];
|
|
12125
|
-
const span = high - low;
|
|
12126
|
-
if (span >= 2 * Math.PI - 1e-12)
|
|
12127
|
-
return [-Math.PI, Math.PI];
|
|
12128
|
-
let west = wrapLongitude(low);
|
|
12129
|
-
if (span > 0 && Math.abs(west - Math.PI) < 1e-12)
|
|
12130
|
-
west = -Math.PI;
|
|
12131
|
-
const east = west + span;
|
|
12132
|
-
return east > Math.PI + 1e-12 ? [-Math.PI, Math.PI] : [west, Math.min(east, Math.PI)];
|
|
12133
|
-
}
|
|
12134
|
-
function cylindricalBounds(project, parameters, origin, over = false) {
|
|
12135
|
-
const longitude3 = longitudeRange(parameters, origin, over);
|
|
12136
|
-
const latitudes = [
|
|
12137
|
-
parameters[0][1],
|
|
12138
|
-
parameters[1][1],
|
|
12139
|
-
Math.max(parameters[0][1], Math.min(parameters[1][1], 0))
|
|
12140
|
-
];
|
|
12141
|
-
const points = longitude3.flatMap((x) => latitudes.map((y) => project(origin + x, y)));
|
|
12142
|
-
return envelope([Math.min(...points.map((p) => p[0])), Math.max(...points.map((p) => p[0]))], [Math.min(...points.map((p) => p[1])), Math.max(...points.map((p) => p[1]))]);
|
|
12143
|
-
}
|
|
12144
|
-
function transverseBounds(project, parameters, origin, over = false, equator = 0) {
|
|
12145
|
-
const longitude3 = longitudeRange(parameters, origin, over);
|
|
12146
|
-
if (maxAbs(longitude3) > Math.PI / 6 + 1e-12)
|
|
12147
|
-
throw new Error("Unsupported transverse rendering coverage");
|
|
12148
|
-
const longitudes = [
|
|
12149
|
-
longitude3[0],
|
|
12150
|
-
longitude3[1],
|
|
12151
|
-
Math.max(longitude3[0], Math.min(longitude3[1], 0))
|
|
12152
|
-
];
|
|
12153
|
-
const latitudes = [
|
|
12154
|
-
parameters[0][1],
|
|
12155
|
-
parameters[1][1],
|
|
12156
|
-
Math.max(parameters[0][1], Math.min(parameters[1][1], equator))
|
|
12157
|
-
];
|
|
12158
|
-
const points = longitudes.flatMap((x) => latitudes.map((y) => project(origin + x, y)));
|
|
12159
|
-
return envelope([Math.min(...points.map((p) => p[0])), Math.max(...points.map((p) => p[0]))], [Math.min(...points.map((p) => p[1])), Math.max(...points.map((p) => p[1]))]);
|
|
12160
|
-
}
|
|
12161
|
-
function vanDerGrintenBounds(project, parameters, origin, over = false) {
|
|
12162
|
-
const longitude3 = longitudeRange(parameters, origin, over);
|
|
12163
|
-
const longitudes = [
|
|
12164
|
-
longitude3[0],
|
|
12165
|
-
longitude3[1],
|
|
12166
|
-
Math.max(longitude3[0], Math.min(longitude3[1], 0))
|
|
12167
|
-
];
|
|
12168
|
-
const latitudes = [
|
|
12169
|
-
parameters[0][1],
|
|
12170
|
-
parameters[1][1],
|
|
12171
|
-
Math.max(parameters[0][1], Math.min(parameters[1][1], 0))
|
|
12172
|
-
];
|
|
12173
|
-
const points = longitudes.flatMap((x) => latitudes.map((y) => project(origin + x, y)));
|
|
12174
|
-
return envelope([Math.min(...points.map((p) => p[0])), Math.max(...points.map((p) => p[0]))], [Math.min(...points.map((p) => p[1])), Math.max(...points.map((p) => p[1]))]);
|
|
12175
|
-
}
|
|
12176
|
-
function conicBounds(project, parameters, origin, cone, x0, centerY, over = false) {
|
|
12177
|
-
const angles = scale2(longitudeRange(parameters, origin, over), cone);
|
|
12178
|
-
const radii = ordered(centerY - project(origin, parameters[0][1])[1], centerY - project(origin, parameters[1][1])[1]);
|
|
12179
|
-
return envelope(add2([x0, x0], multiply(radii, sine(angles))), add2([centerY, centerY], scale2(multiply(radii, cosine(angles)), -1)));
|
|
12180
|
-
}
|
|
12181
|
-
var ordered, add2, scale2, cosine, maxAbs;
|
|
12182
|
-
var init_rendering_bounds = __esm({
|
|
12183
|
-
"dist/projection/experimental/rendering-profile/rendering-bounds.js"() {
|
|
12184
|
-
init_parameters();
|
|
12185
|
-
ordered = (a, b) => [Math.min(a, b), Math.max(a, b)];
|
|
12186
|
-
add2 = (a, b) => [a[0] + b[0], a[1] + b[1]];
|
|
12187
|
-
scale2 = (a, value2) => ordered(a[0] * value2, a[1] * value2);
|
|
12188
|
-
cosine = (a) => sine([a[0] + Math.PI / 2, a[1] + Math.PI / 2]);
|
|
12189
|
-
maxAbs = (a) => Math.max(Math.abs(a[0]), Math.abs(a[1]));
|
|
12190
|
-
}
|
|
12191
|
-
});
|
|
12192
|
-
|
|
12193
|
-
// dist/projection/experimental/rendering-profile/geographic-rendering-profile.js
|
|
12194
|
-
function createGeographicProfile(parameters, primeMeridian2 = 0) {
|
|
12195
|
-
const center3 = numberParameter(parameters, "lon_wrap", 0) * DEGREES_TO_RADIANS;
|
|
12196
|
-
return (coverage) => createRectangleRenderingProfile((ranges) => {
|
|
12197
|
-
const longitude3 = longitudeRange(ranges, center3);
|
|
12198
|
-
return [
|
|
12199
|
-
[center3 + longitude3[0], ranges[0][1], 0],
|
|
12200
|
-
[center3 + longitude3[1], ranges[1][1], 0]
|
|
12201
|
-
];
|
|
12202
|
-
}, coverage ?? [-180, -90, 180, 90], center3, primeMeridian2);
|
|
12203
|
-
}
|
|
12204
|
-
var init_geographic_rendering_profile = __esm({
|
|
12205
|
-
"dist/projection/experimental/rendering-profile/geographic-rendering-profile.js"() {
|
|
12206
|
-
init_parameters();
|
|
12207
|
-
init_rectangular_rendering_profile();
|
|
12208
|
-
init_rendering_bounds();
|
|
12209
|
-
}
|
|
12210
|
-
});
|
|
12211
|
-
|
|
12212
|
-
// dist/projection/experimental/vertical-datum.js
|
|
12213
|
-
function compileVerticalGrid(names, grids = {}) {
|
|
12214
|
-
if (names === void 0)
|
|
12215
|
-
return void 0;
|
|
12216
|
-
const entries = [];
|
|
12217
|
-
for (const entry of names.split(",")) {
|
|
12218
|
-
const optional = entry.startsWith("@");
|
|
12219
|
-
const name = optional ? entry.slice(1) : entry;
|
|
12220
|
-
if (!name || /\s/.test(name))
|
|
12221
|
-
throw new Error("Invalid vertical grid name");
|
|
12222
|
-
if (name === "null") {
|
|
12223
|
-
entries.push(null);
|
|
12224
|
-
break;
|
|
12225
|
-
}
|
|
12226
|
-
const grid = Object.prototype.hasOwnProperty.call(grids, name) ? grids[name] : void 0;
|
|
12227
|
-
if (grid) {
|
|
12228
|
-
if (typeof grid.getOffset !== "function")
|
|
12229
|
-
throw new Error("Invalid vertical grid: " + name);
|
|
12230
|
-
entries.push(grid.getOffset.bind(grid));
|
|
12231
|
-
} else if (!optional)
|
|
12232
|
-
unsupportedStage("Required vertical grid is not registered: " + name);
|
|
12233
|
-
}
|
|
12234
|
-
return (longitude3, latitude) => {
|
|
12235
|
-
for (const sample2 of entries) {
|
|
12236
|
-
if (!sample2)
|
|
12237
|
-
return 0;
|
|
12238
|
-
const offset = sample2(longitude3, latitude);
|
|
12239
|
-
if (offset === void 0)
|
|
12240
|
-
continue;
|
|
12241
|
-
if (!Number.isFinite(offset))
|
|
12242
|
-
throw new Error("Vertical grid returned a non-finite offset");
|
|
12243
|
-
return offset;
|
|
12244
|
-
}
|
|
12245
|
-
throw new Error("No vertical grid covers this coordinate");
|
|
12246
|
-
};
|
|
12247
|
-
}
|
|
12248
|
-
var init_vertical_datum = __esm({
|
|
12249
|
-
"dist/projection/experimental/vertical-datum.js"() {
|
|
12250
|
-
init_types2();
|
|
12251
|
-
}
|
|
12252
|
-
});
|
|
12253
|
-
|
|
12254
|
-
// dist/projection/experimental/transform-description.js
|
|
12255
|
-
function describeCRS(crs) {
|
|
12256
|
-
const ellipsoid = Object.freeze({ ...crs.ellipsoid });
|
|
12257
|
-
return Object.freeze({
|
|
12258
|
-
kind: crs.kind,
|
|
12259
|
-
projection: crs.projection,
|
|
12260
|
-
parameters: Object.freeze(Object.fromEntries(Object.entries(crs.parameters).map(([name, value2]) => [name, value2 ?? null]))),
|
|
12261
|
-
ellipsoid,
|
|
12262
|
-
datum: Object.freeze({
|
|
12263
|
-
ellipsoid: Object.freeze({ ...crs.datum.ellipsoid }),
|
|
12264
|
-
towgs84: crs.datum.towgs84 && Object.freeze([...crs.datum.towgs84]),
|
|
12265
|
-
grids: crs.datum.grids && Object.freeze(crs.datum.grids.map((reference) => Object.freeze({
|
|
12266
|
-
name: reference.name,
|
|
12267
|
-
optional: reference.optional,
|
|
12268
|
-
loaded: Boolean(reference.grid)
|
|
12269
|
-
})))
|
|
12270
|
-
}),
|
|
12271
|
-
angularUnit: crs.angularUnit,
|
|
12272
|
-
toMeter: crs.toMeter,
|
|
12273
|
-
verticalUnit: crs.verticalUnit,
|
|
12274
|
-
primeMeridian: crs.primeMeridian,
|
|
12275
|
-
axis: crs.axis,
|
|
12276
|
-
storedAxis: crs.storedAxis,
|
|
12277
|
-
longitudeWrap: crs.longitudeWrap,
|
|
12278
|
-
areaOfUse: crs.areaOfUse && Object.freeze([...crs.areaOfUse]),
|
|
12279
|
-
lossy: crs.lossy,
|
|
12280
|
-
algorithm: crs.algorithm && Object.freeze({ ...crs.algorithm })
|
|
12281
|
-
});
|
|
12282
|
-
}
|
|
12283
|
-
function describeTransform(source, target, forward33, inverse34) {
|
|
12284
|
-
const opaqueReasons = [];
|
|
12285
|
-
if (!source.algorithm)
|
|
12286
|
-
opaqueReasons.push("source-algorithm");
|
|
12287
|
-
if (!target.algorithm)
|
|
12288
|
-
opaqueReasons.push("target-algorithm");
|
|
12289
|
-
if (source.datum.grids || target.datum.grids || source.parameters["geoidgrids"] || target.parameters["geoidgrids"])
|
|
12290
|
-
opaqueReasons.push("grid-resource");
|
|
12291
|
-
return Object.freeze({
|
|
12292
|
-
version: 1,
|
|
12293
|
-
source,
|
|
12294
|
-
target,
|
|
12295
|
-
forward: forward33,
|
|
12296
|
-
inverse: inverse34,
|
|
12297
|
-
lossy: source.lossy || target.lossy,
|
|
12298
|
-
complete: opaqueReasons.length === 0,
|
|
12299
|
-
opaqueReasons: Object.freeze(opaqueReasons)
|
|
12300
|
-
});
|
|
12301
|
-
}
|
|
12302
|
-
var init_transform_description = __esm({
|
|
12303
|
-
"dist/projection/experimental/transform-description.js"() {
|
|
12304
|
-
}
|
|
12305
|
-
});
|
|
12306
|
-
|
|
12307
|
-
// dist/projection/experimental/typescript-projection.js
|
|
12308
|
-
function requiredProjections(options) {
|
|
12309
|
-
const available = registry(options.projections || []);
|
|
12310
|
-
const required = /* @__PURE__ */ new Set();
|
|
12311
|
-
for (const definition of [options.from ?? "WGS84", options.to ?? "WGS84"]) {
|
|
12312
|
-
const crs = normalizeCRS(definition, options);
|
|
12313
|
-
if (["geographic", "identity"].includes(crs.kind))
|
|
12314
|
-
continue;
|
|
12315
|
-
const projection = available.get(pluginKey(crs.projection));
|
|
12316
|
-
if (!projection)
|
|
12317
|
-
throw new TypeScriptCRSError("missing-plugin", "Projection plugin is not registered: " + crs.projection);
|
|
12318
|
-
required.add(projection);
|
|
12319
|
-
}
|
|
12320
|
-
return [...required];
|
|
12321
|
-
}
|
|
12322
|
-
function registry(projections) {
|
|
12323
|
-
const plugins = /* @__PURE__ */ new Map();
|
|
12324
|
-
for (const plugin of projections) {
|
|
12325
|
-
for (const name of new Set([plugin.name, ...plugin.aliases || []].map(pluginKey))) {
|
|
12326
|
-
if (!name || ["longlat", "latlong", "latlon", "lonlat", "identity"].includes(name) || plugins.has(name))
|
|
12327
|
-
throw new Error("Duplicate or reserved projection plugin: " + name);
|
|
12328
|
-
plugins.set(name, plugin);
|
|
12329
|
-
}
|
|
12330
|
-
}
|
|
12331
|
-
return plugins;
|
|
12332
|
-
}
|
|
12333
|
-
function compileCRS(definition, plugins, options) {
|
|
12334
|
-
var _a3;
|
|
12335
|
-
const crs = normalizeCRS(definition, options);
|
|
12336
|
-
const plugin = plugins.get(pluginKey(crs.projection));
|
|
12337
|
-
if (!["geographic", "identity"].includes(crs.kind) && !plugin)
|
|
12338
|
-
throw new TypeScriptCRSError("missing-plugin", "Projection plugin is not registered: " + crs.projection);
|
|
12339
|
-
const allowed = /* @__PURE__ */ new Set([...CORE_PARAMETERS, ...(plugin == null ? void 0 : plugin.parameters) || []]);
|
|
12340
|
-
for (const key3 of Object.keys(crs.parameters)) {
|
|
12341
|
-
if (!allowed.has(key3))
|
|
12342
|
-
throw new TypeScriptCRSError("missing-transform-stage", "Unsupported PROJ parameter: +" + key3);
|
|
12343
|
-
const flag = CORE_FLAGS.includes(key3) || ((_a3 = plugin == null ? void 0 : plugin.flags) == null ? void 0 : _a3.includes(key3));
|
|
12344
|
-
if (flag && crs.parameters[key3] !== void 0)
|
|
12345
|
-
throw new Error("Expected a flag without a value: +" + key3);
|
|
12346
|
-
if (!flag && !crs.parameters[key3])
|
|
12347
|
-
throw new Error("PROJ parameter requires a value: +" + key3);
|
|
12348
|
-
}
|
|
12349
|
-
if (crs.parameters["type"] && crs.parameters["type"] !== "crs")
|
|
12350
|
-
throw new Error("Only +type=crs is supported");
|
|
12351
|
-
const parameters = pluginKey(crs.projection) === "fasttransversemercator" ? Object.freeze({ ...crs.parameters, approx: void 0 }) : crs.parameters;
|
|
12352
|
-
const implementation = plugin == null ? void 0 : plugin.create({
|
|
12353
|
-
...crs.ellipsoid,
|
|
12354
|
-
parameters,
|
|
12355
|
-
primeMeridian: crs.primeMeridian
|
|
12356
|
-
});
|
|
12357
|
-
if (crs.kind === "geocentric" && (!(implementation == null ? void 0 : implementation.forward3D) || !(implementation == null ? void 0 : implementation.inverse3D)))
|
|
12358
|
-
throw new Error("Geocentric plugin must implement 3D operations");
|
|
12359
|
-
const references = crs.datum.grids;
|
|
12360
|
-
const nullIndex = (references == null ? void 0 : references.findIndex((reference) => reference.name === "null")) ?? -1;
|
|
12361
|
-
const grids = references == null ? void 0 : references.slice(0, nullIndex < 0 ? void 0 : nullIndex + 1).map((reference) => {
|
|
12362
|
-
const grid = Object.prototype.hasOwnProperty.call(options.datumGrids || {}, reference.name) ? options.datumGrids[reference.name] : void 0;
|
|
12363
|
-
if (grid && typeof grid.shift !== "function")
|
|
12364
|
-
throw new Error("Invalid prepared datum grid: " + reference.name);
|
|
12365
|
-
return Object.freeze({ ...reference, grid });
|
|
12366
|
-
});
|
|
12367
|
-
for (const reference of grids || []) {
|
|
12368
|
-
if (reference.name === "null")
|
|
12369
|
-
break;
|
|
12370
|
-
if (!reference.optional && !reference.grid)
|
|
12371
|
-
unsupportedStage("Required datum grid is not registered: " + reference.name);
|
|
12372
|
-
}
|
|
12373
|
-
const datum = grids ? Object.freeze({ ...crs.datum, grids: Object.freeze(grids) }) : crs.datum;
|
|
12374
|
-
const verticalGrid = compileVerticalGrid(crs.parameters["geoidgrids"], options.verticalGrids);
|
|
12375
|
-
if (verticalGrid && (crs.kind === "geocentric" || crs.kind === "identity" || crs.lossy))
|
|
12376
|
-
unsupportedStage("Vertical grids require a non-lossy geographic or projected CRS");
|
|
12377
|
-
const algorithm = plugin ? plugin.semantics : { id: "@math.gl/geospatial/" + crs.kind, version: 1 };
|
|
12378
|
-
return { ...crs, datum, implementation, verticalGrid, algorithm };
|
|
12379
|
-
}
|
|
12380
|
-
function finite(point) {
|
|
12381
|
-
return Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z);
|
|
12382
|
-
}
|
|
12383
|
-
function compileAxis(axis, inverse34) {
|
|
12384
|
-
if (axis === "enu")
|
|
12385
|
-
return void 0;
|
|
12386
|
-
const indexes = [0, 0, 0], signs = [0, 0, 0];
|
|
12387
|
-
for (let i = 0; i < 3; i++) {
|
|
12388
|
-
const char = axis[i], component = "ew".includes(char) ? 0 : "ns".includes(char) ? 1 : 2;
|
|
12389
|
-
indexes[inverse34 ? i : component] = inverse34 ? component : i;
|
|
12390
|
-
signs[inverse34 ? i : component] = "wsd".includes(char) ? -1 : 1;
|
|
12391
|
-
}
|
|
12392
|
-
return (point) => {
|
|
12393
|
-
const x = point.x, y = point.y, z = point.z;
|
|
12394
|
-
point.x = signs[0] * (indexes[0] === 0 ? x : indexes[0] === 1 ? y : z);
|
|
12395
|
-
point.y = signs[1] * (indexes[1] === 0 ? x : indexes[1] === 1 ? y : z);
|
|
12396
|
-
point.z = signs[2] * (indexes[2] === 0 ? x : indexes[2] === 1 ? y : z);
|
|
12397
|
-
};
|
|
12398
|
-
}
|
|
12399
|
-
function compileTransform(from, to, enforceAxis) {
|
|
12400
|
-
var _a3, _b2, _c, _d;
|
|
12401
|
-
const fromAxis = from.storedAxis || (enforceAxis ? from.axis : "enu");
|
|
12402
|
-
const toAxis = to.storedAxis || (enforceAxis ? to.axis : "enu");
|
|
12403
|
-
const inputAxis = compileAxis(fromAxis, false), outputAxis = compileAxis(toAxis, true);
|
|
12404
|
-
const source = from.implementation && projectionOperation(from.implementation, true, from.kind === "geocentric");
|
|
12405
|
-
const target = to.implementation && projectionOperation(to.implementation, false, to.kind === "geocentric");
|
|
12406
|
-
const datum = createDatumTransform(from.datum, to.datum);
|
|
12407
|
-
const horizontalOnly = from.lossy || to.lossy;
|
|
12408
|
-
const fromGeocentric = from.kind === "geocentric";
|
|
12409
|
-
const inputScale = from.kind === "geographic" ? from.angularUnit : from.toMeter;
|
|
12410
|
-
const outputScale = to.kind === "geographic" ? to.angularUnit : to.toMeter;
|
|
12411
|
-
const inputVerticalScale = fromGeocentric ? 1 : from.verticalUnit, outputVerticalScale = to.kind === "geocentric" ? outputScale : to.verticalUnit;
|
|
12412
|
-
const fromPrime = from.primeMeridian, toPrime = to.primeMeridian;
|
|
12413
|
-
const longitudeWrap = to.kind === "geographic" ? to.longitudeWrap : void 0;
|
|
12414
|
-
let flat;
|
|
12415
|
-
if (!datum && !from.verticalGrid && !to.verticalGrid && !horizontalOnly && !inputAxis && !outputAxis && !fromPrime && !toPrime && from.verticalUnit === 1 && to.verticalUnit === 1 && longitudeWrap === void 0) {
|
|
12416
|
-
const context = Object.freeze({ inputScale, outputScale });
|
|
12417
|
-
if (from.kind === "geographic" && to.kind === "projected")
|
|
12418
|
-
flat = (_b2 = (_a3 = to.implementation) == null ? void 0 : _a3.createForwardFlat) == null ? void 0 : _b2.call(_a3, context);
|
|
12419
|
-
if (from.kind === "projected" && to.kind === "geographic")
|
|
12420
|
-
flat = (_d = (_c = from.implementation) == null ? void 0 : _c.createInverseFlat) == null ? void 0 : _d.call(_c, context);
|
|
12421
|
-
}
|
|
12422
|
-
const requiresInputZ = Boolean(from.verticalGrid || to.verticalGrid) || from.kind === "geocentric" || /[ud]/.test(fromAxis.slice(0, 2)) || /[ud]/.test(toAxis.slice(0, 2));
|
|
12423
|
-
const stages = [];
|
|
12424
|
-
if (inputAxis)
|
|
12425
|
-
stages.push("input-axis");
|
|
12426
|
-
if (horizontalOnly)
|
|
12427
|
-
stages.push("discard-height");
|
|
12428
|
-
if (inputScale !== 1)
|
|
12429
|
-
stages.push("input-scale");
|
|
12430
|
-
if (source)
|
|
12431
|
-
stages.push("source-inverse");
|
|
12432
|
-
if (inputVerticalScale !== 1)
|
|
12433
|
-
stages.push("input-height-scale");
|
|
12434
|
-
stages.push("geographic-domain-check");
|
|
12435
|
-
if (fromPrime)
|
|
12436
|
-
stages.push("source-prime-meridian");
|
|
12437
|
-
if (from.verticalGrid)
|
|
12438
|
-
stages.push("source-vertical-grid");
|
|
12439
|
-
if (datum)
|
|
12440
|
-
stages.push("datum");
|
|
12441
|
-
if (to.verticalGrid)
|
|
12442
|
-
stages.push("target-vertical-grid");
|
|
12443
|
-
if (toPrime)
|
|
12444
|
-
stages.push("target-prime-meridian");
|
|
12445
|
-
if (longitudeWrap !== void 0)
|
|
12446
|
-
stages.push("longitude-wrap");
|
|
12447
|
-
if (target)
|
|
12448
|
-
stages.push("target-forward");
|
|
12449
|
-
if (outputScale !== 1)
|
|
12450
|
-
stages.push("output-scale");
|
|
12451
|
-
if (outputVerticalScale !== 1)
|
|
12452
|
-
stages.push("output-height-scale");
|
|
12453
|
-
if (horizontalOnly)
|
|
12454
|
-
stages.push("restore-height");
|
|
12455
|
-
if (outputAxis)
|
|
12456
|
-
stages.push("output-axis");
|
|
12457
|
-
return {
|
|
12458
|
-
description: Object.freeze({
|
|
12459
|
-
inputAxis: fromAxis,
|
|
12460
|
-
outputAxis: toAxis,
|
|
12461
|
-
requiresInputZ,
|
|
12462
|
-
geocentricOutput: to.kind === "geocentric",
|
|
12463
|
-
stages: Object.freeze(stages)
|
|
12464
|
-
}),
|
|
12465
|
-
flat,
|
|
12466
|
-
requiresInputZ,
|
|
12467
|
-
geocentricOutput: to.kind === "geocentric",
|
|
12468
|
-
run(point) {
|
|
12469
|
-
if (!finite(point))
|
|
12470
|
-
throw new Error("Coordinates must contain finite x, y and optional z values");
|
|
12471
|
-
inputAxis == null ? void 0 : inputAxis(point);
|
|
12472
|
-
const preservedHeight = point.z;
|
|
12473
|
-
if (horizontalOnly)
|
|
12474
|
-
point.z = 0;
|
|
12475
|
-
if (inputScale !== 1) {
|
|
12476
|
-
point.x *= inputScale;
|
|
12477
|
-
point.y *= inputScale;
|
|
12478
|
-
if (fromGeocentric)
|
|
12479
|
-
point.z *= inputScale;
|
|
12480
|
-
}
|
|
12481
|
-
source == null ? void 0 : source(point);
|
|
12482
|
-
if (inputVerticalScale !== 1)
|
|
12483
|
-
point.z *= inputVerticalScale;
|
|
12484
|
-
if (Math.abs(point.y) > Math.PI / 2 || !finite(point))
|
|
12485
|
-
throw new Error("Coordinate is outside the geographic domain");
|
|
12486
|
-
point.x += fromPrime;
|
|
12487
|
-
if (from.verticalGrid)
|
|
12488
|
-
point.z += from.verticalGrid(point.x, point.y);
|
|
12489
|
-
datum == null ? void 0 : datum(point);
|
|
12490
|
-
if (to.verticalGrid)
|
|
12491
|
-
point.z -= to.verticalGrid(point.x, point.y);
|
|
12492
|
-
point.x -= toPrime;
|
|
12493
|
-
if (longitudeWrap !== void 0)
|
|
12494
|
-
point.x = longitudeWrap + wrapLongitude(point.x - longitudeWrap);
|
|
12495
|
-
target == null ? void 0 : target(point);
|
|
12496
|
-
if (outputScale !== 1) {
|
|
12497
|
-
point.x /= outputScale;
|
|
12498
|
-
point.y /= outputScale;
|
|
12499
|
-
}
|
|
12500
|
-
if (outputVerticalScale !== 1)
|
|
12501
|
-
point.z /= outputVerticalScale;
|
|
12502
|
-
if (horizontalOnly)
|
|
12503
|
-
point.z = preservedHeight;
|
|
12504
|
-
outputAxis == null ? void 0 : outputAxis(point);
|
|
12505
|
-
if (!finite(point))
|
|
12506
|
-
throw new Error("Projection produced non-finite coordinates");
|
|
12507
|
-
}
|
|
12508
|
-
};
|
|
12509
|
-
}
|
|
12510
|
-
function transformScalar(coordinate, operation2, scratch, output) {
|
|
12511
|
-
if (coordinate.length < 2)
|
|
12512
|
-
throw new Error("Coordinates must contain finite x, y and optional z values");
|
|
12513
|
-
if (coordinate.length < 3 && operation2.requiresInputZ)
|
|
12514
|
-
throw new Error("This transform requires three ordinates");
|
|
12515
|
-
const length = Math.max(coordinate.length, operation2.geocentricOutput ? 3 : 2);
|
|
12516
|
-
const point = scratch.acquire();
|
|
12517
|
-
try {
|
|
12518
|
-
point.x = coordinate[0];
|
|
12519
|
-
point.y = coordinate[1];
|
|
12520
|
-
point.z = coordinate.length >= 3 ? coordinate[2] : 0;
|
|
12521
|
-
operation2.run(point);
|
|
12522
|
-
if (output)
|
|
12523
|
-
return writeScalarOutput(coordinate, output, point, length);
|
|
12524
|
-
const result = coordinate.slice();
|
|
12525
|
-
result[0] = point.x;
|
|
12526
|
-
result[1] = point.y;
|
|
12527
|
-
if (coordinate.length >= 3 || operation2.geocentricOutput)
|
|
12528
|
-
result[2] = point.z;
|
|
12529
|
-
return result;
|
|
12530
|
-
} finally {
|
|
12531
|
-
scratch.release(point);
|
|
12532
|
-
}
|
|
12533
|
-
}
|
|
12534
|
-
function transformInPlace(coordinates2, dimension, operation2, scratch) {
|
|
12535
|
-
if (!(coordinates2 instanceof Float32Array || coordinates2 instanceof Float64Array))
|
|
12536
|
-
throw new Error("In-place projection requires a Float32Array or Float64Array");
|
|
12537
|
-
if (!Number.isSafeInteger(dimension) || dimension < 2 || coordinates2.length % dimension !== 0)
|
|
12538
|
-
throw new Error("Dimension must be an integer >= 2 and divide the typed array length");
|
|
12539
|
-
if (dimension < 3 && (operation2.requiresInputZ || operation2.geocentricOutput))
|
|
12540
|
-
throw new Error("This transform requires a dimension of at least 3");
|
|
12541
|
-
if (operation2.flat) {
|
|
12542
|
-
operation2.flat(coordinates2, dimension);
|
|
12543
|
-
return coordinates2;
|
|
12544
|
-
}
|
|
12545
|
-
const point = scratch.acquire();
|
|
12546
|
-
try {
|
|
12547
|
-
const float32 = coordinates2 instanceof Float32Array;
|
|
12548
|
-
for (let offset = 0; offset < coordinates2.length; offset += dimension) {
|
|
12549
|
-
point.x = coordinates2[offset];
|
|
12550
|
-
point.y = coordinates2[offset + 1];
|
|
12551
|
-
point.z = dimension >= 3 ? coordinates2[offset + 2] : 0;
|
|
12552
|
-
operation2.run(point);
|
|
12553
|
-
if (float32 && (Math.abs(point.x) > 34028234663852886e22 || Math.abs(point.y) > 34028234663852886e22 || dimension >= 3 && Math.abs(point.z) > 34028234663852886e22))
|
|
12554
|
-
throw new Error("Projected coordinate exceeds Float32 range");
|
|
12555
|
-
coordinates2[offset] = point.x;
|
|
12556
|
-
coordinates2[offset + 1] = point.y;
|
|
12557
|
-
if (dimension >= 3)
|
|
12558
|
-
coordinates2[offset + 2] = point.z;
|
|
12559
|
-
}
|
|
12560
|
-
return coordinates2;
|
|
12561
|
-
} finally {
|
|
12562
|
-
scratch.release(point);
|
|
12563
|
-
}
|
|
12564
|
-
}
|
|
12565
|
-
var ProjectionTransform, pluginKey;
|
|
12566
|
-
var init_typescript_projection = __esm({
|
|
12567
|
-
"dist/projection/experimental/typescript-projection.js"() {
|
|
12568
|
-
init_rendering_profile();
|
|
12569
|
-
init_identity_rendering_profile();
|
|
12570
|
-
init_projection_descriptor();
|
|
12571
|
-
init_mutable_projection();
|
|
12572
|
-
init_projection_scratch();
|
|
12573
|
-
init_scalar_output();
|
|
12574
|
-
init_normalize();
|
|
12575
|
-
init_types2();
|
|
12576
|
-
init_datum();
|
|
12577
|
-
init_parameters();
|
|
12578
|
-
init_geographic_rendering_profile();
|
|
12579
|
-
init_vertical_datum();
|
|
12580
|
-
init_transform_description();
|
|
12581
|
-
ProjectionTransform = class _ProjectionTransform {
|
|
12582
|
-
/** Resolve required descriptors once, then return an ordinary synchronous instance. */
|
|
12583
|
-
static async create(options = {}) {
|
|
12584
|
-
const projections = await Promise.all(requiredProjections(options).map(preloadProjection));
|
|
12585
|
-
return new _ProjectionTransform({ ...options, projections });
|
|
12586
|
-
}
|
|
12587
|
-
get targetProfile() {
|
|
12588
|
-
return this.getTargetRenderingProfile(this.targetCoverage);
|
|
12589
|
-
}
|
|
12590
|
-
/** Resolve target rendering policy independently from coordinate conversion. @internal */
|
|
12591
|
-
getTargetRenderingProfile(coverage) {
|
|
12592
|
-
return this.targetRenderingProfile && resolveRenderingProfile(this.targetRenderingProfile, coverage);
|
|
12593
|
-
}
|
|
12594
|
-
/** Deferred transforms expose metadata only once their implementations are prepared. */
|
|
12595
|
-
get description() {
|
|
12596
|
-
var _a3, _b2;
|
|
12597
|
-
return ((_b2 = (_a3 = this.deferred) == null ? void 0 : _a3.implementation) == null ? void 0 : _b2.description) ?? this.resolvedDescription;
|
|
12598
|
-
}
|
|
12599
|
-
constructor(options = {}) {
|
|
12600
|
-
var _a3, _b2, _c;
|
|
12601
|
-
this.coordinateScratch = new ProjectionScratch();
|
|
12602
|
-
this.targetLongitudeOrigin = 0;
|
|
12603
|
-
const registrations = options.projections || [];
|
|
12604
|
-
const plugins = registry(registrations);
|
|
12605
|
-
if (registrations.some((projection) => !("create" in projection))) {
|
|
12606
|
-
const from = normalizeCRS(options.from ?? "WGS84", options);
|
|
12607
|
-
const to = normalizeCRS(options.to ?? "WGS84", options);
|
|
12608
|
-
this.lossy = from.lossy || to.lossy;
|
|
12609
|
-
this.deferred = { options: { ...options, projections: [...registrations] } };
|
|
12610
|
-
} else {
|
|
12611
|
-
const eager = options;
|
|
12612
|
-
const eagerPlugins = plugins;
|
|
12613
|
-
const from = compileCRS(eager.from ?? "WGS84", eagerPlugins, eager);
|
|
12614
|
-
const to = compileCRS(eager.to ?? "WGS84", eagerPlugins, eager);
|
|
12615
|
-
this.targetRenderingProfile = ((_b2 = (_a3 = to.implementation) == null ? void 0 : _a3.getRenderingProfile) == null ? void 0 : _b2.bind(to.implementation)) ?? (to.kind === "geographic" ? createGeographicProfile(to.parameters, to.primeMeridian) : to.kind === "identity" ? getIdentityRenderingProfile : void 0);
|
|
12616
|
-
this.targetCoverage = to.areaOfUse;
|
|
12617
|
-
this.targetLongitudeOrigin = ((_c = to.implementation) == null ? void 0 : _c.longitudeOrigin) ?? (to.kind === "geographic" ? to.longitudeWrap ?? 0 : 0);
|
|
12618
|
-
this.lossy = from.lossy || to.lossy;
|
|
12619
|
-
if (this.lossy && (from.kind === "geocentric" || to.kind === "geocentric"))
|
|
12620
|
-
unsupportedStage("Horizontal extraction cannot supply ellipsoidal height for geocentric coordinates");
|
|
12621
|
-
if (this.lossy && (from.verticalGrid || to.verticalGrid))
|
|
12622
|
-
unsupportedStage("Horizontal extraction cannot be combined with vertical grids");
|
|
12623
|
-
this.forwardTransform = compileTransform(from, to, Boolean(options.enforceAxis));
|
|
12624
|
-
this.inverseTransform = compileTransform(to, from, Boolean(options.enforceAxis));
|
|
12625
|
-
this.resolvedDescription = describeTransform(describeCRS(from), describeCRS(to), this.forwardTransform.description, this.inverseTransform.description);
|
|
12626
|
-
}
|
|
12627
|
-
this.project = this.project.bind(this);
|
|
12628
|
-
this.unproject = this.unproject.bind(this);
|
|
12629
|
-
this.projectTo = this.projectTo.bind(this);
|
|
12630
|
-
this.unprojectTo = this.unprojectTo.bind(this);
|
|
12631
|
-
this.projectToSync = this.projectToSync.bind(this);
|
|
12632
|
-
this.unprojectToSync = this.unprojectToSync.bind(this);
|
|
12633
|
-
this.projectFlat = this.projectFlat.bind(this);
|
|
12634
|
-
this.unprojectFlat = this.unprojectFlat.bind(this);
|
|
12635
|
-
this.projectSync = this.projectSync.bind(this);
|
|
12636
|
-
this.unprojectSync = this.unprojectSync.bind(this);
|
|
12637
|
-
this.projectFlatSync = this.projectFlatSync.bind(this);
|
|
12638
|
-
this.unprojectFlatSync = this.unprojectFlatSync.bind(this);
|
|
12639
|
-
}
|
|
12640
|
-
load() {
|
|
12641
|
-
const state = this.deferred;
|
|
12642
|
-
if (!state)
|
|
12643
|
-
return Promise.resolve(this);
|
|
12644
|
-
if (state.implementation)
|
|
12645
|
-
return Promise.resolve(state.implementation);
|
|
12646
|
-
state.pending || (state.pending = _ProjectionTransform.create(state.options).then((projection) => {
|
|
12647
|
-
state.implementation = projection;
|
|
12648
|
-
return projection;
|
|
12649
|
-
}).catch((error) => {
|
|
12650
|
-
state.pending = void 0;
|
|
12651
|
-
throw error;
|
|
12652
|
-
}));
|
|
12653
|
-
return state.pending;
|
|
12654
|
-
}
|
|
12655
|
-
loadSync() {
|
|
12656
|
-
const state = this.deferred;
|
|
12657
|
-
if (!state)
|
|
12658
|
-
return this;
|
|
12659
|
-
if (!state.implementation) {
|
|
12660
|
-
const projections = requiredProjections(state.options).map((descriptor) => {
|
|
12661
|
-
const plugin = getLoadedProjection(descriptor);
|
|
12662
|
-
if (!plugin)
|
|
12663
|
-
throw new Error("Projection is not preloaded: " + descriptor.name + ". Call preload() first.");
|
|
12664
|
-
return plugin;
|
|
12665
|
-
});
|
|
12666
|
-
state.implementation = new _ProjectionTransform({ ...state.options, projections });
|
|
12667
|
-
}
|
|
12668
|
-
return state.implementation;
|
|
12669
|
-
}
|
|
12670
|
-
/** Synchronous variants never import algorithms; descriptors must be preloaded. */
|
|
12671
|
-
projectSync(coordinate) {
|
|
12672
|
-
return this.deferred ? this.loadSync().project(coordinate) : transformScalar(coordinate, this.forwardTransform, this.coordinateScratch);
|
|
12673
|
-
}
|
|
12674
|
-
unprojectSync(coordinate) {
|
|
12675
|
-
return this.deferred ? this.loadSync().unproject(coordinate) : transformScalar(coordinate, this.inverseTransform, this.coordinateScratch);
|
|
12676
|
-
}
|
|
12677
|
-
projectFlatSync(coordinates2, dimension = 2) {
|
|
12678
|
-
return this.deferred ? this.loadSync().projectFlat(coordinates2, dimension) : transformInPlace(coordinates2, dimension, this.forwardTransform, this.coordinateScratch);
|
|
12679
|
-
}
|
|
12680
|
-
unprojectFlatSync(coordinates2, dimension = 2) {
|
|
12681
|
-
return this.deferred ? this.loadSync().unprojectFlat(coordinates2, dimension) : transformInPlace(coordinates2, dimension, this.inverseTransform, this.coordinateScratch);
|
|
12682
|
-
}
|
|
12683
|
-
/** Optional warm-up. Coordinate methods also load automatically on first use. */
|
|
12684
|
-
async preload() {
|
|
12685
|
-
await this.load();
|
|
12686
|
-
}
|
|
12687
|
-
/** Eager plugins return arrays; descriptor-backed instances return promises. */
|
|
12688
|
-
project(coordinate) {
|
|
12689
|
-
const result = this.deferred ? this.projectLoaded(coordinate, false) : transformScalar(coordinate, this.forwardTransform, this.coordinateScratch);
|
|
12690
|
-
return result;
|
|
12691
|
-
}
|
|
12692
|
-
unproject(coordinate) {
|
|
12693
|
-
const result = this.deferred ? this.projectLoaded(coordinate, true) : transformScalar(coordinate, this.inverseTransform, this.coordinateScratch);
|
|
12694
|
-
return result;
|
|
12695
|
-
}
|
|
12696
|
-
/** Write one coordinate into caller-owned storage; return that same output. */
|
|
12697
|
-
projectTo(coordinate, output) {
|
|
12698
|
-
return this.deferred ? this.projectToLoaded(coordinate, output, false) : this.projectToSync(coordinate, output);
|
|
12699
|
-
}
|
|
12700
|
-
unprojectTo(coordinate, output) {
|
|
12701
|
-
return this.deferred ? this.projectToLoaded(coordinate, output, true) : this.unprojectToSync(coordinate, output);
|
|
12702
|
-
}
|
|
12703
|
-
projectToSync(coordinate, output) {
|
|
12704
|
-
if (this.deferred)
|
|
12705
|
-
return this.loadSync().projectTo(coordinate, output);
|
|
12706
|
-
validateScalarOutput(coordinate, output, Math.max(coordinate.length, this.forwardTransform.geocentricOutput ? 3 : 2));
|
|
12707
|
-
return transformScalar(coordinate, this.forwardTransform, this.coordinateScratch, output);
|
|
12708
|
-
}
|
|
12709
|
-
unprojectToSync(coordinate, output) {
|
|
12710
|
-
if (this.deferred)
|
|
12711
|
-
return this.loadSync().unprojectTo(coordinate, output);
|
|
12712
|
-
validateScalarOutput(coordinate, output, Math.max(coordinate.length, this.inverseTransform.geocentricOutput ? 3 : 2));
|
|
12713
|
-
return transformScalar(coordinate, this.inverseTransform, this.coordinateScratch, output);
|
|
12714
|
-
}
|
|
12715
|
-
projectToLoaded(coordinate, output, inverse34) {
|
|
12716
|
-
validateScalarOutput(coordinate, output, coordinate.length);
|
|
12717
|
-
const input = coordinate.slice();
|
|
12718
|
-
return this.load().then((projection) => inverse34 ? projection.unprojectTo(input, output) : projection.projectTo(input, output));
|
|
12719
|
-
}
|
|
12720
|
-
projectLoaded(coordinate, inverse34) {
|
|
12721
|
-
const input = coordinate.slice();
|
|
12722
|
-
return this.load().then((projection) => inverse34 ? projection.unproject(input) : projection.project(input));
|
|
12723
|
-
}
|
|
12724
|
-
/** In-place; descriptor callers must await completion before reusing the buffer. */
|
|
12725
|
-
projectFlat(coordinates2, dimension = 2) {
|
|
12726
|
-
const result = this.deferred ? this.load().then((projection) => projection.projectFlat(coordinates2, dimension)) : transformInPlace(coordinates2, dimension, this.forwardTransform, this.coordinateScratch);
|
|
12727
|
-
return result;
|
|
12728
|
-
}
|
|
12729
|
-
unprojectFlat(coordinates2, dimension = 2) {
|
|
12730
|
-
const result = this.deferred ? this.load().then((projection) => projection.unprojectFlat(coordinates2, dimension)) : transformInPlace(coordinates2, dimension, this.inverseTransform, this.coordinateScratch);
|
|
12731
|
-
return result;
|
|
12732
|
-
}
|
|
12733
|
-
};
|
|
12734
|
-
pluginKey = (name) => name.toLowerCase().replace(/[\s_-]/g, "");
|
|
12735
|
-
}
|
|
12736
|
-
});
|
|
12737
|
-
|
|
12738
|
-
// dist/projection/experimental/projection-engine.js
|
|
12739
|
-
var ConfigurableProjectionEngine;
|
|
12740
|
-
var init_projection_engine = __esm({
|
|
12741
|
-
"dist/projection/experimental/projection-engine.js"() {
|
|
12742
|
-
init_crs_descriptor();
|
|
12743
|
-
init_engine_options();
|
|
12744
|
-
init_resolve();
|
|
12745
|
-
init_typescript_projection();
|
|
12746
|
-
init_engine_options();
|
|
12747
|
-
ConfigurableProjectionEngine = class {
|
|
12748
|
-
constructor(options = {}) {
|
|
12749
|
-
this.options = snapshotEngineOptions(options);
|
|
12750
|
-
this.useDefinitionSignature = !hasCRSOverrides(options);
|
|
12751
|
-
}
|
|
12752
|
-
/** Resolve a CRS and load only its required algorithms before exposing sync conversions. */
|
|
12753
|
-
getCRS(definition, options = {}) {
|
|
12754
|
-
return resolveCRSDescriptor(this, definition, this.options, options, this.useDefinitionSignature, this.options.resolver ? prepareCRSInput : void 0);
|
|
12755
|
-
}
|
|
12756
|
-
/** Compile a CRS pair. Lazy descriptors remain unloaded until the transform is used. */
|
|
12757
|
-
createProjection(options = {}) {
|
|
12758
|
-
return new ProjectionTransform({ ...this.options, ...options });
|
|
12759
|
-
}
|
|
12760
|
-
/** Load only the algorithms required by this CRS pair and return a synchronous transform. */
|
|
12761
|
-
async createProjectionAsync(options = {}) {
|
|
12762
|
-
const config = { ...this.options, ...options };
|
|
12763
|
-
return ProjectionTransform.create(config.resolver ? await prepareEngineOptions(config) : config);
|
|
12764
|
-
}
|
|
12765
|
-
};
|
|
9969
|
+
import_map_transition = require("./../maps/map-transition.shared.cjs");
|
|
9970
|
+
mapTransitions = { MapTransition: import_map_transition.MapTransition };
|
|
12766
9971
|
}
|
|
12767
9972
|
});
|
|
12768
9973
|
|
|
@@ -14112,91 +11317,637 @@ var init_datum_table = __esm({
|
|
|
14112
11317
|
towgs84: "0,0,0"
|
|
14113
11318
|
}
|
|
14114
11319
|
};
|
|
14115
|
-
for (const key3 in datums) {
|
|
14116
|
-
const datum = datums[key3];
|
|
14117
|
-
if (!datum.datumName) {
|
|
14118
|
-
continue;
|
|
11320
|
+
for (const key3 in datums) {
|
|
11321
|
+
const datum = datums[key3];
|
|
11322
|
+
if (!datum.datumName) {
|
|
11323
|
+
continue;
|
|
11324
|
+
}
|
|
11325
|
+
datums[datum.datumName] = datum;
|
|
11326
|
+
}
|
|
11327
|
+
datum_table_default = datums;
|
|
11328
|
+
}
|
|
11329
|
+
});
|
|
11330
|
+
|
|
11331
|
+
// dist/projection/datums.js
|
|
11332
|
+
var datumCatalog;
|
|
11333
|
+
var init_datums = __esm({
|
|
11334
|
+
"dist/projection/datums.js"() {
|
|
11335
|
+
init_datum_table();
|
|
11336
|
+
datumCatalog = Object.freeze({
|
|
11337
|
+
name: "regional-datums",
|
|
11338
|
+
datums: Object.freeze(datum_table_default)
|
|
11339
|
+
});
|
|
11340
|
+
}
|
|
11341
|
+
});
|
|
11342
|
+
|
|
11343
|
+
// dist/projection/experimental/crs/datum-catalog.js
|
|
11344
|
+
function getDatumDefinitions(options) {
|
|
11345
|
+
var _a2;
|
|
11346
|
+
if (!((_a2 = options.datumCatalogs) == null ? void 0 : _a2.length))
|
|
11347
|
+
return builtins;
|
|
11348
|
+
const cached = resolved.get(options);
|
|
11349
|
+
if ((cached == null ? void 0 : cached.catalogs) === options.datumCatalogs)
|
|
11350
|
+
return cached.definitions;
|
|
11351
|
+
const definitions = Object.assign(/* @__PURE__ */ Object.create(null), builtins);
|
|
11352
|
+
const names = new Map(Object.entries(builtins).map(([name, definition]) => [
|
|
11353
|
+
datumNameKey(name),
|
|
11354
|
+
{ definition, owner: -1 }
|
|
11355
|
+
]));
|
|
11356
|
+
options.datumCatalogs.forEach((catalog, owner) => {
|
|
11357
|
+
if (!catalog.name || !catalog.datums)
|
|
11358
|
+
throw new Error("Invalid datum catalogue plugin");
|
|
11359
|
+
for (const [name, definition] of Object.entries(catalog.datums)) {
|
|
11360
|
+
const key3 = datumNameKey(name);
|
|
11361
|
+
if (!key3 || key3 === "none" || !definition || ["ellipse", "towgs84", "nadgrids"].some((field) => definition[field] !== void 0 && typeof definition[field] !== "string"))
|
|
11362
|
+
throw new Error("Invalid datum definition: " + name);
|
|
11363
|
+
const previous = names.get(key3);
|
|
11364
|
+
if (previous && (previous.owner !== owner || previous.definition.ellipse !== definition.ellipse || previous.definition.towgs84 !== definition.towgs84 || previous.definition.nadgrids !== definition.nadgrids))
|
|
11365
|
+
throw new Error("Conflicting datum registration: " + name);
|
|
11366
|
+
names.set(key3, { definition, owner });
|
|
11367
|
+
definitions[name] = definition;
|
|
11368
|
+
}
|
|
11369
|
+
});
|
|
11370
|
+
resolved.set(options, { catalogs: options.datumCatalogs, definitions });
|
|
11371
|
+
return definitions;
|
|
11372
|
+
}
|
|
11373
|
+
var wgs84, nad83, builtins, resolved, datumNameKey;
|
|
11374
|
+
var init_datum_catalog = __esm({
|
|
11375
|
+
"dist/projection/experimental/crs/datum-catalog.js"() {
|
|
11376
|
+
wgs84 = { towgs84: "0,0,0", ellipse: "WGS84" };
|
|
11377
|
+
nad83 = { towgs84: "0,0,0", ellipse: "GRS80" };
|
|
11378
|
+
builtins = {
|
|
11379
|
+
wgs84,
|
|
11380
|
+
WGS84: wgs84,
|
|
11381
|
+
nad83,
|
|
11382
|
+
North_American_Datum_1983: nad83
|
|
11383
|
+
};
|
|
11384
|
+
resolved = /* @__PURE__ */ new WeakMap();
|
|
11385
|
+
datumNameKey = (name) => name.toLowerCase().replace(/[\s_-]/g, "");
|
|
11386
|
+
}
|
|
11387
|
+
});
|
|
11388
|
+
|
|
11389
|
+
// dist/crs/spatial-reference.js
|
|
11390
|
+
function inferCRSRepresentation(definition) {
|
|
11391
|
+
if (typeof definition === "object") {
|
|
11392
|
+
return "projjson";
|
|
11393
|
+
}
|
|
11394
|
+
const text = definition.trim();
|
|
11395
|
+
if (/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(text)) {
|
|
11396
|
+
return "wkt";
|
|
11397
|
+
}
|
|
11398
|
+
if (/(?:^|\s)\+?proj=/i.test(text)) {
|
|
11399
|
+
return "proj-string";
|
|
11400
|
+
}
|
|
11401
|
+
if (/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(text) || /^urn:ogc:def:crs:/i.test(text) || /^https?:\/\//i.test(text) || /^[A-Z][A-Z0-9._-]*$/i.test(text)) {
|
|
11402
|
+
return "identifier";
|
|
11403
|
+
}
|
|
11404
|
+
return "opaque";
|
|
11405
|
+
}
|
|
11406
|
+
var init_spatial_reference = __esm({
|
|
11407
|
+
"dist/crs/spatial-reference.js"() {
|
|
11408
|
+
}
|
|
11409
|
+
});
|
|
11410
|
+
|
|
11411
|
+
// dist/projection/experimental/parameters.js
|
|
11412
|
+
function numberParameter(parameters, name, fallback) {
|
|
11413
|
+
if (!Object.prototype.hasOwnProperty.call(parameters, name))
|
|
11414
|
+
return fallback;
|
|
11415
|
+
const value2 = parameters[name];
|
|
11416
|
+
if (typeof value2 !== "string" || !/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(value2)) {
|
|
11417
|
+
throw new Error(`Invalid numeric PROJ parameter: +${name}`);
|
|
11418
|
+
}
|
|
11419
|
+
const number = Number(value2);
|
|
11420
|
+
if (!Number.isFinite(number))
|
|
11421
|
+
throw new Error(`Invalid numeric PROJ parameter: +${name}`);
|
|
11422
|
+
return number;
|
|
11423
|
+
}
|
|
11424
|
+
function latitudeParameter(parameters, name) {
|
|
11425
|
+
const degrees4 = numberParameter(parameters, name, 0);
|
|
11426
|
+
if (Math.abs(degrees4) >= 90)
|
|
11427
|
+
throw new Error(`+${name} must be between -90 and 90 degrees`);
|
|
11428
|
+
return degrees4 * DEGREES_TO_RADIANS;
|
|
11429
|
+
}
|
|
11430
|
+
function wrapLongitude(longitude3, over = false) {
|
|
11431
|
+
if (over || Math.abs(longitude3) <= Math.PI)
|
|
11432
|
+
return longitude3;
|
|
11433
|
+
const circle = 2 * Math.PI;
|
|
11434
|
+
return ((longitude3 + Math.PI) % circle + circle) % circle - Math.PI;
|
|
11435
|
+
}
|
|
11436
|
+
var DEGREES_TO_RADIANS;
|
|
11437
|
+
var init_parameters = __esm({
|
|
11438
|
+
"dist/projection/experimental/parameters.js"() {
|
|
11439
|
+
DEGREES_TO_RADIANS = Math.PI / 180;
|
|
11440
|
+
}
|
|
11441
|
+
});
|
|
11442
|
+
|
|
11443
|
+
// dist/projection/experimental/crs/normalize.js
|
|
11444
|
+
var import_types2, CORE_PARAMETERS;
|
|
11445
|
+
var init_normalize = __esm({
|
|
11446
|
+
"dist/projection/experimental/crs/normalize.js"() {
|
|
11447
|
+
import_types2 = require("./../projection/experimental/crs/types.shared.cjs");
|
|
11448
|
+
CORE_PARAMETERS = [
|
|
11449
|
+
"proj",
|
|
11450
|
+
"datum",
|
|
11451
|
+
"ellps",
|
|
11452
|
+
"a",
|
|
11453
|
+
"b",
|
|
11454
|
+
"rf",
|
|
11455
|
+
"f",
|
|
11456
|
+
"R",
|
|
11457
|
+
"units",
|
|
11458
|
+
"to_meter",
|
|
11459
|
+
"vunits",
|
|
11460
|
+
"vto_meter",
|
|
11461
|
+
"no_defs",
|
|
11462
|
+
"type",
|
|
11463
|
+
"title",
|
|
11464
|
+
"towgs84",
|
|
11465
|
+
"nadgrids",
|
|
11466
|
+
"geoidgrids",
|
|
11467
|
+
"axis",
|
|
11468
|
+
"pm",
|
|
11469
|
+
"over",
|
|
11470
|
+
"lon_wrap"
|
|
11471
|
+
];
|
|
11472
|
+
}
|
|
11473
|
+
});
|
|
11474
|
+
|
|
11475
|
+
// dist/projection/experimental/core.js
|
|
11476
|
+
var import_typescript_projection, import_types3, import_projection_engine;
|
|
11477
|
+
var init_core = __esm({
|
|
11478
|
+
"dist/projection/experimental/core.js"() {
|
|
11479
|
+
import_typescript_projection = require("./../projection/experimental/typescript-projection.shared.cjs");
|
|
11480
|
+
import_types3 = require("./../projection/experimental/crs/types.shared.cjs");
|
|
11481
|
+
import_projection_engine = require("./../projection/experimental/projection-engine.shared.cjs");
|
|
11482
|
+
}
|
|
11483
|
+
});
|
|
11484
|
+
|
|
11485
|
+
// dist/projection/experimental/projection-scratch.js
|
|
11486
|
+
function createPoint() {
|
|
11487
|
+
return { x: 0, y: 0, z: 0 };
|
|
11488
|
+
}
|
|
11489
|
+
var ProjectionScratch;
|
|
11490
|
+
var init_projection_scratch = __esm({
|
|
11491
|
+
"dist/projection/experimental/projection-scratch.js"() {
|
|
11492
|
+
ProjectionScratch = class {
|
|
11493
|
+
constructor() {
|
|
11494
|
+
this.point = createPoint();
|
|
11495
|
+
this.points = [this.point];
|
|
11496
|
+
this.active = 0;
|
|
11497
|
+
}
|
|
11498
|
+
get depth() {
|
|
11499
|
+
return this.active;
|
|
11500
|
+
}
|
|
11501
|
+
acquire() {
|
|
11502
|
+
var _a2;
|
|
11503
|
+
const index = this.active++;
|
|
11504
|
+
(_a2 = this.points)[index] || (_a2[index] = createPoint());
|
|
11505
|
+
return this.points[index];
|
|
11506
|
+
}
|
|
11507
|
+
release(point) {
|
|
11508
|
+
if (this.active > 0 && this.points[this.active - 1] === point)
|
|
11509
|
+
this.active--;
|
|
11510
|
+
}
|
|
11511
|
+
};
|
|
11512
|
+
}
|
|
11513
|
+
});
|
|
11514
|
+
|
|
11515
|
+
// dist/projection/experimental/mutable-projection.js
|
|
11516
|
+
function createProjection(forward33, inverse34) {
|
|
11517
|
+
const scratch = new ProjectionScratch();
|
|
11518
|
+
const scalar = (x, y, operation2) => {
|
|
11519
|
+
const point = scratch.acquire();
|
|
11520
|
+
try {
|
|
11521
|
+
point.x = x;
|
|
11522
|
+
point.y = y;
|
|
11523
|
+
point.z = 0;
|
|
11524
|
+
operation2(point);
|
|
11525
|
+
return [point.x, point.y];
|
|
11526
|
+
} finally {
|
|
11527
|
+
scratch.release(point);
|
|
11528
|
+
}
|
|
11529
|
+
};
|
|
11530
|
+
return {
|
|
11531
|
+
forward(x, y) {
|
|
11532
|
+
return scalar(x, y, forward33);
|
|
11533
|
+
},
|
|
11534
|
+
inverse(x, y) {
|
|
11535
|
+
return scalar(x, y, inverse34);
|
|
11536
|
+
},
|
|
11537
|
+
forwardInPlace: forward33,
|
|
11538
|
+
inverseInPlace: inverse34
|
|
11539
|
+
};
|
|
11540
|
+
}
|
|
11541
|
+
function projectionOperation(implementation, inverse34, geocentric2 = false) {
|
|
11542
|
+
const mutable = inverse34 ? implementation.inverseInPlace : implementation.forwardInPlace;
|
|
11543
|
+
if (mutable)
|
|
11544
|
+
return mutable.bind(implementation);
|
|
11545
|
+
if (geocentric2) {
|
|
11546
|
+
const operation3 = inverse34 ? implementation.inverse3D : implementation.forward3D;
|
|
11547
|
+
return (point) => {
|
|
11548
|
+
const output = operation3.call(implementation, [point.x, point.y, point.z]);
|
|
11549
|
+
point.x = output[0];
|
|
11550
|
+
point.y = output[1];
|
|
11551
|
+
point.z = output[2];
|
|
11552
|
+
};
|
|
11553
|
+
}
|
|
11554
|
+
const operation2 = inverse34 ? implementation.inverse : implementation.forward;
|
|
11555
|
+
return (point) => {
|
|
11556
|
+
const output = operation2.call(implementation, point.x, point.y);
|
|
11557
|
+
point.x = output[0];
|
|
11558
|
+
point.y = output[1];
|
|
11559
|
+
};
|
|
11560
|
+
}
|
|
11561
|
+
var init_mutable_projection = __esm({
|
|
11562
|
+
"dist/projection/experimental/mutable-projection.js"() {
|
|
11563
|
+
init_projection_scratch();
|
|
11564
|
+
}
|
|
11565
|
+
});
|
|
11566
|
+
|
|
11567
|
+
// dist/projection/experimental/flat-projection.js
|
|
11568
|
+
function createFlatProjection(forward33, inverse34) {
|
|
11569
|
+
return {
|
|
11570
|
+
...createProjection(forward33, inverse34),
|
|
11571
|
+
createForwardFlat(context) {
|
|
11572
|
+
return this.forwardInPlace === forward33 ? createFlatOperation(forward33, false, context) : void 0;
|
|
11573
|
+
},
|
|
11574
|
+
createInverseFlat(context) {
|
|
11575
|
+
return this.inverseInPlace === inverse34 ? createFlatOperation(inverse34, true, context) : void 0;
|
|
11576
|
+
}
|
|
11577
|
+
};
|
|
11578
|
+
}
|
|
11579
|
+
function createFlatOperation(project, inverse34, { inputScale, outputScale }) {
|
|
11580
|
+
const scratch = new ProjectionScratch();
|
|
11581
|
+
return (coordinates2, dimension) => {
|
|
11582
|
+
const point = scratch.acquire();
|
|
11583
|
+
try {
|
|
11584
|
+
const float32 = coordinates2 instanceof Float32Array;
|
|
11585
|
+
for (let offset = 0; offset < coordinates2.length; offset += dimension) {
|
|
11586
|
+
point.x = coordinates2[offset];
|
|
11587
|
+
point.y = coordinates2[offset + 1];
|
|
11588
|
+
point.z = dimension >= 3 ? coordinates2[offset + 2] : 0;
|
|
11589
|
+
if (!Number.isFinite(point.x) || !Number.isFinite(point.y) || !Number.isFinite(point.z))
|
|
11590
|
+
throw new Error("Coordinates must contain finite x, y and optional z values");
|
|
11591
|
+
if (inputScale !== 1) {
|
|
11592
|
+
point.x *= inputScale;
|
|
11593
|
+
point.y *= inputScale;
|
|
11594
|
+
}
|
|
11595
|
+
if (inverse34)
|
|
11596
|
+
project(point);
|
|
11597
|
+
if (Math.abs(point.y) > Math.PI / 2 || !Number.isFinite(point.x) || !Number.isFinite(point.y))
|
|
11598
|
+
throw new Error("Coordinate is outside the geographic domain");
|
|
11599
|
+
point.x += 0;
|
|
11600
|
+
point.x -= 0;
|
|
11601
|
+
if (!inverse34)
|
|
11602
|
+
project(point);
|
|
11603
|
+
if (outputScale !== 1) {
|
|
11604
|
+
point.x /= outputScale;
|
|
11605
|
+
point.y /= outputScale;
|
|
11606
|
+
}
|
|
11607
|
+
if (!Number.isFinite(point.x) || !Number.isFinite(point.y))
|
|
11608
|
+
throw new Error("Projection produced non-finite coordinates");
|
|
11609
|
+
if (float32 && (Math.abs(point.x) > 34028234663852886e22 || Math.abs(point.y) > 34028234663852886e22))
|
|
11610
|
+
throw new Error("Projected coordinate exceeds Float32 range");
|
|
11611
|
+
coordinates2[offset] = point.x;
|
|
11612
|
+
coordinates2[offset + 1] = point.y;
|
|
14119
11613
|
}
|
|
14120
|
-
|
|
11614
|
+
} finally {
|
|
11615
|
+
scratch.release(point);
|
|
14121
11616
|
}
|
|
14122
|
-
|
|
11617
|
+
};
|
|
11618
|
+
}
|
|
11619
|
+
var init_flat_projection = __esm({
|
|
11620
|
+
"dist/projection/experimental/flat-projection.js"() {
|
|
11621
|
+
init_mutable_projection();
|
|
11622
|
+
init_projection_scratch();
|
|
14123
11623
|
}
|
|
14124
11624
|
});
|
|
14125
11625
|
|
|
14126
|
-
// dist/projection/
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
11626
|
+
// dist/projection/experimental/rendering-profile/geographic-bounds.js
|
|
11627
|
+
function createAngularRanges(west, south, east, north) {
|
|
11628
|
+
return [
|
|
11629
|
+
[west, south],
|
|
11630
|
+
[east, north]
|
|
11631
|
+
];
|
|
11632
|
+
}
|
|
11633
|
+
function normalizeLongitude(longitude3) {
|
|
11634
|
+
return longitude3 >= -180 && longitude3 < 180 ? longitude3 : ((longitude3 + 180) % 360 + 360) % 360 - 180;
|
|
11635
|
+
}
|
|
11636
|
+
function createGeographicBounds(west, south, east, north) {
|
|
11637
|
+
if (![west, south, east, north].every(Number.isFinite) || south < -90 || north > 90 || south > north || east - west < -360 || east - west > 360 + 1e-10)
|
|
11638
|
+
throw new Error("Invalid geographic coverage");
|
|
11639
|
+
if (east - west >= 360 - 1e-10)
|
|
11640
|
+
return [-180, south, 180, north];
|
|
11641
|
+
const wrappedEast = normalizeLongitude(east);
|
|
11642
|
+
return [
|
|
11643
|
+
normalizeLongitude(west),
|
|
11644
|
+
south,
|
|
11645
|
+
wrappedEast === -180 && east > west ? 180 : wrappedEast,
|
|
11646
|
+
north
|
|
11647
|
+
];
|
|
11648
|
+
}
|
|
11649
|
+
function getLongitudeSpan(bounds2) {
|
|
11650
|
+
const span = bounds2[2] - bounds2[0];
|
|
11651
|
+
return span < 0 ? span + 360 : span;
|
|
11652
|
+
}
|
|
11653
|
+
function splitGeographicBounds(bounds2) {
|
|
11654
|
+
const [west, south, east, north] = bounds2;
|
|
11655
|
+
return west <= east ? [bounds2] : [
|
|
11656
|
+
[west, south, 180, north],
|
|
11657
|
+
[-180, south, east, north]
|
|
11658
|
+
];
|
|
11659
|
+
}
|
|
11660
|
+
function containsGeographicPoint(bounds2, point) {
|
|
11661
|
+
const [west, south, east, north] = bounds2;
|
|
11662
|
+
const longitude3 = normalizeLongitude(point[0]);
|
|
11663
|
+
return point[1] >= south && point[1] <= north && (west <= east ? longitude3 >= west && longitude3 <= east || longitude3 === -180 && east === 180 : longitude3 >= west || longitude3 <= east);
|
|
11664
|
+
}
|
|
11665
|
+
function intersectGeographicBounds(a, b) {
|
|
11666
|
+
const south = Math.max(a[1], b[1]), north = Math.min(a[3], b[3]);
|
|
11667
|
+
if (south > north)
|
|
11668
|
+
return [];
|
|
11669
|
+
const intervals = [];
|
|
11670
|
+
for (const left of splitGeographicBounds(a))
|
|
11671
|
+
for (const right of splitGeographicBounds(b)) {
|
|
11672
|
+
const west = Math.max(left[0], right[0]), east = Math.min(left[2], right[2]);
|
|
11673
|
+
if (west <= east)
|
|
11674
|
+
intervals.push([west, east]);
|
|
11675
|
+
else if (left[2] === 180 && right[0] === -180 || right[2] === 180 && left[0] === -180)
|
|
11676
|
+
intervals.push([-180, -180]);
|
|
11677
|
+
}
|
|
11678
|
+
intervals.sort((left, right) => left[0] - right[0]);
|
|
11679
|
+
const merged = [];
|
|
11680
|
+
for (const interval of intervals) {
|
|
11681
|
+
const last = merged[merged.length - 1];
|
|
11682
|
+
if (last && interval[0] <= last[1])
|
|
11683
|
+
last[1] = Math.max(last[1], interval[1]);
|
|
11684
|
+
else
|
|
11685
|
+
merged.push([...interval]);
|
|
11686
|
+
}
|
|
11687
|
+
if (merged.length > 1 && merged[0][0] === -180 && merged[merged.length - 1][1] === 180) {
|
|
11688
|
+
const first = merged.shift(), last = merged.pop();
|
|
11689
|
+
return [
|
|
11690
|
+
[last[0], south, first[1], north],
|
|
11691
|
+
...merged.map(([west, east]) => [west, south, east, north])
|
|
11692
|
+
];
|
|
11693
|
+
}
|
|
11694
|
+
return merged.map(([west, east]) => [west, south, east, north]);
|
|
11695
|
+
}
|
|
11696
|
+
function clampGeographicPoint(bounds2, point) {
|
|
11697
|
+
let longitude3 = normalizeLongitude(point[0]);
|
|
11698
|
+
const latitude = Math.max(bounds2[1], Math.min(bounds2[3], point[1]));
|
|
11699
|
+
if (!containsGeographicPoint(bounds2, [longitude3, latitude])) {
|
|
11700
|
+
const westDistance = Math.abs(normalizeLongitude(longitude3 - bounds2[0]));
|
|
11701
|
+
const eastDistance = Math.abs(normalizeLongitude(longitude3 - bounds2[2]));
|
|
11702
|
+
longitude3 = westDistance <= eastDistance ? bounds2[0] : bounds2[2];
|
|
11703
|
+
}
|
|
11704
|
+
return [longitude3, latitude];
|
|
11705
|
+
}
|
|
11706
|
+
function getAngularRanges(bounds2, primeMeridian = 0, origin = 0) {
|
|
11707
|
+
const width = getLongitudeSpan(bounds2);
|
|
11708
|
+
const west = bounds2[0] * RADIANS - primeMeridian;
|
|
11709
|
+
const middle = west + width * RADIANS / 2;
|
|
11710
|
+
const shift = Math.round((origin - middle) / (2 * Math.PI)) * 2 * Math.PI;
|
|
11711
|
+
return createAngularRanges(width === 360 ? origin - Math.PI : west + shift, bounds2[1] * RADIANS, width === 360 ? origin + Math.PI : west + shift + width * RADIANS, bounds2[3] * RADIANS);
|
|
11712
|
+
}
|
|
11713
|
+
function getGeographicBounds(ranges, primeMeridian = 0) {
|
|
11714
|
+
return createGeographicBounds((ranges[0][0] + primeMeridian) / RADIANS, ranges[0][1] / RADIANS, (ranges[1][0] + primeMeridian) / RADIANS, ranges[1][1] / RADIANS);
|
|
11715
|
+
}
|
|
11716
|
+
function unionRenderingBounds(bounds2) {
|
|
11717
|
+
if (!bounds2.length)
|
|
11718
|
+
throw new Error("CRS coverage does not intersect the rendering target");
|
|
11719
|
+
return [
|
|
11720
|
+
[0, 1, 2].map((axis) => Math.min(...bounds2.map((pair2) => pair2[0][axis]))),
|
|
11721
|
+
[0, 1, 2].map((axis) => Math.max(...bounds2.map((pair2) => pair2[1][axis])))
|
|
11722
|
+
];
|
|
11723
|
+
}
|
|
11724
|
+
var RADIANS;
|
|
11725
|
+
var init_geographic_bounds = __esm({
|
|
11726
|
+
"dist/projection/experimental/rendering-profile/geographic-bounds.js"() {
|
|
11727
|
+
RADIANS = Math.PI / 180;
|
|
14135
11728
|
}
|
|
14136
11729
|
});
|
|
14137
11730
|
|
|
14138
|
-
// dist/projection/experimental/
|
|
14139
|
-
|
|
14140
|
-
|
|
11731
|
+
// dist/projection/experimental/rendering-profile/rendering-profile.js
|
|
11732
|
+
function resolveBounds(profile) {
|
|
11733
|
+
var _a2;
|
|
11734
|
+
const bounds2 = profile.bounds;
|
|
11735
|
+
if (bounds2.some((corner) => corner.some((value2) => !Number.isFinite(value2))))
|
|
11736
|
+
throw new Error("Projection rendering bounds must be finite");
|
|
11737
|
+
return { bounds: bounds2, normalize: (_a2 = profile.normalize) == null ? void 0 : _a2.bind(profile) };
|
|
11738
|
+
}
|
|
11739
|
+
function createAngularNormalization(normalize2, primeMeridian = 0) {
|
|
11740
|
+
return (point) => {
|
|
11741
|
+
const x = point.x * Math.PI / 180 - primeMeridian;
|
|
11742
|
+
const y = point.y * Math.PI / 180;
|
|
11743
|
+
const native = { x, y, z: point.z };
|
|
11744
|
+
normalize2(native);
|
|
11745
|
+
if (native.x !== x)
|
|
11746
|
+
point.x = (native.x + primeMeridian) * 180 / Math.PI;
|
|
11747
|
+
if (native.y !== y)
|
|
11748
|
+
point.y = native.y * 180 / Math.PI;
|
|
11749
|
+
};
|
|
11750
|
+
}
|
|
11751
|
+
function combineRenderingProfiles(regions2, getProfile) {
|
|
11752
|
+
const profiles = [];
|
|
11753
|
+
for (const region of regions2) {
|
|
11754
|
+
const profile = getProfile(region);
|
|
11755
|
+
if (profile !== null)
|
|
11756
|
+
profiles.push(resolveBounds(profile));
|
|
11757
|
+
}
|
|
11758
|
+
if (!profiles.length)
|
|
11759
|
+
return null;
|
|
11760
|
+
if (profiles.length === 1)
|
|
11761
|
+
return profiles[0];
|
|
11762
|
+
return {
|
|
11763
|
+
bounds: unionRenderingBounds(profiles.map((profile) => profile.bounds)),
|
|
11764
|
+
normalize(point) {
|
|
11765
|
+
var _a2;
|
|
11766
|
+
let bestX = point.x, bestY = point.y, best = Infinity;
|
|
11767
|
+
for (const profile of profiles) {
|
|
11768
|
+
const candidate = { x: point.x, y: point.y, z: point.z };
|
|
11769
|
+
(_a2 = profile.normalize) == null ? void 0 : _a2.call(profile, candidate);
|
|
11770
|
+
const distance3 = Math.sin((candidate.y - point.y) * Math.PI / 360) ** 2 + Math.cos(point.y * Math.PI / 180) * Math.cos(candidate.y * Math.PI / 180) * Math.sin((candidate.x - point.x) * Math.PI / 360) ** 2;
|
|
11771
|
+
if (distance3 < best) {
|
|
11772
|
+
best = distance3;
|
|
11773
|
+
bestX = candidate.x;
|
|
11774
|
+
bestY = candidate.y;
|
|
11775
|
+
}
|
|
11776
|
+
}
|
|
11777
|
+
point.x = bestX;
|
|
11778
|
+
point.y = bestY;
|
|
11779
|
+
}
|
|
11780
|
+
};
|
|
11781
|
+
}
|
|
11782
|
+
var init_rendering_profile = __esm({
|
|
11783
|
+
"dist/projection/experimental/rendering-profile/rendering-profile.js"() {
|
|
11784
|
+
init_geographic_bounds();
|
|
14141
11785
|
}
|
|
14142
11786
|
});
|
|
14143
11787
|
|
|
14144
|
-
// dist/projection/experimental/
|
|
14145
|
-
function
|
|
11788
|
+
// dist/projection/experimental/rendering-profile/rectangular-rendering-profile.js
|
|
11789
|
+
function normalizeCoverage(point, coverage, center3 = 0, over = false) {
|
|
11790
|
+
const span = getLongitudeSpan(coverage);
|
|
11791
|
+
const west = span === 360 ? center3 - 180 : coverage[0] + Math.round((center3 - coverage[0] - span / 2) / 360) * 360;
|
|
11792
|
+
const east = west + span;
|
|
11793
|
+
if (over) {
|
|
11794
|
+
point.x = Math.max(west, Math.min(east, point.x));
|
|
11795
|
+
point.y = Math.max(coverage[1], Math.min(coverage[3], point.y));
|
|
11796
|
+
return;
|
|
11797
|
+
}
|
|
11798
|
+
const best = clampGeographicPoint(coverage, [point.x, point.y]);
|
|
11799
|
+
let longitude3 = best[0];
|
|
11800
|
+
if (best[0] === normalizeLongitude(point.x) && point.x >= west && point.x <= east)
|
|
11801
|
+
longitude3 = point.x;
|
|
11802
|
+
else if (longitude3 < west || longitude3 > east)
|
|
11803
|
+
longitude3 += Math.round(((west + east) / 2 - longitude3) / 360) * 360;
|
|
11804
|
+
const offset = longitude3 - center3;
|
|
11805
|
+
point.x = Math.abs(offset) <= 180 ? longitude3 : center3 + normalizeLongitude(offset);
|
|
11806
|
+
point.y = best[1];
|
|
11807
|
+
}
|
|
11808
|
+
function createRectangleRenderingProfile(resolveBounds2, coverage, origin = 0, primeMeridian = 0, over = false) {
|
|
11809
|
+
const center3 = (origin + primeMeridian) * 180 / Math.PI;
|
|
14146
11810
|
return {
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
return this.forwardInPlace === forward33 ? createFlatOperation(forward33, false, context) : void 0;
|
|
11811
|
+
get bounds() {
|
|
11812
|
+
return resolveBounds2(getAngularRanges(coverage, primeMeridian, origin));
|
|
14150
11813
|
},
|
|
14151
|
-
|
|
14152
|
-
|
|
11814
|
+
normalize(point) {
|
|
11815
|
+
normalizeCoverage(point, coverage, center3, over);
|
|
14153
11816
|
}
|
|
14154
11817
|
};
|
|
14155
11818
|
}
|
|
14156
|
-
function
|
|
14157
|
-
const
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
}
|
|
14184
|
-
if (!Number.isFinite(point.x) || !Number.isFinite(point.y))
|
|
14185
|
-
throw new Error("Projection produced non-finite coordinates");
|
|
14186
|
-
if (float32 && (Math.abs(point.x) > 34028234663852886e22 || Math.abs(point.y) > 34028234663852886e22))
|
|
14187
|
-
throw new Error("Projected coordinate exceeds Float32 range");
|
|
14188
|
-
coordinates2[offset] = point.x;
|
|
14189
|
-
coordinates2[offset + 1] = point.y;
|
|
11819
|
+
function createRegionsRenderingProfile(resolveBounds2, regions2, origin, primeMeridian, over) {
|
|
11820
|
+
const profile = combineRenderingProfiles(regions2, (region) => createRectangleRenderingProfile(resolveBounds2, region, origin, primeMeridian, over));
|
|
11821
|
+
if (!profile)
|
|
11822
|
+
throw new Error("CRS coverage does not intersect the rendering target");
|
|
11823
|
+
return profile;
|
|
11824
|
+
}
|
|
11825
|
+
function withRectangleRenderingProfile(implementation, parameters, resolveBounds2, primeMeridian = 0, over = false) {
|
|
11826
|
+
const origin = (parameters[0][0] + parameters[1][0]) / 2;
|
|
11827
|
+
const defaults = getGeographicBounds(parameters, primeMeridian);
|
|
11828
|
+
const center3 = (origin + primeMeridian) * 180 / Math.PI;
|
|
11829
|
+
return {
|
|
11830
|
+
...implementation,
|
|
11831
|
+
longitudeOrigin: origin,
|
|
11832
|
+
getRenderingProfile(coverage) {
|
|
11833
|
+
if (!coverage)
|
|
11834
|
+
return {
|
|
11835
|
+
bounds: resolveBounds2(parameters),
|
|
11836
|
+
normalize(point) {
|
|
11837
|
+
normalizeCoverage(point, defaults, center3, over);
|
|
11838
|
+
}
|
|
11839
|
+
};
|
|
11840
|
+
try {
|
|
11841
|
+
const profile = createRectangleRenderingProfile(resolveBounds2, coverage, origin, primeMeridian, over);
|
|
11842
|
+
const bounds2 = profile.bounds;
|
|
11843
|
+
return { bounds: bounds2, normalize: profile.normalize };
|
|
11844
|
+
} catch {
|
|
11845
|
+
return createRegionsRenderingProfile(resolveBounds2, intersectGeographicBounds(coverage, defaults), origin, primeMeridian, over);
|
|
14190
11846
|
}
|
|
14191
|
-
} finally {
|
|
14192
|
-
scratch.release(point);
|
|
14193
11847
|
}
|
|
14194
11848
|
};
|
|
14195
11849
|
}
|
|
14196
|
-
var
|
|
14197
|
-
"dist/projection/experimental/
|
|
14198
|
-
|
|
14199
|
-
|
|
11850
|
+
var init_rectangular_rendering_profile = __esm({
|
|
11851
|
+
"dist/projection/experimental/rendering-profile/rectangular-rendering-profile.js"() {
|
|
11852
|
+
init_geographic_bounds();
|
|
11853
|
+
init_rendering_profile();
|
|
11854
|
+
}
|
|
11855
|
+
});
|
|
11856
|
+
|
|
11857
|
+
// dist/projection/experimental/rendering-profile/rendering-bounds.js
|
|
11858
|
+
function multiply(a, b) {
|
|
11859
|
+
const values = [a[0] * b[0], a[0] * b[1], a[1] * b[0], a[1] * b[1]];
|
|
11860
|
+
return [Math.min(...values), Math.max(...values)];
|
|
11861
|
+
}
|
|
11862
|
+
function sine([low, high]) {
|
|
11863
|
+
const values = [Math.sin(low), Math.sin(high)];
|
|
11864
|
+
for (const [phase, value2] of [
|
|
11865
|
+
[Math.PI / 2, 1],
|
|
11866
|
+
[-Math.PI / 2, -1]
|
|
11867
|
+
]) {
|
|
11868
|
+
if (Math.ceil((low - phase) / (2 * Math.PI)) <= Math.floor((high - phase) / (2 * Math.PI)))
|
|
11869
|
+
values.push(value2);
|
|
11870
|
+
}
|
|
11871
|
+
return [Math.min(...values), Math.max(...values)];
|
|
11872
|
+
}
|
|
11873
|
+
function envelope(x, y) {
|
|
11874
|
+
const padding = (range) => Math.max(1, maxAbs(range)) * 1e-12;
|
|
11875
|
+
if (![...x, ...y].every(Number.isFinite))
|
|
11876
|
+
throw new Error("Projection rendering bounds are not finite");
|
|
11877
|
+
return [
|
|
11878
|
+
[x[0] - padding(x), y[0] - padding(y), 0],
|
|
11879
|
+
[x[1] + padding(x), y[1] + padding(y), 0]
|
|
11880
|
+
];
|
|
11881
|
+
}
|
|
11882
|
+
function longitudeRange(parameters, origin, over = false) {
|
|
11883
|
+
const low = parameters[0][0] - origin, high = parameters[1][0] - origin;
|
|
11884
|
+
if (over)
|
|
11885
|
+
return [low, high];
|
|
11886
|
+
const span = high - low;
|
|
11887
|
+
if (span >= 2 * Math.PI - 1e-12)
|
|
11888
|
+
return [-Math.PI, Math.PI];
|
|
11889
|
+
let west = wrapLongitude(low);
|
|
11890
|
+
if (span > 0 && Math.abs(west - Math.PI) < 1e-12)
|
|
11891
|
+
west = -Math.PI;
|
|
11892
|
+
const east = west + span;
|
|
11893
|
+
return east > Math.PI + 1e-12 ? [-Math.PI, Math.PI] : [west, Math.min(east, Math.PI)];
|
|
11894
|
+
}
|
|
11895
|
+
function cylindricalBounds(project, parameters, origin, over = false) {
|
|
11896
|
+
const longitude3 = longitudeRange(parameters, origin, over);
|
|
11897
|
+
const latitudes = [
|
|
11898
|
+
parameters[0][1],
|
|
11899
|
+
parameters[1][1],
|
|
11900
|
+
Math.max(parameters[0][1], Math.min(parameters[1][1], 0))
|
|
11901
|
+
];
|
|
11902
|
+
const points = longitude3.flatMap((x) => latitudes.map((y) => project(origin + x, y)));
|
|
11903
|
+
return envelope([Math.min(...points.map((p) => p[0])), Math.max(...points.map((p) => p[0]))], [Math.min(...points.map((p) => p[1])), Math.max(...points.map((p) => p[1]))]);
|
|
11904
|
+
}
|
|
11905
|
+
function transverseBounds(project, parameters, origin, over = false, equator = 0) {
|
|
11906
|
+
const longitude3 = longitudeRange(parameters, origin, over);
|
|
11907
|
+
if (maxAbs(longitude3) > Math.PI / 6 + 1e-12)
|
|
11908
|
+
throw new Error("Unsupported transverse rendering coverage");
|
|
11909
|
+
const longitudes = [
|
|
11910
|
+
longitude3[0],
|
|
11911
|
+
longitude3[1],
|
|
11912
|
+
Math.max(longitude3[0], Math.min(longitude3[1], 0))
|
|
11913
|
+
];
|
|
11914
|
+
const latitudes = [
|
|
11915
|
+
parameters[0][1],
|
|
11916
|
+
parameters[1][1],
|
|
11917
|
+
Math.max(parameters[0][1], Math.min(parameters[1][1], equator))
|
|
11918
|
+
];
|
|
11919
|
+
const points = longitudes.flatMap((x) => latitudes.map((y) => project(origin + x, y)));
|
|
11920
|
+
return envelope([Math.min(...points.map((p) => p[0])), Math.max(...points.map((p) => p[0]))], [Math.min(...points.map((p) => p[1])), Math.max(...points.map((p) => p[1]))]);
|
|
11921
|
+
}
|
|
11922
|
+
function vanDerGrintenBounds(project, parameters, origin, over = false) {
|
|
11923
|
+
const longitude3 = longitudeRange(parameters, origin, over);
|
|
11924
|
+
const longitudes = [
|
|
11925
|
+
longitude3[0],
|
|
11926
|
+
longitude3[1],
|
|
11927
|
+
Math.max(longitude3[0], Math.min(longitude3[1], 0))
|
|
11928
|
+
];
|
|
11929
|
+
const latitudes = [
|
|
11930
|
+
parameters[0][1],
|
|
11931
|
+
parameters[1][1],
|
|
11932
|
+
Math.max(parameters[0][1], Math.min(parameters[1][1], 0))
|
|
11933
|
+
];
|
|
11934
|
+
const points = longitudes.flatMap((x) => latitudes.map((y) => project(origin + x, y)));
|
|
11935
|
+
return envelope([Math.min(...points.map((p) => p[0])), Math.max(...points.map((p) => p[0]))], [Math.min(...points.map((p) => p[1])), Math.max(...points.map((p) => p[1]))]);
|
|
11936
|
+
}
|
|
11937
|
+
function conicBounds(project, parameters, origin, cone, x0, centerY, over = false) {
|
|
11938
|
+
const angles = scale2(longitudeRange(parameters, origin, over), cone);
|
|
11939
|
+
const radii = ordered(centerY - project(origin, parameters[0][1])[1], centerY - project(origin, parameters[1][1])[1]);
|
|
11940
|
+
return envelope(add2([x0, x0], multiply(radii, sine(angles))), add2([centerY, centerY], scale2(multiply(radii, cosine(angles)), -1)));
|
|
11941
|
+
}
|
|
11942
|
+
var ordered, add2, scale2, cosine, maxAbs;
|
|
11943
|
+
var init_rendering_bounds = __esm({
|
|
11944
|
+
"dist/projection/experimental/rendering-profile/rendering-bounds.js"() {
|
|
11945
|
+
init_parameters();
|
|
11946
|
+
ordered = (a, b) => [Math.min(a, b), Math.max(a, b)];
|
|
11947
|
+
add2 = (a, b) => [a[0] + b[0], a[1] + b[1]];
|
|
11948
|
+
scale2 = (a, value2) => ordered(a[0] * value2, a[1] * value2);
|
|
11949
|
+
cosine = (a) => sine([a[0] + Math.PI / 2, a[1] + Math.PI / 2]);
|
|
11950
|
+
maxAbs = (a) => Math.max(Math.abs(a[0]), Math.abs(a[1]));
|
|
14200
11951
|
}
|
|
14201
11952
|
});
|
|
14202
11953
|
|
|
@@ -14220,7 +11971,7 @@ var init_mercator = __esm({
|
|
|
14220
11971
|
"Mercator_Variant_A"
|
|
14221
11972
|
],
|
|
14222
11973
|
parameters: ["lon_0", "lat_ts", "k", "k_0", "x_0", "y_0"],
|
|
14223
|
-
create({ semiMajorAxis: a, eccentricitySquared: es, parameters, primeMeridian
|
|
11974
|
+
create({ semiMajorAxis: a, eccentricitySquared: es, parameters, primeMeridian = 0 }) {
|
|
14224
11975
|
const e = Math.sqrt(es);
|
|
14225
11976
|
const over = Object.prototype.hasOwnProperty.call(parameters, "over");
|
|
14226
11977
|
const longitudeOrigin = numberParameter(parameters, "lon_0", 0) * DEGREES_TO_RADIANS;
|
|
@@ -14249,7 +12000,7 @@ var init_mercator = __esm({
|
|
|
14249
12000
|
clipped ? Math.max(-maxLatitude * 180 / Math.PI, Math.min(maxLatitude * 180 / Math.PI, coverage[3])) : coverage[3]
|
|
14250
12001
|
];
|
|
14251
12002
|
const northing = (latitude) => y0 + radius2 * (Math.asinh(Math.tan(latitude)) - e * Math.atanh(e * Math.sin(latitude)));
|
|
14252
|
-
return createRectangleRenderingProfile((region) => envelope(add2([x0, x0], scale2(longitudeRange(region, longitudeOrigin, over), radius2)), [northing(region[0][1]), northing(region[1][1])]), bounds2, longitudeOrigin,
|
|
12003
|
+
return createRectangleRenderingProfile((region) => envelope(add2([x0, x0], scale2(longitudeRange(region, longitudeOrigin, over), radius2)), [northing(region[0][1]), northing(region[1][1])]), bounds2, longitudeOrigin, primeMeridian, over);
|
|
14253
12004
|
}
|
|
14254
12005
|
const defaultBounds = [
|
|
14255
12006
|
[x0 - width, y0 - height2, 0],
|
|
@@ -14257,7 +12008,7 @@ var init_mercator = __esm({
|
|
|
14257
12008
|
];
|
|
14258
12009
|
return {
|
|
14259
12010
|
bounds: defaultBounds,
|
|
14260
|
-
normalize: createRectangleRenderingProfile(() => defaultBounds, getGeographicBounds(createAngularRanges(longitudeOrigin - Math.PI, -maxLatitude, longitudeOrigin + Math.PI, maxLatitude),
|
|
12011
|
+
normalize: createRectangleRenderingProfile(() => defaultBounds, getGeographicBounds(createAngularRanges(longitudeOrigin - Math.PI, -maxLatitude, longitudeOrigin + Math.PI, maxLatitude), primeMeridian), longitudeOrigin, primeMeridian, over).normalize
|
|
14261
12012
|
};
|
|
14262
12013
|
},
|
|
14263
12014
|
...createFlatProjection((point) => {
|
|
@@ -14308,7 +12059,7 @@ var init_equidistant_cylindrical = __esm({
|
|
|
14308
12059
|
semantics: { id: "@math.gl/geospatial/eqc", version: 1 },
|
|
14309
12060
|
aliases: ["Equirectangular", "Equidistant_Cylindrical", "Equidistant_Cylindrical_Spherical"],
|
|
14310
12061
|
parameters: ["lon_0", "lat_0", "lat_ts", "x_0", "y_0"],
|
|
14311
|
-
create({ semiMajorAxis: a, parameters, primeMeridian
|
|
12062
|
+
create({ semiMajorAxis: a, parameters, primeMeridian = 0 }) {
|
|
14312
12063
|
const over = Object.prototype.hasOwnProperty.call(parameters, "over");
|
|
14313
12064
|
const longitudeOrigin = numberParameter(parameters, "lon_0", 0) * DEGREES_TO_RADIANS;
|
|
14314
12065
|
const latitudeOrigin = latitudeParameter(parameters, "lat_0");
|
|
@@ -14320,14 +12071,14 @@ var init_equidistant_cylindrical = __esm({
|
|
|
14320
12071
|
longitudeOrigin,
|
|
14321
12072
|
getRenderingProfile(coverage) {
|
|
14322
12073
|
if (coverage)
|
|
14323
|
-
return createRectangleRenderingProfile((region) => envelope(add2([x0, x0], scale2(longitudeRange(region, longitudeOrigin, over), a * parallelScale)), [y0 + a * (region[0][1] - latitudeOrigin), y0 + a * (region[1][1] - latitudeOrigin)]), coverage, longitudeOrigin,
|
|
12074
|
+
return createRectangleRenderingProfile((region) => envelope(add2([x0, x0], scale2(longitudeRange(region, longitudeOrigin, over), a * parallelScale)), [y0 + a * (region[0][1] - latitudeOrigin), y0 + a * (region[1][1] - latitudeOrigin)]), coverage, longitudeOrigin, primeMeridian, over);
|
|
14324
12075
|
const defaultBounds = [
|
|
14325
12076
|
[x0 - width, y0 + a * (-Math.PI / 2 - latitudeOrigin), 0],
|
|
14326
12077
|
[x0 + width, y0 + a * (Math.PI / 2 - latitudeOrigin), 0]
|
|
14327
12078
|
];
|
|
14328
12079
|
return {
|
|
14329
12080
|
bounds: defaultBounds,
|
|
14330
|
-
normalize: createRectangleRenderingProfile(() => defaultBounds, getGeographicBounds(createAngularRanges(longitudeOrigin - Math.PI, -(Math.PI / 2), longitudeOrigin + Math.PI, Math.PI / 2),
|
|
12081
|
+
normalize: createRectangleRenderingProfile(() => defaultBounds, getGeographicBounds(createAngularRanges(longitudeOrigin - Math.PI, -(Math.PI / 2), longitudeOrigin + Math.PI, Math.PI / 2), primeMeridian), longitudeOrigin, primeMeridian, over).normalize
|
|
14331
12082
|
};
|
|
14332
12083
|
},
|
|
14333
12084
|
...createProjection((point) => {
|
|
@@ -14357,12 +12108,12 @@ function flagParameter(parameters, name) {
|
|
|
14357
12108
|
throw new Error("Expected a flag without a value: +" + name);
|
|
14358
12109
|
return present;
|
|
14359
12110
|
}
|
|
14360
|
-
function kernelParameters({ semiMajorAxis: a, eccentricitySquared: es, parameters, primeMeridian
|
|
12111
|
+
function kernelParameters({ semiMajorAxis: a, eccentricitySquared: es, parameters, primeMeridian = 0 }) {
|
|
14361
12112
|
const k0 = numberParameter(parameters, "k_0", numberParameter(parameters, "k", 1));
|
|
14362
12113
|
if (k0 <= 0)
|
|
14363
12114
|
throw new Error("Projection scale must be positive");
|
|
14364
12115
|
return {
|
|
14365
|
-
primeMeridian
|
|
12116
|
+
primeMeridian,
|
|
14366
12117
|
a,
|
|
14367
12118
|
b: a * Math.sqrt(1 - es),
|
|
14368
12119
|
es,
|
|
@@ -16776,6 +14527,69 @@ var init_utm = __esm({
|
|
|
16776
14527
|
}
|
|
16777
14528
|
});
|
|
16778
14529
|
|
|
14530
|
+
// dist/projection/experimental/rendering-profile/geographic-rendering-profile.js
|
|
14531
|
+
function createGeographicProfile(parameters, primeMeridian = 0) {
|
|
14532
|
+
const center3 = numberParameter(parameters, "lon_wrap", 0) * DEGREES_TO_RADIANS;
|
|
14533
|
+
return (coverage) => createRectangleRenderingProfile((ranges) => {
|
|
14534
|
+
const longitude3 = longitudeRange(ranges, center3);
|
|
14535
|
+
return [
|
|
14536
|
+
[center3 + longitude3[0], ranges[0][1], 0],
|
|
14537
|
+
[center3 + longitude3[1], ranges[1][1], 0]
|
|
14538
|
+
];
|
|
14539
|
+
}, coverage ?? [-180, -90, 180, 90], center3, primeMeridian);
|
|
14540
|
+
}
|
|
14541
|
+
var init_geographic_rendering_profile = __esm({
|
|
14542
|
+
"dist/projection/experimental/rendering-profile/geographic-rendering-profile.js"() {
|
|
14543
|
+
init_parameters();
|
|
14544
|
+
init_rectangular_rendering_profile();
|
|
14545
|
+
init_rendering_bounds();
|
|
14546
|
+
}
|
|
14547
|
+
});
|
|
14548
|
+
|
|
14549
|
+
// dist/projection/experimental/datum.js
|
|
14550
|
+
function geodeticToGeocentricInPlace(point, ellipsoid) {
|
|
14551
|
+
if (Math.abs(point.y) > Math.PI / 2)
|
|
14552
|
+
throw new Error("Latitude outside geocentric domain");
|
|
14553
|
+
if (!(0, import_matrix3.spheroidToCartesian)(point, ellipsoid))
|
|
14554
|
+
throw new Error("Geocentric coordinate must be finite");
|
|
14555
|
+
}
|
|
14556
|
+
function geocentricToGeodeticInPlace(point, ellipsoid) {
|
|
14557
|
+
const x = point.x, y = point.y, z = point.z;
|
|
14558
|
+
const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = ellipsoid;
|
|
14559
|
+
if (x === 0 && y === 0 && z === 0)
|
|
14560
|
+
throw new Error("Geodetic coordinates are undefined at the Earth center");
|
|
14561
|
+
if (es !== 0 && Math.abs(x) < 1e-12 * a && Math.abs(y) < 1e-12 * a && Math.hypot(x, y) < 1e-12 * a) {
|
|
14562
|
+
if (!Number.isFinite(Math.hypot(x, y, z)))
|
|
14563
|
+
throw new Error("Geocentric radius must be finite");
|
|
14564
|
+
point.x = 0;
|
|
14565
|
+
point.y = Math.sign(z) * Math.PI / 2;
|
|
14566
|
+
point.z = Math.abs(z) - b;
|
|
14567
|
+
return;
|
|
14568
|
+
}
|
|
14569
|
+
if (!(0, import_matrix3.cartesianToSpheroid)(point, ellipsoid)) {
|
|
14570
|
+
if (!Number.isFinite(Math.hypot(x, y, z)))
|
|
14571
|
+
throw new Error("Geocentric radius must be finite");
|
|
14572
|
+
throw new Error("Geocentric inverse did not converge");
|
|
14573
|
+
}
|
|
14574
|
+
}
|
|
14575
|
+
function geodeticToGeocentric(coordinate, ellipsoid) {
|
|
14576
|
+
const point = { x: coordinate[0], y: coordinate[1], z: coordinate[2] };
|
|
14577
|
+
geodeticToGeocentricInPlace(point, ellipsoid);
|
|
14578
|
+
return [point.x, point.y, point.z];
|
|
14579
|
+
}
|
|
14580
|
+
function geocentricToGeodetic(coordinate, ellipsoid) {
|
|
14581
|
+
const point = { x: coordinate[0], y: coordinate[1], z: coordinate[2] };
|
|
14582
|
+
geocentricToGeodeticInPlace(point, ellipsoid);
|
|
14583
|
+
return [point.x, point.y, point.z];
|
|
14584
|
+
}
|
|
14585
|
+
var import_matrix3, ARC_SECOND;
|
|
14586
|
+
var init_datum = __esm({
|
|
14587
|
+
"dist/projection/experimental/datum.js"() {
|
|
14588
|
+
import_matrix3 = require("@math.gl/core/matrix");
|
|
14589
|
+
ARC_SECOND = Math.PI / (180 * 3600);
|
|
14590
|
+
}
|
|
14591
|
+
});
|
|
14592
|
+
|
|
16779
14593
|
// dist/projection/experimental/projections/geocentric.js
|
|
16780
14594
|
var geocentric;
|
|
16781
14595
|
var init_geocentric = __esm({
|
|
@@ -16786,7 +14600,7 @@ var init_geocentric = __esm({
|
|
|
16786
14600
|
name: "geocent",
|
|
16787
14601
|
aliases: ["Geocentric", "geocentric", "Geocent"],
|
|
16788
14602
|
parameters: [],
|
|
16789
|
-
create({ semiMajorAxis, semiMinorAxis, eccentricitySquared, primeMeridian
|
|
14603
|
+
create({ semiMajorAxis, semiMinorAxis, eccentricitySquared, primeMeridian = 0 }) {
|
|
16790
14604
|
const ellipsoid = {
|
|
16791
14605
|
semiMajorAxis,
|
|
16792
14606
|
eccentricitySquared,
|
|
@@ -16798,7 +14612,7 @@ var init_geocentric = __esm({
|
|
|
16798
14612
|
[-semiMajorAxis, -semiMajorAxis, -ellipsoid.semiMinorAxis],
|
|
16799
14613
|
[semiMajorAxis, semiMajorAxis, ellipsoid.semiMinorAxis]
|
|
16800
14614
|
],
|
|
16801
|
-
normalize: createGeographicProfile({},
|
|
14615
|
+
normalize: createGeographicProfile({}, primeMeridian)().normalize
|
|
16802
14616
|
}),
|
|
16803
14617
|
forward() {
|
|
16804
14618
|
throw new Error("Geocentric projection requires the 3D pipeline");
|
|
@@ -17635,7 +15449,7 @@ var init_eqearth2 = __esm({
|
|
|
17635
15449
|
parameters: ["lon_0", "x_0", "y_0"],
|
|
17636
15450
|
create(context) {
|
|
17637
15451
|
const base = catalogueParameters(context);
|
|
17638
|
-
const
|
|
15452
|
+
const primeMeridian = context.primeMeridian ?? 0;
|
|
17639
15453
|
const state = createState16(base);
|
|
17640
15454
|
const projection = bindCatalogueKernel("eqearth", context, state, forward16, inverse17);
|
|
17641
15455
|
const e = Math.sqrt(context.eccentricitySquared);
|
|
@@ -17650,14 +15464,14 @@ var init_eqearth2 = __esm({
|
|
|
17650
15464
|
longitudeOrigin: base.long0,
|
|
17651
15465
|
getRenderingProfile(coverage) {
|
|
17652
15466
|
if (coverage)
|
|
17653
|
-
return createRectangleRenderingProfile((region) => cylindricalBounds(projection.forward, region, base.long0, base.over), coverage, base.long0,
|
|
15467
|
+
return createRectangleRenderingProfile((region) => cylindricalBounds(projection.forward, region, base.long0, base.over), coverage, base.long0, primeMeridian, base.over);
|
|
17654
15468
|
const defaultBounds = [
|
|
17655
15469
|
[x0 - width, y0 - height2, 0],
|
|
17656
15470
|
[x0 + width, y0 + height2, 0]
|
|
17657
15471
|
];
|
|
17658
15472
|
return {
|
|
17659
15473
|
bounds: defaultBounds,
|
|
17660
|
-
normalize: createRectangleRenderingProfile(() => defaultBounds, getGeographicBounds(createAngularRanges(base.long0 - Math.PI, -(Math.PI / 2), base.long0 + Math.PI, Math.PI / 2),
|
|
15474
|
+
normalize: createRectangleRenderingProfile(() => defaultBounds, getGeographicBounds(createAngularRanges(base.long0 - Math.PI, -(Math.PI / 2), base.long0 + Math.PI, Math.PI / 2), primeMeridian), base.long0, primeMeridian, base.over).normalize
|
|
17661
15475
|
};
|
|
17662
15476
|
}
|
|
17663
15477
|
};
|
|
@@ -21030,7 +18844,7 @@ var init_qsc2 = __esm({
|
|
|
21030
18844
|
parameters: ["lon_0", "x_0", "y_0", "lat_0"],
|
|
21031
18845
|
create(context) {
|
|
21032
18846
|
const base = catalogueParameters(context);
|
|
21033
|
-
const
|
|
18847
|
+
const primeMeridian = context.primeMeridian ?? 0;
|
|
21034
18848
|
const state = createState28(base);
|
|
21035
18849
|
const implementation = bindCatalogueKernel("qsc", context, state, forward28, inverse29);
|
|
21036
18850
|
const x0 = numberParameter(context.parameters, "x_0", 0);
|
|
@@ -21047,18 +18861,18 @@ var init_qsc2 = __esm({
|
|
|
21047
18861
|
const cosine2 = sphericalRange(axis, local)[0];
|
|
21048
18862
|
const radius2 = base.a * Math.sqrt((1 - cosine2) / (0.5 * (1 - Math.SQRT1_2)));
|
|
21049
18863
|
return envelope([x0 - radius2, x0 + radius2], [y0 - radius2, y0 + radius2]);
|
|
21050
|
-
}, coverage, base.long0,
|
|
18864
|
+
}, coverage, base.long0, primeMeridian);
|
|
21051
18865
|
const defaultBounds = [
|
|
21052
18866
|
[x0 - base.a, y0 - base.a, 0],
|
|
21053
18867
|
[x0 + base.a, y0 + base.a, 0]
|
|
21054
18868
|
];
|
|
21055
|
-
const normalizeGeographic = createGeographicProfile(context.parameters,
|
|
18869
|
+
const normalizeGeographic = createGeographicProfile(context.parameters, primeMeridian)().normalize;
|
|
21056
18870
|
const normalizeFace = createAngularNormalization((point) => {
|
|
21057
18871
|
const [x, y] = implementation.forward(point.x, point.y);
|
|
21058
18872
|
if (Math.abs(x - x0) <= base.a && Math.abs(y - y0) <= base.a)
|
|
21059
18873
|
return;
|
|
21060
18874
|
[point.x, point.y] = implementation.inverse(x0 + Math.max(-base.a, Math.min(base.a, x - x0)), y0 + Math.max(-base.a, Math.min(base.a, y - y0)));
|
|
21061
|
-
},
|
|
18875
|
+
}, primeMeridian);
|
|
21062
18876
|
return {
|
|
21063
18877
|
bounds: defaultBounds,
|
|
21064
18878
|
normalize(point) {
|
|
@@ -21719,12 +19533,12 @@ function obliqueTransformation(wrapped) {
|
|
|
21719
19533
|
parameters: [...rotationParameters, "lon_0", ...geographic2 ? [] : wrapped.parameters],
|
|
21720
19534
|
flags: geographic2 ? [] : wrapped.flags,
|
|
21721
19535
|
create(context) {
|
|
21722
|
-
var
|
|
19536
|
+
var _a2;
|
|
21723
19537
|
const { parameters } = context;
|
|
21724
19538
|
const requested = parameters["o_proj"];
|
|
21725
19539
|
const accepted = geographic2 ? ["longlat", "latlong", "lonlat", "latlon", "identity"] : [wrapped.name, ...wrapped.aliases || []];
|
|
21726
19540
|
if (requested && !accepted.map(normalizedName).includes(normalizedName(requested)))
|
|
21727
|
-
throw new TypeScriptCRSError("missing-plugin", "Oblique transformation dependency does not match +o_proj=" + requested);
|
|
19541
|
+
throw new import_types4.TypeScriptCRSError("missing-plugin", "Oblique transformation dependency does not match +o_proj=" + requested);
|
|
21728
19542
|
const { lamp, phip } = rotation(parameters);
|
|
21729
19543
|
const cphip = Math.cos(phip), sphip = Math.sin(phip), oblique = Math.abs(phip) > 1e-10;
|
|
21730
19544
|
const longitudeOrigin = radians3(parameters, "lon_0");
|
|
@@ -21773,18 +19587,18 @@ function obliqueTransformation(wrapped) {
|
|
|
21773
19587
|
inverse34(point);
|
|
21774
19588
|
unrotate(point);
|
|
21775
19589
|
});
|
|
21776
|
-
const getChildProfile = geographic2 ? createGeographicProfile(innerParameters) : (
|
|
19590
|
+
const getChildProfile = geographic2 ? createGeographicProfile(innerParameters) : (_a2 = inner.getRenderingProfile) == null ? void 0 : _a2.bind(inner);
|
|
21777
19591
|
if (!getChildProfile)
|
|
21778
19592
|
return implementation;
|
|
21779
19593
|
const wrapProfile = (child2, coverage) => {
|
|
21780
19594
|
const source = coverage && createRectangleRenderingProfile(() => child2.bounds, coverage, longitudeOrigin, context.primeMeridian ?? 0, over);
|
|
21781
19595
|
const normalizeRotated = createAngularNormalization((point) => {
|
|
21782
|
-
var
|
|
19596
|
+
var _a3;
|
|
21783
19597
|
const longitude3 = point.x, latitude = point.y;
|
|
21784
19598
|
rotate(point);
|
|
21785
19599
|
const x = point.x * 180 / Math.PI, y = point.y * 180 / Math.PI;
|
|
21786
19600
|
const rotated = { x, y, z: point.z };
|
|
21787
|
-
(
|
|
19601
|
+
(_a3 = child2.normalize) == null ? void 0 : _a3.call(child2, rotated);
|
|
21788
19602
|
if (rotated.x === x && rotated.y === y) {
|
|
21789
19603
|
point.x = longitude3;
|
|
21790
19604
|
point.y = latitude;
|
|
@@ -21830,14 +19644,14 @@ function obliqueTransformation(wrapped) {
|
|
|
21830
19644
|
}
|
|
21831
19645
|
};
|
|
21832
19646
|
}
|
|
21833
|
-
var rotationParameters, normalizedName, has, radians3;
|
|
19647
|
+
var import_types4, rotationParameters, normalizedName, has, radians3;
|
|
21834
19648
|
var init_ob_tran = __esm({
|
|
21835
19649
|
"dist/projection/experimental/projections/ob-tran.js"() {
|
|
21836
19650
|
init_mutable_projection();
|
|
21837
19651
|
init_geographic_rendering_profile();
|
|
21838
19652
|
init_parameters();
|
|
21839
19653
|
init_rendering_profile();
|
|
21840
|
-
|
|
19654
|
+
import_types4 = require("./../projection/experimental/crs/types.shared.cjs");
|
|
21841
19655
|
init_rectangular_rendering_profile();
|
|
21842
19656
|
init_geographic_bounds();
|
|
21843
19657
|
init_spherical_rendering_domain();
|
|
@@ -21875,8 +19689,8 @@ function parseWKTCRS(text, options) {
|
|
|
21875
19689
|
return ast;
|
|
21876
19690
|
}
|
|
21877
19691
|
function validateWKTCRS(ast, options) {
|
|
21878
|
-
var
|
|
21879
|
-
if (!ast || ast.type !== "wkt-crs" || ((
|
|
19692
|
+
var _a2;
|
|
19693
|
+
if (!ast || ast.type !== "wkt-crs" || ((_a2 = ast.root) == null ? void 0 : _a2.type) !== "node") {
|
|
21880
19694
|
throw new TypeError("validateWKTCRS expects a WKTCRSAst");
|
|
21881
19695
|
}
|
|
21882
19696
|
const profile = resolveProfile(ast.root.keyword, (options == null ? void 0 : options.profile) || "auto");
|
|
@@ -22035,7 +19849,7 @@ function visitNode(node, path2, visitor) {
|
|
|
22035
19849
|
}
|
|
22036
19850
|
}
|
|
22037
19851
|
}
|
|
22038
|
-
function
|
|
19852
|
+
function getSourceLocation(source, offset) {
|
|
22039
19853
|
let line = 1;
|
|
22040
19854
|
let column = 1;
|
|
22041
19855
|
for (let index = 0; index < offset && index < source.length; index++) {
|
|
@@ -22054,7 +19868,7 @@ var init_wkt_crs = __esm({
|
|
|
22054
19868
|
WKTCRSSyntaxError = class extends SyntaxError {
|
|
22055
19869
|
/** Create a WKT syntax error at a source location. */
|
|
22056
19870
|
constructor(message, source, offset) {
|
|
22057
|
-
const location =
|
|
19871
|
+
const location = getSourceLocation(source, offset);
|
|
22058
19872
|
super(`${message} at ${location.line}:${location.column}`);
|
|
22059
19873
|
this.name = "WKTCRSSyntaxError";
|
|
22060
19874
|
this.offset = offset;
|
|
@@ -22065,8 +19879,8 @@ var init_wkt_crs = __esm({
|
|
|
22065
19879
|
WKTCRSValidationError = class extends Error {
|
|
22066
19880
|
/** Create an error from one or more validation issues. */
|
|
22067
19881
|
constructor(issues) {
|
|
22068
|
-
var
|
|
22069
|
-
super(((
|
|
19882
|
+
var _a2;
|
|
19883
|
+
super(((_a2 = issues[0]) == null ? void 0 : _a2.message) || "WKT validation failed");
|
|
22070
19884
|
this.name = "WKTCRSValidationError";
|
|
22071
19885
|
this.issues = issues;
|
|
22072
19886
|
}
|
|
@@ -22378,7 +20192,7 @@ function array(value2) {
|
|
|
22378
20192
|
function key2(value2) {
|
|
22379
20193
|
return String(value2 || "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
22380
20194
|
}
|
|
22381
|
-
function
|
|
20195
|
+
function finite(value2) {
|
|
22382
20196
|
if (typeof value2 !== "number" || !Number.isFinite(value2))
|
|
22383
20197
|
throw new Error("Expected a finite CRS parameter");
|
|
22384
20198
|
return value2;
|
|
@@ -22387,7 +20201,7 @@ function unit2(value2, fallback) {
|
|
|
22387
20201
|
if (value2 === void 0)
|
|
22388
20202
|
return fallback;
|
|
22389
20203
|
if (typeof value2 === "object") {
|
|
22390
|
-
const factor2 =
|
|
20204
|
+
const factor2 = finite(object(value2)["conversion_factor"]);
|
|
22391
20205
|
if (factor2 <= 0)
|
|
22392
20206
|
throw new Error("Unit conversion factor must be positive");
|
|
22393
20207
|
return factor2;
|
|
@@ -22408,16 +20222,16 @@ function unit2(value2, fallback) {
|
|
|
22408
20222
|
};
|
|
22409
20223
|
const factor = factors2[key2(value2)];
|
|
22410
20224
|
if (!factor)
|
|
22411
|
-
unsupportedStage("Unsupported CRS unit: " + String(value2));
|
|
20225
|
+
(0, import_types5.unsupportedStage)("Unsupported CRS unit: " + String(value2));
|
|
22412
20226
|
return factor;
|
|
22413
20227
|
}
|
|
22414
20228
|
function readStructuredCRS(crs, options) {
|
|
22415
|
-
var
|
|
20229
|
+
var _a2, _b2, _c;
|
|
22416
20230
|
const type = String(crs["type"]);
|
|
22417
20231
|
const areaOfUse = readAreaOfUse(crs["bbox"]);
|
|
22418
20232
|
if (type === "CompoundCRS") {
|
|
22419
20233
|
if (options.mode !== "horizontal")
|
|
22420
|
-
unsupportedStage("CompoundCRS requires explicit horizontal extraction");
|
|
20234
|
+
(0, import_types5.unsupportedStage)("CompoundCRS requires explicit horizontal extraction");
|
|
22421
20235
|
const components = array(crs["components"]).map(object).filter((value2) => ["ProjectedCRS", "GeographicCRS", "GeodeticCRS", "BoundCRS"].includes(String(value2["type"])));
|
|
22422
20236
|
if (components.length !== 1)
|
|
22423
20237
|
throw new Error("CompoundCRS requires exactly one horizontal component");
|
|
@@ -22428,14 +20242,14 @@ function readStructuredCRS(crs, options) {
|
|
|
22428
20242
|
const source = readStructuredCRS(object(crs["source_crs"]), options);
|
|
22429
20243
|
const target = readStructuredCRS(object(crs["target_crs"]), options);
|
|
22430
20244
|
if (target.parameters["datum"] !== "WGS84" || !["longlat", "geocent"].includes(target.parameters["proj"]) || Number(target.parameters["pm"] || 0) !== 0 || target.parameters["towgs84"] || Number(target.parameters["a"]) !== 6378137 || !(Math.abs(Number(target.parameters["rf"]) - 298.257223563) <= 1e-9 || Math.abs(Number(target.parameters["b"]) - 6356752314245179e-9) <= 1e-6))
|
|
22431
|
-
unsupportedStage("BoundCRS requires a WGS84 target");
|
|
20245
|
+
(0, import_types5.unsupportedStage)("BoundCRS requires a WGS84 target");
|
|
22432
20246
|
const operation2 = object(crs["transformation"]);
|
|
22433
20247
|
const method = key2(object(operation2["method"])["name"]);
|
|
22434
20248
|
const translation = method === "geocentrictranslations" || /^geocentrictranslationsgeog[23]ddomain$/.test(method);
|
|
22435
20249
|
const position2 = /^positionvector(?:transformation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(method);
|
|
22436
20250
|
const frame = /^coordinateframe(?:rotation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(method);
|
|
22437
20251
|
if (!translation && !position2 && !frame)
|
|
22438
|
-
unsupportedStage("Unsupported BoundCRS transformation: " + method);
|
|
20252
|
+
(0, import_types5.unsupportedStage)("Unsupported BoundCRS transformation: " + method);
|
|
22439
20253
|
const names2 = [
|
|
22440
20254
|
"xaxistranslation",
|
|
22441
20255
|
"yaxistranslation",
|
|
@@ -22449,9 +20263,9 @@ function readStructuredCRS(crs, options) {
|
|
|
22449
20263
|
for (const entry of array(operation2["parameters"])) {
|
|
22450
20264
|
const parameter = object(entry), index = names2.indexOf(key2(parameter["name"]));
|
|
22451
20265
|
if (index < 0 || index >= values.length || values[index] !== void 0)
|
|
22452
|
-
unsupportedStage("Unsupported or duplicate Helmert parameter: " + String(parameter["name"]));
|
|
20266
|
+
(0, import_types5.unsupportedStage)("Unsupported or duplicate Helmert parameter: " + String(parameter["name"]));
|
|
22453
20267
|
const base2 = index < 3 ? 1 : index < 6 ? DEGREES_TO_RADIANS / 3600 : 1e-6;
|
|
22454
|
-
values[index] =
|
|
20268
|
+
values[index] = finite(parameter["value"]) * unit2(parameter["unit"], base2) / base2 * (frame && index >= 3 && index < 6 ? -1 : 1);
|
|
22455
20269
|
}
|
|
22456
20270
|
if (values.some((value2) => value2 === void 0))
|
|
22457
20271
|
throw new Error("Incomplete BoundCRS Helmert transformation");
|
|
@@ -22463,21 +20277,21 @@ function readStructuredCRS(crs, options) {
|
|
|
22463
20277
|
return { ...source, parameters: parameters2, areaOfUse: areaOfUse ?? source.areaOfUse };
|
|
22464
20278
|
}
|
|
22465
20279
|
if (!["ProjectedCRS", "GeographicCRS", "GeodeticCRS"].includes(type))
|
|
22466
|
-
unsupportedStage("Unsupported CRS type: " + type);
|
|
20280
|
+
(0, import_types5.unsupportedStage)("Unsupported CRS type: " + type);
|
|
22467
20281
|
const base = type === "ProjectedCRS" ? object(crs["base_crs"]) : crs;
|
|
22468
20282
|
const datum = object(base["datum"] || base["datum_ensemble"]);
|
|
22469
20283
|
if (datum["type"] === "DynamicGeodeticReferenceFrame" || datum["frame_reference_epoch"] !== void 0 || crs["coordinate_epoch"] !== void 0)
|
|
22470
|
-
unsupportedStage("Time-dependent datum transformations are not implemented");
|
|
20284
|
+
(0, import_types5.unsupportedStage)("Time-dependent datum transformations are not implemented");
|
|
22471
20285
|
const ellipsoid = object(datum["ellipsoid"]);
|
|
22472
|
-
const major =
|
|
20286
|
+
const major = finite(ellipsoid["semi_major_axis"] ?? ellipsoid["radius"]);
|
|
22473
20287
|
const parameters = {
|
|
22474
20288
|
proj: "longlat",
|
|
22475
20289
|
a: String(major * unit2(ellipsoid["unit"], 1))
|
|
22476
20290
|
};
|
|
22477
20291
|
if (ellipsoid["inverse_flattening"] !== void 0)
|
|
22478
|
-
parameters["rf"] = String(
|
|
20292
|
+
parameters["rf"] = String(finite(ellipsoid["inverse_flattening"]));
|
|
22479
20293
|
else if (ellipsoid["semi_minor_axis"] !== void 0)
|
|
22480
|
-
parameters["b"] = String(
|
|
20294
|
+
parameters["b"] = String(finite(ellipsoid["semi_minor_axis"]) * unit2(ellipsoid["unit"], 1));
|
|
22481
20295
|
else if (ellipsoid["radius"] !== void 0)
|
|
22482
20296
|
parameters["b"] = parameters["a"];
|
|
22483
20297
|
else
|
|
@@ -22529,26 +20343,26 @@ function readStructuredCRS(crs, options) {
|
|
|
22529
20343
|
parameters["datum"] = authorityDatum;
|
|
22530
20344
|
}
|
|
22531
20345
|
if (datum["towgs84"] !== void 0) {
|
|
22532
|
-
parameters["towgs84"] = array(datum["towgs84"]).map(
|
|
20346
|
+
parameters["towgs84"] = array(datum["towgs84"]).map(finite).join(",");
|
|
22533
20347
|
delete parameters["datum"];
|
|
22534
20348
|
}
|
|
22535
20349
|
const cs = crs["coordinate_system"] ? object(crs["coordinate_system"]) : {};
|
|
22536
20350
|
const axes = array(cs["axis"]).map(object);
|
|
22537
20351
|
const geocentric2 = key2(cs["subtype"]) === "cartesian" && type === "GeodeticCRS";
|
|
22538
20352
|
if (type !== "ProjectedCRS" && !geocentric2 && cs["subtype"] && key2(cs["subtype"]) !== "ellipsoidal")
|
|
22539
|
-
unsupportedStage("Unsupported coordinate system subtype");
|
|
20353
|
+
(0, import_types5.unsupportedStage)("Unsupported coordinate system subtype");
|
|
22540
20354
|
if (geocentric2)
|
|
22541
20355
|
parameters["proj"] = "geocent";
|
|
22542
20356
|
const angularUnit = unit2(base["angular_unit"], DEGREES_TO_RADIANS);
|
|
22543
|
-
const factor = unit2((
|
|
20357
|
+
const factor = unit2((_a2 = axes[0]) == null ? void 0 : _a2["unit"], type === "ProjectedCRS" || geocentric2 ? 1 : angularUnit);
|
|
22544
20358
|
if (axes[1] && unit2(axes[1]["unit"], factor) !== factor)
|
|
22545
|
-
unsupportedStage("Mixed horizontal axis units are not supported");
|
|
20359
|
+
(0, import_types5.unsupportedStage)("Mixed horizontal axis units are not supported");
|
|
22546
20360
|
if (geocentric2 && axes[2] && unit2(axes[2]["unit"], factor) !== factor)
|
|
22547
|
-
unsupportedStage("Mixed geocentric axis units are not supported");
|
|
20361
|
+
(0, import_types5.unsupportedStage)("Mixed geocentric axis units are not supported");
|
|
22548
20362
|
const pm = base["prime_meridian"] || datum["prime_meridian"];
|
|
22549
20363
|
if (pm) {
|
|
22550
20364
|
const meridian = object(pm);
|
|
22551
|
-
parameters["pm"] = String(
|
|
20365
|
+
parameters["pm"] = String(finite(meridian["longitude"]) * unit2(meridian["unit"], angularUnit) / DEGREES_TO_RADIANS);
|
|
22552
20366
|
}
|
|
22553
20367
|
if (type === "ProjectedCRS") {
|
|
22554
20368
|
const conversion = object(crs["conversion"]), method = key2(object(conversion["method"])["name"]);
|
|
@@ -22565,12 +20379,12 @@ function readStructuredCRS(crs, options) {
|
|
|
22565
20379
|
if (projection !== "krovak" || esriKrovak.length !== 3 || new Set(esriKrovak.map((parameter) => key2(parameter["name"]))).size !== 3 || esriKrovak.some((parameter) => {
|
|
22566
20380
|
const name = key2(parameter["name"]);
|
|
22567
20381
|
const factor2 = name === "xyplanerotation" ? unit2(parameter["unit"], angularUnit) / DEGREES_TO_RADIANS : unit2(parameter["unit"], 1);
|
|
22568
|
-
return Math.abs(
|
|
20382
|
+
return Math.abs(finite(parameter["value"]) * factor2 - expected[name]) > 1e-10;
|
|
22569
20383
|
}))
|
|
22570
|
-
unsupportedStage("Unsupported ESRI Krovak axis adjustment");
|
|
20384
|
+
(0, import_types5.unsupportedStage)("Unsupported ESRI Krovak axis adjustment");
|
|
22571
20385
|
}
|
|
22572
20386
|
if (!projection || projection.startsWith("unsupported"))
|
|
22573
|
-
unsupportedStage("Unsupported projection method: " + String(object(conversion["method"])["name"]));
|
|
20387
|
+
(0, import_types5.unsupportedStage)("Unsupported projection method: " + String(object(conversion["method"])["name"]));
|
|
22574
20388
|
parameters["proj"] = projection === "webmerc" ? "merc" : projection;
|
|
22575
20389
|
let hasSemiMinor = false;
|
|
22576
20390
|
for (const parameter of conversionParameters) {
|
|
@@ -22583,14 +20397,14 @@ function readStructuredCRS(crs, options) {
|
|
|
22583
20397
|
if (hasSemiMinor)
|
|
22584
20398
|
throw new Error("Duplicate conversion parameter: semi_minor");
|
|
22585
20399
|
hasSemiMinor = true;
|
|
22586
|
-
const radius2 =
|
|
20400
|
+
const radius2 = finite(parameter["value"]) * unit2(parameter["unit"], 1);
|
|
22587
20401
|
if (Math.abs(radius2 - Number(parameters["a"])) > 4 * Number.EPSILON * Number(parameters["a"]))
|
|
22588
|
-
unsupportedStage("Pseudo-Mercator semi_minor must equal the semi-major axis");
|
|
20402
|
+
(0, import_types5.unsupportedStage)("Pseudo-Mercator semi_minor must equal the semi-major axis");
|
|
22589
20403
|
continue;
|
|
22590
20404
|
}
|
|
22591
20405
|
let name = ((_b2 = METHOD_PARAMETERS[projection]) == null ? void 0 : _b2[parameterName]) || PARAMETERS[parameterName];
|
|
22592
20406
|
if (!name)
|
|
22593
|
-
unsupportedStage("Unsupported conversion parameter: " + String(parameter["name"]));
|
|
20407
|
+
(0, import_types5.unsupportedStage)("Unsupported conversion parameter: " + String(parameter["name"]));
|
|
22594
20408
|
if (name === "lat_1" && method === "stereographicnorthpole" && !polarTrueScale)
|
|
22595
20409
|
name = "lat_0";
|
|
22596
20410
|
else if (name === "lat_1" && ["merc", "webmerc", "eqc", "stere", "cea"].includes(projection))
|
|
@@ -22601,7 +20415,7 @@ function readStructuredCRS(crs, options) {
|
|
|
22601
20415
|
continue;
|
|
22602
20416
|
const angle4 = name.startsWith("lat") || name.startsWith("lon") || name === "alpha" || name === "gamma";
|
|
22603
20417
|
const length = name === "x_0" || name === "y_0";
|
|
22604
|
-
let converted =
|
|
20418
|
+
let converted = finite(parameter["value"]) * unit2(parameter["unit"], angle4 ? angularUnit : length ? factor : 1) / (angle4 ? DEGREES_TO_RADIANS : 1);
|
|
22605
20419
|
if (name.startsWith("lat") && Math.abs(Math.abs(converted) - 90) <= 4 * Number.EPSILON * 90)
|
|
22606
20420
|
converted = Math.sign(converted) * 90;
|
|
22607
20421
|
parameters[name] = String(converted);
|
|
@@ -22614,7 +20428,7 @@ function readStructuredCRS(crs, options) {
|
|
|
22614
20428
|
parameters["no_uoff"] = void 0;
|
|
22615
20429
|
if (projection === "omerc" && parameters["lon_0"] !== void 0 && parameters["lonc"] !== void 0) {
|
|
22616
20430
|
if (Math.abs(Number(parameters["lon_0"]) - Number(parameters["lonc"])) > 1e-10)
|
|
22617
|
-
unsupportedStage("Oblique Mercator central meridian conflicts with projection centre");
|
|
20431
|
+
(0, import_types5.unsupportedStage)("Oblique Mercator central meridian conflicts with projection centre");
|
|
22618
20432
|
delete parameters["lon_0"];
|
|
22619
20433
|
}
|
|
22620
20434
|
if (method === "stereographicnorthpole" && Math.abs(Number(parameters["lat_0"])) === 90)
|
|
@@ -22639,7 +20453,7 @@ function readStructuredCRS(crs, options) {
|
|
|
22639
20453
|
if (axis.length === 2)
|
|
22640
20454
|
axis += "u";
|
|
22641
20455
|
if (!geocentric2 && /[ud]/.test(axis.slice(0, 2)))
|
|
22642
|
-
unsupportedStage("Structured CRS vertical-first axes require an explicit PROJ axis definition");
|
|
20456
|
+
(0, import_types5.unsupportedStage)("Structured CRS vertical-first axes require an explicit PROJ axis definition");
|
|
22643
20457
|
if (axis)
|
|
22644
20458
|
parameters["axis"] = axis;
|
|
22645
20459
|
if (type === "ProjectedCRS" || geocentric2)
|
|
@@ -22655,8 +20469,8 @@ function readAreaOfUse(bbox) {
|
|
|
22655
20469
|
let areaOfUse;
|
|
22656
20470
|
if (bbox !== void 0) {
|
|
22657
20471
|
const extent = object(bbox);
|
|
22658
|
-
const west =
|
|
22659
|
-
const east =
|
|
20472
|
+
const west = finite(extent["west_longitude"]), south = finite(extent["south_latitude"]);
|
|
20473
|
+
const east = finite(extent["east_longitude"]), north = finite(extent["north_latitude"]);
|
|
22660
20474
|
if (west < -180 || west > 180 || east < -180 || east > 180 || south < -90 || north > 90 || south >= north || west === east)
|
|
22661
20475
|
throw new Error("Invalid CRS geographic bounding box");
|
|
22662
20476
|
areaOfUse = [west, south, east, north];
|
|
@@ -22664,7 +20478,7 @@ function readAreaOfUse(bbox) {
|
|
|
22664
20478
|
return areaOfUse;
|
|
22665
20479
|
}
|
|
22666
20480
|
function readAxisDirection(entry, parameters, projected) {
|
|
22667
|
-
var
|
|
20481
|
+
var _a2;
|
|
22668
20482
|
let direction = String(entry["direction"]);
|
|
22669
20483
|
let meridian = entry["meridian"];
|
|
22670
20484
|
const along = /^(north|south) along ([+-]?(?:\d+(?:\.\d*)?|\.\d+)) deg(?: (east|west))?$/i.exec(direction);
|
|
@@ -22673,33 +20487,33 @@ function readAxisDirection(entry, parameters, projected) {
|
|
|
22673
20487
|
throw new Error("Duplicate axis meridian");
|
|
22674
20488
|
direction = along[1];
|
|
22675
20489
|
meridian = {
|
|
22676
|
-
longitude: Number(along[2]) * (((
|
|
20490
|
+
longitude: Number(along[2]) * (((_a2 = along[3]) == null ? void 0 : _a2.toLowerCase()) === "west" ? -1 : 1)
|
|
22677
20491
|
};
|
|
22678
20492
|
}
|
|
22679
20493
|
if (meridian !== void 0) {
|
|
22680
20494
|
const latitude = Number(parameters["lat_0"]);
|
|
22681
20495
|
const north = latitude === 90;
|
|
22682
20496
|
if (!projected || parameters["proj"] !== "stere" || Math.abs(latitude) !== 90 || key2(direction) !== (north ? "south" : "north"))
|
|
22683
|
-
unsupportedStage("Axis meridians require an outward-facing polar stereographic axis");
|
|
20497
|
+
(0, import_types5.unsupportedStage)("Axis meridians require an outward-facing polar stereographic axis");
|
|
22684
20498
|
const longitude3 = object(meridian)["longitude"];
|
|
22685
|
-
const degrees4 = typeof longitude3 === "number" ?
|
|
22686
|
-
const quarterTurns =
|
|
20499
|
+
const degrees4 = typeof longitude3 === "number" ? finite(longitude3) : finite(object(longitude3)["value"]) * unit2(object(longitude3)["unit"], DEGREES_TO_RADIANS) / DEGREES_TO_RADIANS;
|
|
20500
|
+
const quarterTurns = finite((degrees4 - Number(parameters["lon_0"] || 0)) / 90);
|
|
22687
20501
|
if (Math.abs(quarterTurns - Math.round(quarterTurns)) > 1e-12)
|
|
22688
|
-
unsupportedStage("Non-cardinal axis meridians require an orientation operation");
|
|
20502
|
+
(0, import_types5.unsupportedStage)("Non-cardinal axis meridians require an orientation operation");
|
|
22689
20503
|
const quadrant = (Math.round(quarterTurns) % 4 + 4) % 4;
|
|
22690
20504
|
return (north ? "senw" : "nesw")[quadrant];
|
|
22691
20505
|
}
|
|
22692
20506
|
const result = DIRECTIONS[key2(direction)];
|
|
22693
20507
|
if (!result)
|
|
22694
|
-
unsupportedStage("Unsupported axis direction: " + direction);
|
|
20508
|
+
(0, import_types5.unsupportedStage)("Unsupported axis direction: " + direction);
|
|
22695
20509
|
return result;
|
|
22696
20510
|
}
|
|
22697
|
-
var METHODS, PARAMETERS, METHOD_PARAMETERS, DIRECTIONS;
|
|
20511
|
+
var import_types5, METHODS, PARAMETERS, METHOD_PARAMETERS, DIRECTIONS;
|
|
22698
20512
|
var init_structured = __esm({
|
|
22699
20513
|
"dist/projection/experimental/crs/structured.js"() {
|
|
22700
20514
|
init_datum_catalog();
|
|
22701
20515
|
init_parameters();
|
|
22702
|
-
|
|
20516
|
+
import_types5 = require("./../projection/experimental/crs/types.shared.cjs");
|
|
22703
20517
|
METHODS = {
|
|
22704
20518
|
hotineobliquemercator: "omerc",
|
|
22705
20519
|
hotineobliquemercatorvarianta: "omerc",
|
|
@@ -22859,7 +20673,7 @@ function operation(node) {
|
|
|
22859
20673
|
if (!method)
|
|
22860
20674
|
throw new Error("WKT conversion requires a METHOD or PROJECTION");
|
|
22861
20675
|
if (child(node, "PARAMETERFILE"))
|
|
22862
|
-
unsupportedStage("Grid-based WKT operation is not implemented");
|
|
20676
|
+
(0, import_types6.unsupportedStage)("Grid-based WKT operation is not implemented");
|
|
22863
20677
|
return {
|
|
22864
20678
|
method: { name: value(method) },
|
|
22865
20679
|
parameters: children(node, "PARAMETER").map((parameter) => ({
|
|
@@ -22914,9 +20728,9 @@ function readWKT(node) {
|
|
|
22914
20728
|
"GEOCCS"
|
|
22915
20729
|
].includes(keyword);
|
|
22916
20730
|
if (!projected && !geographic2)
|
|
22917
|
-
unsupportedStage("Unsupported WKT CRS: " + keyword);
|
|
20731
|
+
(0, import_types6.unsupportedStage)("Unsupported WKT CRS: " + keyword);
|
|
22918
20732
|
if (child(node, "DYNAMIC", "DERIVINGCONVERSION", "VELOCITYGRID", "EXTENSION"))
|
|
22919
|
-
unsupportedStage("Unsupported WKT dynamic/extension operation");
|
|
20733
|
+
(0, import_types6.unsupportedStage)("Unsupported WKT dynamic/extension operation");
|
|
22920
20734
|
const cs = child(node, "CS");
|
|
22921
20735
|
const geocentric2 = keyword === "GEOCCS" || String(value(cs || node)).toLowerCase() === "cartesian" && !projected;
|
|
22922
20736
|
const localUnit = child(node, projected || geocentric2 ? "LENGTHUNIT" : "ANGLEUNIT", "UNIT");
|
|
@@ -22958,7 +20772,7 @@ function readWKT(node) {
|
|
|
22958
20772
|
if (!datum)
|
|
22959
20773
|
throw new Error("WKT requires a geodetic datum");
|
|
22960
20774
|
if (child(datum, "EXTENSION", "DYNAMIC"))
|
|
22961
|
-
unsupportedStage("Unsupported datum extension");
|
|
20775
|
+
(0, import_types6.unsupportedStage)("Unsupported datum extension");
|
|
22962
20776
|
const ellipsoid = child(datum, "SPHEROID", "ELLIPSOID");
|
|
22963
20777
|
if (!ellipsoid)
|
|
22964
20778
|
throw new Error("WKT datum requires an ellipsoid");
|
|
@@ -22984,12 +20798,12 @@ function readWKT(node) {
|
|
|
22984
20798
|
}
|
|
22985
20799
|
return result;
|
|
22986
20800
|
}
|
|
22987
|
-
var wktCRSParser;
|
|
20801
|
+
var import_types6, wktCRSParser;
|
|
22988
20802
|
var init_wkt = __esm({
|
|
22989
20803
|
"dist/projection/experimental/crs/wkt.js"() {
|
|
22990
20804
|
init_spatial_reference();
|
|
22991
20805
|
init_wkt_crs();
|
|
22992
|
-
|
|
20806
|
+
import_types6 = require("./../projection/experimental/crs/types.shared.cjs");
|
|
22993
20807
|
init_structured();
|
|
22994
20808
|
wktCRSParser = {
|
|
22995
20809
|
name: "wkt",
|
|
@@ -23018,9 +20832,10 @@ var init_projjson = __esm({
|
|
|
23018
20832
|
});
|
|
23019
20833
|
|
|
23020
20834
|
// dist/projection/experimental/projection-pipeline.js
|
|
23021
|
-
var EMPTY_STACK, ordinaryByteLength, factors;
|
|
20835
|
+
var import_types7, EMPTY_STACK, ordinaryByteLength, factors;
|
|
23022
20836
|
var init_projection_pipeline = __esm({
|
|
23023
20837
|
"dist/projection/experimental/projection-pipeline.js"() {
|
|
20838
|
+
import_types7 = require("./../projection/experimental/crs/types.shared.cjs");
|
|
23024
20839
|
EMPTY_STACK = new Float64Array(0);
|
|
23025
20840
|
ordinaryByteLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
23026
20841
|
factors = {
|
|
@@ -23165,16 +20980,16 @@ function defaultProjections() {
|
|
|
23165
20980
|
preset = [...projections, oblique];
|
|
23166
20981
|
return preset;
|
|
23167
20982
|
}
|
|
23168
|
-
var compatibilityParsers, preset, FullProjectionEngine, projectionEngine;
|
|
20983
|
+
var import_projection_engine2, compatibilityParsers, preset, FullProjectionEngine, projectionEngine;
|
|
23169
20984
|
var init_projection = __esm({
|
|
23170
20985
|
"dist/projection/lib/projection.js"() {
|
|
23171
|
-
|
|
20986
|
+
import_projection_engine2 = require("./../projection/experimental/projection-engine.shared.cjs");
|
|
23172
20987
|
init_datums();
|
|
23173
20988
|
init_datum_catalog();
|
|
23174
20989
|
init_experimental();
|
|
23175
20990
|
init_normalize();
|
|
23176
20991
|
compatibilityParsers = [wktCRSParser, projJSONCRSParser].map(compatibilityParser);
|
|
23177
|
-
FullProjectionEngine = class extends ConfigurableProjectionEngine {
|
|
20992
|
+
FullProjectionEngine = class extends import_projection_engine2.ConfigurableProjectionEngine {
|
|
23178
20993
|
constructor(options = {}) {
|
|
23179
20994
|
super({
|
|
23180
20995
|
...options,
|
|
@@ -23182,7 +20997,7 @@ var init_projection = __esm({
|
|
|
23182
20997
|
parsers: options.parsers ?? compatibilityParsers,
|
|
23183
20998
|
datumCatalogs: options.datumCatalogs ?? [datumCatalog]
|
|
23184
20999
|
});
|
|
23185
|
-
this.useDefinitionSignature = !hasCRSOverrides(options);
|
|
21000
|
+
this.useDefinitionSignature = !(0, import_projection_engine2.hasCRSOverrides)(options);
|
|
23186
21001
|
}
|
|
23187
21002
|
};
|
|
23188
21003
|
projectionEngine = new FullProjectionEngine();
|
|
@@ -23196,8 +21011,8 @@ __export(operations_exports, {
|
|
|
23196
21011
|
setupMap: () => setupMap
|
|
23197
21012
|
});
|
|
23198
21013
|
function setupMap(description, context, options) {
|
|
23199
|
-
var
|
|
23200
|
-
(
|
|
21014
|
+
var _a2, _b2;
|
|
21015
|
+
(_a2 = context.reportProgress) == null ? void 0 : _a2.call(context, { phase: "map-setup", completed: 0, total: 1, unit: "tasks" });
|
|
23201
21016
|
const map = new MapEngine(description, {
|
|
23202
21017
|
presets: mapPresets,
|
|
23203
21018
|
geometry: mapGeometry,
|
|
@@ -23209,11 +21024,11 @@ function setupMap(description, context, options) {
|
|
|
23209
21024
|
return map;
|
|
23210
21025
|
}
|
|
23211
21026
|
async function projectBulk(input, context, preparedProjection) {
|
|
23212
|
-
var
|
|
21027
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
23213
21028
|
const { coordinates: coordinates2, dimension = 2, chunkSize = 4096 } = input;
|
|
23214
21029
|
if (!(coordinates2 instanceof Float32Array || coordinates2 instanceof Float64Array) || !(coordinates2.buffer instanceof ArrayBuffer) || !Number.isSafeInteger(dimension) || dimension < 2 || coordinates2.length % dimension || !Number.isSafeInteger(chunkSize) || chunkSize < 1)
|
|
23215
21030
|
throw new Error("Expected ordinary floating-point buffers, complete records and positive chunk size");
|
|
23216
|
-
(
|
|
21031
|
+
(_a2 = context.reportProgress) == null ? void 0 : _a2.call(context, { phase: "projection-setup", completed: 0, total: 1, unit: "tasks" });
|
|
23217
21032
|
const projection = preparedProjection ?? new (await Promise.resolve().then(() => (init_projection(), projection_exports))).FullProjectionEngine().createProjection(input.projection);
|
|
23218
21033
|
(_b2 = context.reportProgress) == null ? void 0 : _b2.call(context, { phase: "projection-setup", completed: 1, total: 1, unit: "tasks" });
|
|
23219
21034
|
const total = coordinates2.length / dimension;
|
|
@@ -23315,14 +21130,14 @@ var TerrainResidencyTask = {
|
|
|
23315
21130
|
return { limits: { ...limits }, snapshot: null, revision: 0 };
|
|
23316
21131
|
},
|
|
23317
21132
|
async process(input, _options, context) {
|
|
23318
|
-
var
|
|
21133
|
+
var _a2, _b2, _c;
|
|
23319
21134
|
const state = context.state;
|
|
23320
21135
|
if ("type" in input) {
|
|
23321
21136
|
if (input.type !== "snapshot")
|
|
23322
21137
|
throw new Error("Unknown terrain residency request");
|
|
23323
21138
|
return {
|
|
23324
21139
|
revision: state.revision,
|
|
23325
|
-
tiles: structuredClone(((
|
|
21140
|
+
tiles: structuredClone(((_a2 = state.snapshot) == null ? void 0 : _a2.tiles) ?? []),
|
|
23326
21141
|
removed: []
|
|
23327
21142
|
};
|
|
23328
21143
|
}
|
|
@@ -23499,8 +21314,8 @@ async function prepareProjection(state, options) {
|
|
|
23499
21314
|
|
|
23500
21315
|
// dist/tasks/index.js
|
|
23501
21316
|
var import_meta = {};
|
|
23502
|
-
var
|
|
23503
|
-
var isBrowser = !((_b = (
|
|
21317
|
+
var _a, _b;
|
|
21318
|
+
var isBrowser = !((_b = (_a = globalThis.process) == null ? void 0 : _a.versions) == null ? void 0 : _b.node);
|
|
23504
21319
|
var path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
23505
21320
|
var moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
23506
21321
|
var ProjectCoordinatesTask2 = {
|