@math.gl/geospatial 5.0.0-beta.2 → 5.0.0-beta.3
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/dist/index.cjs +374 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/tasks/definitions.d.ts +90 -0
- package/dist/tasks/definitions.d.ts.map +1 -0
- package/dist/tasks/definitions.js +54 -0
- package/dist/tasks/definitions.js.map +1 -0
- package/dist/{workers → tasks}/index.cjs +158 -122
- package/dist/tasks/index.cjs.map +6 -0
- package/dist/tasks/index.d.ts +12 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +30 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/{workers → tasks}/map-worker.d.ts.map +1 -1
- package/dist/tasks/map-worker.js +7 -0
- package/dist/tasks/map-worker.js.map +1 -0
- package/dist/{workers → tasks}/operations.d.ts +6 -4
- package/dist/tasks/operations.d.ts.map +1 -0
- package/dist/{workers → tasks}/operations.js +3 -5
- package/dist/tasks/operations.js.map +1 -0
- package/dist/tasks/projection-worker.d.ts.map +1 -0
- package/dist/tasks/projection-worker.js +7 -0
- package/dist/tasks/projection-worker.js.map +1 -0
- package/dist/terrain/filtered-pyramid.d.ts +22 -0
- package/dist/terrain/filtered-pyramid.d.ts.map +1 -0
- package/dist/terrain/filtered-pyramid.js +71 -0
- package/dist/terrain/filtered-pyramid.js.map +1 -0
- package/dist/terrain/index.cjs +375 -1
- package/dist/terrain/index.cjs.map +2 -2
- package/dist/terrain/index.d.ts +12 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +7 -0
- package/dist/terrain/index.js.map +1 -1
- package/dist/terrain/profile-horizon.d.ts +20 -0
- package/dist/terrain/profile-horizon.d.ts.map +1 -0
- package/dist/terrain/profile-horizon.js +69 -0
- package/dist/terrain/profile-horizon.js.map +1 -0
- package/dist/terrain/profile-slope.d.ts +3 -0
- package/dist/terrain/profile-slope.d.ts.map +1 -0
- package/dist/terrain/profile-slope.js +35 -0
- package/dist/terrain/profile-slope.js.map +1 -0
- package/dist/terrain/profile-viewshed.d.ts +17 -0
- package/dist/terrain/profile-viewshed.d.ts.map +1 -0
- package/dist/terrain/profile-viewshed.js +51 -0
- package/dist/terrain/profile-viewshed.js.map +1 -0
- package/dist/terrain/profile-visibility.d.ts +21 -0
- package/dist/terrain/profile-visibility.d.ts.map +1 -0
- package/dist/terrain/profile-visibility.js +61 -0
- package/dist/terrain/profile-visibility.js.map +1 -0
- package/dist/terrain/vertex-halo-invalidation.d.ts +16 -0
- package/dist/terrain/vertex-halo-invalidation.d.ts.map +1 -0
- package/dist/terrain/vertex-halo-invalidation.js +50 -0
- package/dist/terrain/vertex-halo-invalidation.js.map +1 -0
- package/dist/terrain/vertex-halo-update.d.ts +18 -0
- package/dist/terrain/vertex-halo-update.d.ts.map +1 -0
- package/dist/terrain/vertex-halo-update.js +76 -0
- package/dist/terrain/vertex-halo-update.js.map +1 -0
- package/dist/terrain/vertex-halos.d.ts +26 -0
- package/dist/terrain/vertex-halos.d.ts.map +1 -0
- package/dist/terrain/vertex-halos.js +80 -0
- package/dist/terrain/vertex-halos.js.map +1 -0
- package/package.json +10 -15
- package/src/index.ts +12 -0
- package/src/tasks/definitions.ts +89 -0
- package/src/tasks/index.ts +39 -0
- package/src/tasks/map-worker.ts +6 -0
- package/src/{workers → tasks}/operations.ts +11 -7
- package/src/tasks/projection-worker.ts +6 -0
- package/src/terrain/filtered-pyramid.ts +95 -0
- package/src/terrain/index.ts +12 -0
- package/src/terrain/profile-horizon.ts +86 -0
- package/src/terrain/profile-slope.ts +32 -0
- package/src/terrain/profile-viewshed.ts +57 -0
- package/src/terrain/profile-visibility.ts +81 -0
- package/src/terrain/vertex-halo-invalidation.ts +57 -0
- package/src/terrain/vertex-halo-update.ts +91 -0
- package/src/terrain/vertex-halos.ts +101 -0
- package/dist/workers/index.cjs.map +0 -6
- package/dist/workers/index.d.ts +0 -12
- package/dist/workers/index.d.ts.map +0 -1
- package/dist/workers/index.js +0 -41
- package/dist/workers/index.js.map +0 -1
- package/dist/workers/map-worker.js +0 -7
- package/dist/workers/map-worker.js.map +0 -1
- package/dist/workers/operations.cjs +0 -21008
- package/dist/workers/operations.cjs.map +0 -6
- package/dist/workers/operations.d.ts.map +0 -1
- package/dist/workers/operations.js.map +0 -1
- package/dist/workers/projection-worker.d.ts.map +0 -1
- package/dist/workers/projection-worker.js +0 -7
- package/dist/workers/projection-worker.js.map +0 -1
- package/src/workers/index.ts +0 -59
- package/src/workers/map-worker.ts +0 -7
- package/src/workers/projection-worker.ts +0 -7
- /package/dist/{workers → tasks}/map-worker.d.ts +0 -0
- /package/dist/{workers → tasks}/projection-worker.d.ts +0 -0
|
@@ -1376,7 +1376,7 @@ function prepareMapFeatures(map, features, options = {}) {
|
|
|
1376
1376
|
}
|
|
1377
1377
|
};
|
|
1378
1378
|
const addPolygon = (input, featureIndex, geometryPath) => {
|
|
1379
|
-
var
|
|
1379
|
+
var _a3;
|
|
1380
1380
|
if (!input.length)
|
|
1381
1381
|
return;
|
|
1382
1382
|
const rings = input.map((r) => r.map(position));
|
|
@@ -1391,7 +1391,7 @@ function prepareMapFeatures(map, features, options = {}) {
|
|
|
1391
1391
|
for (const p of parts) {
|
|
1392
1392
|
for (let i = 0; i < p.coordinates.length; i++) {
|
|
1393
1393
|
if (provenance == null ? void 0 : provenance.polygonEdges) {
|
|
1394
|
-
const edges = (
|
|
1394
|
+
const edges = (_a3 = p.edgeProvenance) == null ? void 0 : _a3[i];
|
|
1395
1395
|
if (!edges)
|
|
1396
1396
|
throw new Error("Map backend does not support polygon edge provenance");
|
|
1397
1397
|
const kinds = [
|
|
@@ -1626,12 +1626,12 @@ function tracePolygonConstraints(input, output, tolerance = 1e-10, priorities, a
|
|
|
1626
1626
|
if (exact.length)
|
|
1627
1627
|
candidates = exact;
|
|
1628
1628
|
if (candidates.some((c) => {
|
|
1629
|
-
var
|
|
1630
|
-
return ((
|
|
1629
|
+
var _a3, _b2;
|
|
1630
|
+
return ((_b2 = (_a3 = priorities == null ? void 0 : priorities[c.r]) == null ? void 0 : _a3[c.i]) == null ? void 0 : _b2.kind) === "source-boundary";
|
|
1631
1631
|
}))
|
|
1632
1632
|
candidates = candidates.filter((c) => {
|
|
1633
|
-
var
|
|
1634
|
-
return ((
|
|
1633
|
+
var _a3, _b2;
|
|
1634
|
+
return ((_b2 = (_a3 = priorities == null ? void 0 : priorities[c.r]) == null ? void 0 : _a3[c.i]) == null ? void 0 : _b2.kind) === "source-boundary";
|
|
1635
1635
|
});
|
|
1636
1636
|
if (candidates.length > 1) {
|
|
1637
1637
|
const score = (c) => Math.max(...[a, b].map((p) => {
|
|
@@ -1742,7 +1742,7 @@ var init_map_layout = __esm({
|
|
|
1742
1742
|
EPS = 1e-10;
|
|
1743
1743
|
DiscontinuousMap = class {
|
|
1744
1744
|
constructor(definitions) {
|
|
1745
|
-
var
|
|
1745
|
+
var _a3, _b2;
|
|
1746
1746
|
if (!definitions.length)
|
|
1747
1747
|
throw new Error("At least one map region is required");
|
|
1748
1748
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -1809,12 +1809,12 @@ var init_map_layout = __esm({
|
|
|
1809
1809
|
const byId = new Map(this.regions.map((r) => [r.id, r]));
|
|
1810
1810
|
for (const r of this.regions) {
|
|
1811
1811
|
const visited = /* @__PURE__ */ new Set([r.id]);
|
|
1812
|
-
let parent = (
|
|
1812
|
+
let parent = (_a3 = r.layout) == null ? void 0 : _a3.parentId;
|
|
1813
1813
|
while (parent !== void 0) {
|
|
1814
1814
|
if (!byId.has(parent) || visited.has(parent))
|
|
1815
1815
|
throw new Error("Invalid region parent hierarchy");
|
|
1816
1816
|
visited.add(parent);
|
|
1817
|
-
parent = (
|
|
1817
|
+
parent = (_b2 = byId.get(parent).layout) == null ? void 0 : _b2.parentId;
|
|
1818
1818
|
}
|
|
1819
1819
|
}
|
|
1820
1820
|
this.seams = Object.freeze(this.buildSeams());
|
|
@@ -1902,8 +1902,8 @@ var init_map_layout = __esm({
|
|
|
1902
1902
|
if (isEndpoint && angle(p, endpoint) < 1e-12)
|
|
1903
1903
|
return "source-endpoint";
|
|
1904
1904
|
const kinds = r.normals.map((normal, edge2) => {
|
|
1905
|
-
var
|
|
1906
|
-
return Math.abs(dot(normal, p)) < 1e-9 ? (
|
|
1905
|
+
var _a3;
|
|
1906
|
+
return Math.abs(dot(normal, p)) < 1e-9 ? (_a3 = this.seams.find((s) => s.regions.some((id, i2) => id === r.definition.id && s.edges[i2] === edge2))) == null ? void 0 : _a3.kind : void 0;
|
|
1907
1907
|
}).filter(Boolean);
|
|
1908
1908
|
return kinds.includes("boundary") ? "coverage-boundary" : kinds.includes("cut") ? "chart-cut" : kinds.includes("join") ? "continuous-chart-join" : "coverage-boundary";
|
|
1909
1909
|
};
|
|
@@ -2064,8 +2064,8 @@ var init_map_layout = __esm({
|
|
|
2064
2064
|
};
|
|
2065
2065
|
}
|
|
2066
2066
|
const kinds = r.normals.map((n, edge2) => {
|
|
2067
|
-
var
|
|
2068
|
-
return [a, b].every((p) => Math.abs(dot(n, p)) < 1e-9) ? (
|
|
2067
|
+
var _a3;
|
|
2068
|
+
return [a, b].every((p) => Math.abs(dot(n, p)) < 1e-9) ? (_a3 = this.seams.find((s) => s.regions.some((id, i) => id === r.definition.id && s.edges[i] === edge2))) == null ? void 0 : _a3.kind : void 0;
|
|
2069
2069
|
}).filter(Boolean);
|
|
2070
2070
|
if (!kinds.length)
|
|
2071
2071
|
throw new Error("Unknown polygon clipping constraint");
|
|
@@ -4372,9 +4372,9 @@ function lazy(factory) {
|
|
|
4372
4372
|
return kernel2(x, y);
|
|
4373
4373
|
};
|
|
4374
4374
|
forward33.invert = (x, y) => {
|
|
4375
|
-
var
|
|
4375
|
+
var _a3;
|
|
4376
4376
|
kernel2 ?? (kernel2 = factory());
|
|
4377
|
-
return (
|
|
4377
|
+
return (_a3 = kernel2.invert) == null ? void 0 : _a3.call(kernel2, x, y);
|
|
4378
4378
|
};
|
|
4379
4379
|
return forward33;
|
|
4380
4380
|
}
|
|
@@ -4654,14 +4654,14 @@ function createKernelMap({ kernel: kernel2, radius: radius2 = 1, centralMeridian
|
|
|
4654
4654
|
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);
|
|
4655
4655
|
const error = (p, target) => Math.hypot(p[0] - target[0], p[1] - target[1]);
|
|
4656
4656
|
const invert = (target) => {
|
|
4657
|
-
var
|
|
4657
|
+
var _a3;
|
|
4658
4658
|
const pole = sign5 * HALF, left = raw(west, pole), right = raw(east, pole);
|
|
4659
4659
|
const dx = right[0] - left[0], dy = right[1] - left[1], length = dx * dx + dy * dy;
|
|
4660
4660
|
const fraction = length ? clamp(((target[0] - left[0]) * dx + (target[1] - left[1]) * dy) / length, 0, 1) : 0.5;
|
|
4661
4661
|
const poleLambda = west + fraction * (east - west);
|
|
4662
4662
|
if (inside([poleLambda, pole]) && error(raw(poleLambda, pole), target) < 1e-13)
|
|
4663
4663
|
return [poleLambda, pole];
|
|
4664
|
-
const candidate = (
|
|
4664
|
+
const candidate = (_a3 = raw.invert) == null ? void 0 : _a3.call(raw, target[0], target[1]);
|
|
4665
4665
|
if (candidate && inside(candidate) && error(raw(candidate[0], candidate[1]), target) < 1e-10)
|
|
4666
4666
|
return [clamp(candidate[0], west, east), clamp(candidate[1], south, north)];
|
|
4667
4667
|
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);
|
|
@@ -5035,9 +5035,9 @@ var init_map = __esm({
|
|
|
5035
5035
|
splitter = createKernelMap({ kernel, radius: 1 / RAD });
|
|
5036
5036
|
ElasticMap = class {
|
|
5037
5037
|
constructor(data, radius2) {
|
|
5038
|
-
var
|
|
5038
|
+
var _a3;
|
|
5039
5039
|
this.charts = [];
|
|
5040
|
-
if (data.version !== 1 || typeof data.name !== "string" || !data.name || !Number.isFinite(data.radius) || data.radius <= 0 || !Number.isFinite(radius2) || radius2 <= 0 || !((
|
|
5040
|
+
if (data.version !== 1 || typeof data.name !== "string" || !data.name || !Number.isFinite(data.radius) || data.radius <= 0 || !Number.isFinite(radius2) || radius2 <= 0 || !((_a3 = data.sections) == null ? void 0 : _a3.length) || data.sections.length > 64)
|
|
5041
5041
|
throw new Error("Invalid Elastic dataset");
|
|
5042
5042
|
const ids = /* @__PURE__ */ new Set();
|
|
5043
5043
|
for (const section2 of data.sections) {
|
|
@@ -5459,7 +5459,7 @@ var init_map = __esm({
|
|
|
5459
5459
|
// dist/discontinuous/layout.js
|
|
5460
5460
|
function getMapLayout(map, options = {}) {
|
|
5461
5461
|
const regions2 = map.regions.map((region) => {
|
|
5462
|
-
var
|
|
5462
|
+
var _a3, _b2, _c, _d, _e, _f;
|
|
5463
5463
|
const outlines = map.getRegionOutlines(region.id, options).map((p) => Object.freeze(p.map((point) => Object.freeze([...point]))));
|
|
5464
5464
|
const points = outlines.flat();
|
|
5465
5465
|
const interior = map.projectPoint(region.interior, region.id);
|
|
@@ -5469,8 +5469,8 @@ function getMapLayout(map, options = {}) {
|
|
|
5469
5469
|
throw new Error(`Cannot measure region ${region.id}`);
|
|
5470
5470
|
return Object.freeze({
|
|
5471
5471
|
id: region.id,
|
|
5472
|
-
label: ((
|
|
5473
|
-
kind: ((
|
|
5472
|
+
label: ((_a3 = region.layout) == null ? void 0 : _a3.label) ?? region.id,
|
|
5473
|
+
kind: ((_b2 = region.layout) == null ? void 0 : _b2.kind) ?? "panel",
|
|
5474
5474
|
parentId: (_c = region.layout) == null ? void 0 : _c.parentId,
|
|
5475
5475
|
relativeScale: (_d = region.layout) == null ? void 0 : _d.relativeScale,
|
|
5476
5476
|
drawOrder: ((_e = region.layout) == null ? void 0 : _e.drawOrder) ?? 0,
|
|
@@ -5953,7 +5953,7 @@ function interruptedMap(kind, value2, goode = false, layout = "default", central
|
|
|
5953
5953
|
return new DiscontinuousMap(regions2);
|
|
5954
5954
|
}
|
|
5955
5955
|
function createInterruptedMap(options) {
|
|
5956
|
-
var
|
|
5956
|
+
var _a3, _b2;
|
|
5957
5957
|
if (![
|
|
5958
5958
|
"sinusoidal",
|
|
5959
5959
|
"mollweide",
|
|
@@ -5969,7 +5969,7 @@ function createInterruptedMap(options) {
|
|
|
5969
5969
|
const centralMeridian = options.centralMeridian ?? 0;
|
|
5970
5970
|
if (!Number.isFinite(centralMeridian))
|
|
5971
5971
|
throw new Error("Expected finite centralMeridian");
|
|
5972
|
-
for (const hemisphere of [(
|
|
5972
|
+
for (const hemisphere of [(_a3 = options.lobes) == null ? void 0 : _a3.north, (_b2 = options.lobes) == null ? void 0 : _b2.south]) {
|
|
5973
5973
|
if (!Array.isArray(hemisphere) || !hemisphere.length)
|
|
5974
5974
|
throw new Error("Expected nonempty north and south lobe arrays");
|
|
5975
5975
|
let edge2 = -180;
|
|
@@ -6896,7 +6896,7 @@ var init_wiechel = __esm({
|
|
|
6896
6896
|
|
|
6897
6897
|
// dist/discontinuous/regional-map.js
|
|
6898
6898
|
function createRegionalMap(options) {
|
|
6899
|
-
var
|
|
6899
|
+
var _a3;
|
|
6900
6900
|
const { projection, radius: radius2 = 1 } = options;
|
|
6901
6901
|
if (!Number.isFinite(radius2) || radius2 <= 0)
|
|
6902
6902
|
throw new Error("Expected positive finite radius");
|
|
@@ -6936,7 +6936,7 @@ function createRegionalMap(options) {
|
|
|
6936
6936
|
"two-point-equidistant": ["controlPoints"]
|
|
6937
6937
|
};
|
|
6938
6938
|
for (const key2 of Object.keys(options))
|
|
6939
|
-
if (!["projection", "radius", "type"].includes(key2) && !((
|
|
6939
|
+
if (!["projection", "radius", "type"].includes(key2) && !((_a3 = allowed[projection]) == null ? void 0 : _a3.includes(key2)))
|
|
6940
6940
|
throw new Error(`Unsupported ${projection} option: ${key2}`);
|
|
6941
6941
|
const value2 = (key2, fallback, low, high) => {
|
|
6942
6942
|
const n = options[key2] ?? fallback;
|
|
@@ -8330,8 +8330,8 @@ function regions(layout) {
|
|
|
8330
8330
|
});
|
|
8331
8331
|
}
|
|
8332
8332
|
function snapshotMesh(input) {
|
|
8333
|
-
var
|
|
8334
|
-
if (!((
|
|
8333
|
+
var _a3, _b2;
|
|
8334
|
+
if (!((_a3 = input.vertices) == null ? void 0 : _a3.length) || !((_b2 = input.faces) == null ? void 0 : _b2.length) || input.faces.length > 2e4)
|
|
8335
8335
|
throw new Error("Expected a nonempty mesh with at most 20000 panels");
|
|
8336
8336
|
const mesh = {
|
|
8337
8337
|
vertices: input.vertices.map((v) => [...v]),
|
|
@@ -8797,14 +8797,14 @@ var init_map_engine = __esm({
|
|
|
8797
8797
|
}
|
|
8798
8798
|
case "custom":
|
|
8799
8799
|
this.map = new DiscontinuousMap(d.charts.map((chart) => {
|
|
8800
|
-
var
|
|
8801
|
-
const projection = (
|
|
8800
|
+
var _a3, _b2;
|
|
8801
|
+
const projection = (_a3 = options.projections) == null ? void 0 : _a3[chart.projection];
|
|
8802
8802
|
if (!projection)
|
|
8803
8803
|
throw new Error(`Missing projection binding: ${chart.projection}`);
|
|
8804
8804
|
const placement = (chart.placement ?? [1, 0, 0, 1, 0, 0]).map((v) => v * radius2);
|
|
8805
8805
|
const layout = chart.layout ? {
|
|
8806
8806
|
...chart.layout,
|
|
8807
|
-
frame: (
|
|
8807
|
+
frame: (_b2 = chart.layout.frame) == null ? void 0 : _b2.map((v) => v * radius2)
|
|
8808
8808
|
} : void 0;
|
|
8809
8809
|
return { ...chart, ...projection, placement, layout };
|
|
8810
8810
|
}));
|
|
@@ -8826,8 +8826,8 @@ var init_map_engine = __esm({
|
|
|
8826
8826
|
this.capabilities = Object.freeze({
|
|
8827
8827
|
hasCuts: this.seams.some((s) => s.kind === "cut"),
|
|
8828
8828
|
hasInsets: this.regions.some((r) => {
|
|
8829
|
-
var
|
|
8830
|
-
return ((
|
|
8829
|
+
var _a3;
|
|
8830
|
+
return ((_a3 = r.layout) == null ? void 0 : _a3.kind) === "inset";
|
|
8831
8831
|
}),
|
|
8832
8832
|
disjoint: new Set(groups.values()).size > 1,
|
|
8833
8833
|
hinged: Boolean(this.motion),
|
|
@@ -9184,7 +9184,7 @@ function resolveCRSInput(input, options) {
|
|
|
9184
9184
|
return { definition: reference.definition, spatialReference, lossy };
|
|
9185
9185
|
}
|
|
9186
9186
|
function applySpatialReference(crs, reference) {
|
|
9187
|
-
var
|
|
9187
|
+
var _a3;
|
|
9188
9188
|
if (!reference)
|
|
9189
9189
|
return crs;
|
|
9190
9190
|
if (reference.coordinateFrame !== "unknown" && reference.coordinateFrame !== crs.kind)
|
|
@@ -9213,7 +9213,7 @@ function applySpatialReference(crs, reference) {
|
|
|
9213
9213
|
if (order.length > 4 || order.length > 3 && !["m", "measure"].includes(order[3]))
|
|
9214
9214
|
unsupportedStage("Unsupported fourth coordinate component");
|
|
9215
9215
|
}
|
|
9216
|
-
if ((
|
|
9216
|
+
if ((_a3 = reference.units) == null ? void 0 : _a3.length) {
|
|
9217
9217
|
const units2 = {
|
|
9218
9218
|
m: 1,
|
|
9219
9219
|
meter: 1,
|
|
@@ -9278,8 +9278,8 @@ var init_parameters = __esm({
|
|
|
9278
9278
|
|
|
9279
9279
|
// dist/projection/experimental/crs/datum-catalog.js
|
|
9280
9280
|
function getDatumDefinitions(options) {
|
|
9281
|
-
var
|
|
9282
|
-
if (!((
|
|
9281
|
+
var _a3;
|
|
9282
|
+
if (!((_a3 = options.datumCatalogs) == null ? void 0 : _a3.length))
|
|
9283
9283
|
return builtins;
|
|
9284
9284
|
const cached = resolved.get(options);
|
|
9285
9285
|
if ((cached == null ? void 0 : cached.catalogs) === options.datumCatalogs)
|
|
@@ -9677,7 +9677,7 @@ function resolveLocalCRSDefinition(input, options = {}) {
|
|
|
9677
9677
|
return definition;
|
|
9678
9678
|
}
|
|
9679
9679
|
function normalizeCRS(input, options = {}) {
|
|
9680
|
-
var
|
|
9680
|
+
var _a3;
|
|
9681
9681
|
const datums2 = getDatumDefinitions(options);
|
|
9682
9682
|
const resolved2 = resolveCRSInput(input, options);
|
|
9683
9683
|
const definition = resolveLocalCRSDefinition(resolved2.definition, options);
|
|
@@ -9691,7 +9691,7 @@ function normalizeCRS(input, options = {}) {
|
|
|
9691
9691
|
}
|
|
9692
9692
|
parsed = { parameters: parameters2 };
|
|
9693
9693
|
} else {
|
|
9694
|
-
const parser = (
|
|
9694
|
+
const parser = (_a3 = options.parsers) == null ? void 0 : _a3.find((candidate) => candidate.canParse(definition));
|
|
9695
9695
|
if (!parser) {
|
|
9696
9696
|
const serialized = ["wkt", "projjson"].includes(inferCRSRepresentation(definition));
|
|
9697
9697
|
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");
|
|
@@ -10229,12 +10229,12 @@ async function prepareEngineOptions(options) {
|
|
|
10229
10229
|
return { ...captured, from, to };
|
|
10230
10230
|
}
|
|
10231
10231
|
async function prepareCRSInput(captured, options) {
|
|
10232
|
-
var
|
|
10232
|
+
var _a3;
|
|
10233
10233
|
const source = resolveCRSInput(captured, options);
|
|
10234
10234
|
const local = resolveLocalCRSDefinition(source.definition, options);
|
|
10235
10235
|
const reference = typeof captured === "string" || "type" in captured ? void 0 : "crs" in captured ? captured.crs : captured;
|
|
10236
10236
|
const representation = local === source.definition && reference ? reference.representation : inferCRSRepresentation(local);
|
|
10237
|
-
if (representation !== "identifier" || ((
|
|
10237
|
+
if (representation !== "identifier" || ((_a3 = options.parsers) == null ? void 0 : _a3.some((p) => p.canParse(local)))) {
|
|
10238
10238
|
return captured;
|
|
10239
10239
|
}
|
|
10240
10240
|
const result = await options.resolver.resolve({
|
|
@@ -10387,11 +10387,11 @@ function resolveRenderingProfile(getRenderingProfile, coverage) {
|
|
|
10387
10387
|
return resolveBounds(profile);
|
|
10388
10388
|
}
|
|
10389
10389
|
function resolveBounds(profile) {
|
|
10390
|
-
var
|
|
10390
|
+
var _a3;
|
|
10391
10391
|
const bounds = profile.bounds;
|
|
10392
10392
|
if (bounds.some((corner) => corner.some((value2) => !Number.isFinite(value2))))
|
|
10393
10393
|
throw new Error("Projection rendering bounds must be finite");
|
|
10394
|
-
return { bounds, normalize: (
|
|
10394
|
+
return { bounds, normalize: (_a3 = profile.normalize) == null ? void 0 : _a3.bind(profile) };
|
|
10395
10395
|
}
|
|
10396
10396
|
function createAngularNormalization(normalize2, primeMeridian2 = 0) {
|
|
10397
10397
|
return (point) => {
|
|
@@ -10419,11 +10419,11 @@ function combineRenderingProfiles(regions2, getProfile) {
|
|
|
10419
10419
|
return {
|
|
10420
10420
|
bounds: unionRenderingBounds(profiles.map((profile) => profile.bounds)),
|
|
10421
10421
|
normalize(point) {
|
|
10422
|
-
var
|
|
10422
|
+
var _a3;
|
|
10423
10423
|
let bestX = point.x, bestY = point.y, best = Infinity;
|
|
10424
10424
|
for (const profile of profiles) {
|
|
10425
10425
|
const candidate = { x: point.x, y: point.y, z: point.z };
|
|
10426
|
-
(
|
|
10426
|
+
(_a3 = profile.normalize) == null ? void 0 : _a3.call(profile, candidate);
|
|
10427
10427
|
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;
|
|
10428
10428
|
if (distance3 < best) {
|
|
10429
10429
|
best = distance3;
|
|
@@ -10463,8 +10463,8 @@ function cache() {
|
|
|
10463
10463
|
return scope[CACHE_KEY];
|
|
10464
10464
|
}
|
|
10465
10465
|
function getLoadedProjection(projection) {
|
|
10466
|
-
var
|
|
10467
|
-
return "create" in projection ? projection : (
|
|
10466
|
+
var _a3;
|
|
10467
|
+
return "create" in projection ? projection : (_a3 = cache().get(projection)) == null ? void 0 : _a3.implementation;
|
|
10468
10468
|
}
|
|
10469
10469
|
function preloadProjection(projection) {
|
|
10470
10470
|
if ("create" in projection)
|
|
@@ -10514,9 +10514,9 @@ var init_projection_scratch = __esm({
|
|
|
10514
10514
|
return this.active;
|
|
10515
10515
|
}
|
|
10516
10516
|
acquire() {
|
|
10517
|
-
var
|
|
10517
|
+
var _a3;
|
|
10518
10518
|
const index = this.active++;
|
|
10519
|
-
(
|
|
10519
|
+
(_a3 = this.points)[index] || (_a3[index] = createPoint());
|
|
10520
10520
|
return this.points[index];
|
|
10521
10521
|
}
|
|
10522
10522
|
release(point) {
|
|
@@ -10622,8 +10622,8 @@ function createHelmert(values, inverse34) {
|
|
|
10622
10622
|
};
|
|
10623
10623
|
}
|
|
10624
10624
|
function shifted(datum) {
|
|
10625
|
-
var
|
|
10626
|
-
return Boolean((
|
|
10625
|
+
var _a3;
|
|
10626
|
+
return Boolean((_a3 = datum.towgs84) == null ? void 0 : _a3.some((value2) => value2 !== 0));
|
|
10627
10627
|
}
|
|
10628
10628
|
function createDatumTransform(source, destination) {
|
|
10629
10629
|
if (!source.towgs84 || !destination.towgs84)
|
|
@@ -10975,7 +10975,7 @@ function registry(projections) {
|
|
|
10975
10975
|
return plugins;
|
|
10976
10976
|
}
|
|
10977
10977
|
function compileCRS(definition, plugins, options) {
|
|
10978
|
-
var
|
|
10978
|
+
var _a3;
|
|
10979
10979
|
const crs = normalizeCRS(definition, options);
|
|
10980
10980
|
const plugin = plugins.get(pluginKey(crs.projection));
|
|
10981
10981
|
if (!["geographic", "identity"].includes(crs.kind) && !plugin)
|
|
@@ -10984,7 +10984,7 @@ function compileCRS(definition, plugins, options) {
|
|
|
10984
10984
|
for (const key2 of Object.keys(crs.parameters)) {
|
|
10985
10985
|
if (!allowed.has(key2))
|
|
10986
10986
|
throw new TypeScriptCRSError("missing-transform-stage", "Unsupported PROJ parameter: +" + key2);
|
|
10987
|
-
const flag = CORE_FLAGS.includes(key2) || ((
|
|
10987
|
+
const flag = CORE_FLAGS.includes(key2) || ((_a3 = plugin == null ? void 0 : plugin.flags) == null ? void 0 : _a3.includes(key2));
|
|
10988
10988
|
if (flag && crs.parameters[key2] !== void 0)
|
|
10989
10989
|
throw new Error("Expected a flag without a value: +" + key2);
|
|
10990
10990
|
if (!flag && !crs.parameters[key2])
|
|
@@ -11040,7 +11040,7 @@ function compileAxis(axis, inverse34) {
|
|
|
11040
11040
|
};
|
|
11041
11041
|
}
|
|
11042
11042
|
function compileTransform(from, to, enforceAxis) {
|
|
11043
|
-
var
|
|
11043
|
+
var _a3, _b2, _c, _d;
|
|
11044
11044
|
const fromAxis = from.storedAxis || (enforceAxis ? from.axis : "enu");
|
|
11045
11045
|
const toAxis = to.storedAxis || (enforceAxis ? to.axis : "enu");
|
|
11046
11046
|
const inputAxis = compileAxis(fromAxis, false), outputAxis = compileAxis(toAxis, true);
|
|
@@ -11058,7 +11058,7 @@ function compileTransform(from, to, enforceAxis) {
|
|
|
11058
11058
|
if (!datum && !from.verticalGrid && !to.verticalGrid && !horizontalOnly && !inputAxis && !outputAxis && !fromPrime && !toPrime && from.verticalUnit === 1 && to.verticalUnit === 1 && longitudeWrap === void 0) {
|
|
11059
11059
|
const context = Object.freeze({ inputScale, outputScale });
|
|
11060
11060
|
if (from.kind === "geographic" && to.kind === "projected")
|
|
11061
|
-
flat = (
|
|
11061
|
+
flat = (_b2 = (_a3 = to.implementation) == null ? void 0 : _a3.createForwardFlat) == null ? void 0 : _b2.call(_a3, context);
|
|
11062
11062
|
if (from.kind === "projected" && to.kind === "geographic")
|
|
11063
11063
|
flat = (_d = (_c = from.implementation) == null ? void 0 : _c.createInverseFlat) == null ? void 0 : _d.call(_c, context);
|
|
11064
11064
|
}
|
|
@@ -11192,7 +11192,7 @@ var init_typescript_projection = __esm({
|
|
|
11192
11192
|
return this.targetRenderingProfile && resolveRenderingProfile(this.targetRenderingProfile, coverage);
|
|
11193
11193
|
}
|
|
11194
11194
|
constructor(options = {}) {
|
|
11195
|
-
var
|
|
11195
|
+
var _a3, _b2, _c;
|
|
11196
11196
|
this.coordinateScratch = new ProjectionScratch();
|
|
11197
11197
|
this.targetLongitudeOrigin = 0;
|
|
11198
11198
|
const registrations = options.projections || [];
|
|
@@ -11207,7 +11207,7 @@ var init_typescript_projection = __esm({
|
|
|
11207
11207
|
const eagerPlugins = plugins;
|
|
11208
11208
|
const from = compileCRS(eager.from ?? "WGS84", eagerPlugins, eager);
|
|
11209
11209
|
const to = compileCRS(eager.to ?? "WGS84", eagerPlugins, eager);
|
|
11210
|
-
this.targetRenderingProfile = ((
|
|
11210
|
+
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);
|
|
11211
11211
|
this.targetCoverage = to.areaOfUse;
|
|
11212
11212
|
this.targetLongitudeOrigin = ((_c = to.implementation) == null ? void 0 : _c.longitudeOrigin) ?? (to.kind === "geographic" ? to.longitudeWrap ?? 0 : 0);
|
|
11213
11213
|
this.lossy = from.lossy || to.lossy;
|
|
@@ -11251,10 +11251,10 @@ var init_typescript_projection = __esm({
|
|
|
11251
11251
|
if (!state)
|
|
11252
11252
|
return this;
|
|
11253
11253
|
if (!state.implementation) {
|
|
11254
|
-
const projections = requiredProjections(state.options).map((
|
|
11255
|
-
const plugin = getLoadedProjection(
|
|
11254
|
+
const projections = requiredProjections(state.options).map((descriptor) => {
|
|
11255
|
+
const plugin = getLoadedProjection(descriptor);
|
|
11256
11256
|
if (!plugin)
|
|
11257
|
-
throw new Error("Projection is not preloaded: " +
|
|
11257
|
+
throw new Error("Projection is not preloaded: " + descriptor.name + ". Call preload() first.");
|
|
11258
11258
|
return plugin;
|
|
11259
11259
|
});
|
|
11260
11260
|
state.implementation = new _ProjectionTransform({ ...state.options, projections });
|
|
@@ -20311,7 +20311,7 @@ function obliqueTransformation(wrapped) {
|
|
|
20311
20311
|
parameters: [...rotationParameters, "lon_0", ...geographic2 ? [] : wrapped.parameters],
|
|
20312
20312
|
flags: geographic2 ? [] : wrapped.flags,
|
|
20313
20313
|
create(context) {
|
|
20314
|
-
var
|
|
20314
|
+
var _a3;
|
|
20315
20315
|
const { parameters } = context;
|
|
20316
20316
|
const requested = parameters["o_proj"];
|
|
20317
20317
|
const accepted = geographic2 ? ["longlat", "latlong", "lonlat", "latlon", "identity"] : [wrapped.name, ...wrapped.aliases || []];
|
|
@@ -20365,18 +20365,18 @@ function obliqueTransformation(wrapped) {
|
|
|
20365
20365
|
inverse34(point);
|
|
20366
20366
|
unrotate(point);
|
|
20367
20367
|
});
|
|
20368
|
-
const getChildProfile = geographic2 ? createGeographicProfile(innerParameters) : (
|
|
20368
|
+
const getChildProfile = geographic2 ? createGeographicProfile(innerParameters) : (_a3 = inner.getRenderingProfile) == null ? void 0 : _a3.bind(inner);
|
|
20369
20369
|
if (!getChildProfile)
|
|
20370
20370
|
return implementation;
|
|
20371
20371
|
const wrapProfile = (child2, coverage) => {
|
|
20372
20372
|
const source = coverage && createRectangleRenderingProfile(() => child2.bounds, coverage, longitudeOrigin, context.primeMeridian ?? 0, over);
|
|
20373
20373
|
const normalizeRotated = createAngularNormalization((point) => {
|
|
20374
|
-
var
|
|
20374
|
+
var _a4;
|
|
20375
20375
|
const longitude3 = point.x, latitude = point.y;
|
|
20376
20376
|
rotate(point);
|
|
20377
20377
|
const x = point.x * 180 / Math.PI, y = point.y * 180 / Math.PI;
|
|
20378
20378
|
const rotated = { x, y, z: point.z };
|
|
20379
|
-
(
|
|
20379
|
+
(_a4 = child2.normalize) == null ? void 0 : _a4.call(child2, rotated);
|
|
20380
20380
|
if (rotated.x === x && rotated.y === y) {
|
|
20381
20381
|
point.x = longitude3;
|
|
20382
20382
|
point.y = latitude;
|
|
@@ -20467,8 +20467,8 @@ function parseWKTCRS(text, options) {
|
|
|
20467
20467
|
return ast;
|
|
20468
20468
|
}
|
|
20469
20469
|
function validateWKTCRS(ast, options) {
|
|
20470
|
-
var
|
|
20471
|
-
if (!ast || ast.type !== "wkt-crs" || ((
|
|
20470
|
+
var _a3;
|
|
20471
|
+
if (!ast || ast.type !== "wkt-crs" || ((_a3 = ast.root) == null ? void 0 : _a3.type) !== "node") {
|
|
20472
20472
|
throw new TypeError("validateWKTCRS expects a WKTCRSAst");
|
|
20473
20473
|
}
|
|
20474
20474
|
const profile = resolveProfile(ast.root.keyword, (options == null ? void 0 : options.profile) || "auto");
|
|
@@ -20657,8 +20657,8 @@ var init_wkt_crs = __esm({
|
|
|
20657
20657
|
WKTCRSValidationError = class extends Error {
|
|
20658
20658
|
/** Create an error from one or more validation issues. */
|
|
20659
20659
|
constructor(issues) {
|
|
20660
|
-
var
|
|
20661
|
-
super(((
|
|
20660
|
+
var _a3;
|
|
20661
|
+
super(((_a3 = issues[0]) == null ? void 0 : _a3.message) || "WKT validation failed");
|
|
20662
20662
|
this.name = "WKTCRSValidationError";
|
|
20663
20663
|
this.issues = issues;
|
|
20664
20664
|
}
|
|
@@ -21004,7 +21004,7 @@ function unit2(value2, fallback) {
|
|
|
21004
21004
|
return factor;
|
|
21005
21005
|
}
|
|
21006
21006
|
function readStructuredCRS(crs, options) {
|
|
21007
|
-
var
|
|
21007
|
+
var _a3, _b2, _c;
|
|
21008
21008
|
const type = String(crs["type"]);
|
|
21009
21009
|
const areaOfUse = readAreaOfUse(crs["bbox"]);
|
|
21010
21010
|
if (type === "CompoundCRS") {
|
|
@@ -21132,7 +21132,7 @@ function readStructuredCRS(crs, options) {
|
|
|
21132
21132
|
if (geocentric2)
|
|
21133
21133
|
parameters["proj"] = "geocent";
|
|
21134
21134
|
const angularUnit = unit2(base["angular_unit"], DEGREES_TO_RADIANS);
|
|
21135
|
-
const factor = unit2((
|
|
21135
|
+
const factor = unit2((_a3 = axes[0]) == null ? void 0 : _a3["unit"], type === "ProjectedCRS" || geocentric2 ? 1 : angularUnit);
|
|
21136
21136
|
if (axes[1] && unit2(axes[1]["unit"], factor) !== factor)
|
|
21137
21137
|
unsupportedStage("Mixed horizontal axis units are not supported");
|
|
21138
21138
|
if (geocentric2 && axes[2] && unit2(axes[2]["unit"], factor) !== factor)
|
|
@@ -21180,7 +21180,7 @@ function readStructuredCRS(crs, options) {
|
|
|
21180
21180
|
unsupportedStage("Pseudo-Mercator semi_minor must equal the semi-major axis");
|
|
21181
21181
|
continue;
|
|
21182
21182
|
}
|
|
21183
|
-
let name = ((
|
|
21183
|
+
let name = ((_b2 = METHOD_PARAMETERS[projection]) == null ? void 0 : _b2[parameterName]) || PARAMETERS[parameterName];
|
|
21184
21184
|
if (!name)
|
|
21185
21185
|
unsupportedStage("Unsupported conversion parameter: " + String(parameter["name"]));
|
|
21186
21186
|
if (name === "lat_1" && method === "stereographicnorthpole" && !polarTrueScale)
|
|
@@ -21256,7 +21256,7 @@ function readAreaOfUse(bbox) {
|
|
|
21256
21256
|
return areaOfUse;
|
|
21257
21257
|
}
|
|
21258
21258
|
function readAxisDirection(entry, parameters, projected) {
|
|
21259
|
-
var
|
|
21259
|
+
var _a3;
|
|
21260
21260
|
let direction = String(entry["direction"]);
|
|
21261
21261
|
let meridian = entry["meridian"];
|
|
21262
21262
|
const along = /^(north|south) along ([+-]?(?:\d+(?:\.\d*)?|\.\d+)) deg(?: (east|west))?$/i.exec(direction);
|
|
@@ -21265,7 +21265,7 @@ function readAxisDirection(entry, parameters, projected) {
|
|
|
21265
21265
|
throw new Error("Duplicate axis meridian");
|
|
21266
21266
|
direction = along[1];
|
|
21267
21267
|
meridian = {
|
|
21268
|
-
longitude: Number(along[2]) * (((
|
|
21268
|
+
longitude: Number(along[2]) * (((_a3 = along[3]) == null ? void 0 : _a3.toLowerCase()) === "west" ? -1 : 1)
|
|
21269
21269
|
};
|
|
21270
21270
|
}
|
|
21271
21271
|
if (meridian !== void 0) {
|
|
@@ -21781,29 +21781,28 @@ var init_projection = __esm({
|
|
|
21781
21781
|
}
|
|
21782
21782
|
});
|
|
21783
21783
|
|
|
21784
|
-
// dist/
|
|
21784
|
+
// dist/tasks/operations.js
|
|
21785
21785
|
var operations_exports = {};
|
|
21786
21786
|
__export(operations_exports, {
|
|
21787
21787
|
projectBulk: () => projectBulk,
|
|
21788
21788
|
setupMap: () => setupMap
|
|
21789
21789
|
});
|
|
21790
21790
|
function setupMap(description, context, options) {
|
|
21791
|
-
var
|
|
21792
|
-
(
|
|
21791
|
+
var _a3, _b2;
|
|
21792
|
+
(_a3 = context.reportProgress) == null ? void 0 : _a3.call(context, { phase: "map-setup", completed: 0, total: 1, unit: "tasks" });
|
|
21793
21793
|
const map = new MapEngine(description, options);
|
|
21794
21794
|
map.getLayout();
|
|
21795
|
-
(
|
|
21795
|
+
(_b2 = context.reportProgress) == null ? void 0 : _b2.call(context, { phase: "map-setup", completed: 1, total: 1, unit: "tasks" });
|
|
21796
21796
|
return map;
|
|
21797
21797
|
}
|
|
21798
|
-
async function projectBulk(input, context) {
|
|
21799
|
-
var
|
|
21798
|
+
async function projectBulk(input, context, preparedProjection) {
|
|
21799
|
+
var _a3, _b2, _c, _d, _e, _f;
|
|
21800
21800
|
const { coordinates: coordinates2, dimension = 2, chunkSize = 4096 } = input;
|
|
21801
21801
|
if (!(coordinates2 instanceof Float32Array || coordinates2 instanceof Float64Array) || !(coordinates2.buffer instanceof ArrayBuffer) || !Number.isSafeInteger(dimension) || dimension < 2 || coordinates2.length % dimension || !Number.isSafeInteger(chunkSize) || chunkSize < 1)
|
|
21802
21802
|
throw new Error("Expected ordinary floating-point buffers, complete records and positive chunk size");
|
|
21803
|
-
(
|
|
21804
|
-
const
|
|
21805
|
-
|
|
21806
|
-
(_b = context.reportProgress) == null ? void 0 : _b.call(context, { phase: "projection-setup", completed: 1, total: 1, unit: "tasks" });
|
|
21803
|
+
(_a3 = context.reportProgress) == null ? void 0 : _a3.call(context, { phase: "projection-setup", completed: 0, total: 1, unit: "tasks" });
|
|
21804
|
+
const projection = preparedProjection ?? new (await Promise.resolve().then(() => (init_projection(), projection_exports))).FullProjectionEngine().createProjection(input.projection);
|
|
21805
|
+
(_b2 = context.reportProgress) == null ? void 0 : _b2.call(context, { phase: "projection-setup", completed: 1, total: 1, unit: "tasks" });
|
|
21807
21806
|
const total = coordinates2.length / dimension;
|
|
21808
21807
|
(_c = context.reportProgress) == null ? void 0 : _c.call(context, { phase: "bulk-projection", completed: 0, total, unit: "records" });
|
|
21809
21808
|
for (let start = 0; start < total; start += chunkSize) {
|
|
@@ -21815,61 +21814,98 @@ async function projectBulk(input, context) {
|
|
|
21815
21814
|
projection.unprojectFlatSync(chunk, dimension);
|
|
21816
21815
|
else
|
|
21817
21816
|
projection.projectFlatSync(chunk, dimension);
|
|
21818
|
-
|
|
21819
|
-
(_f = context.sharedState) == null ? void 0 : _f.setProgress(end, total);
|
|
21820
|
-
(_g = context.reportProgress) == null ? void 0 : _g.call(context, { phase: "bulk-projection", completed: end, total, unit: "records" });
|
|
21817
|
+
(_f = context.reportProgress) == null ? void 0 : _f.call(context, { phase: "bulk-projection", completed: end, total, unit: "records" });
|
|
21821
21818
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
21822
21819
|
}
|
|
21823
21820
|
return coordinates2;
|
|
21824
21821
|
}
|
|
21825
21822
|
var init_operations = __esm({
|
|
21826
|
-
"dist/
|
|
21823
|
+
"dist/tasks/operations.js"() {
|
|
21827
21824
|
init_map_engine();
|
|
21828
21825
|
}
|
|
21829
21826
|
});
|
|
21830
21827
|
|
|
21831
|
-
// dist/
|
|
21828
|
+
// dist/tasks/index.js
|
|
21832
21829
|
var index_exports = {};
|
|
21833
21830
|
__export(index_exports, {
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
projectBulkInWorker: () => projectBulkInWorker,
|
|
21837
|
-
setupMapInWorker: () => setupMapInWorker
|
|
21831
|
+
PrepareMapTask: () => PrepareMapTask2,
|
|
21832
|
+
ProjectCoordinatesTask: () => ProjectCoordinatesTask2
|
|
21838
21833
|
});
|
|
21839
21834
|
module.exports = __toCommonJS(index_exports);
|
|
21840
|
-
|
|
21835
|
+
|
|
21836
|
+
// dist/tasks/definitions.js
|
|
21837
|
+
var processCoordinates = async (input, options, context) => {
|
|
21838
|
+
const projection = input.projection ?? context.state.defaultOptions;
|
|
21839
|
+
if (!projection)
|
|
21840
|
+
throw new Error("Provide projection in the input or initializeTask");
|
|
21841
|
+
await prepareProjection(context.state, projection);
|
|
21842
|
+
const { projectBulk: projectBulk2 } = await Promise.resolve().then(() => (init_operations(), operations_exports));
|
|
21843
|
+
const coordinates2 = await projectBulk2({ ...input, projection, chunkSize: options.chunkSize }, context, context.state.projection);
|
|
21844
|
+
return { coordinates: coordinates2 };
|
|
21845
|
+
};
|
|
21846
|
+
var ProjectCoordinatesTask = {
|
|
21847
|
+
id: "project-coordinates",
|
|
21848
|
+
async preload() {
|
|
21849
|
+
await Promise.all([Promise.resolve().then(() => (init_operations(), operations_exports)), Promise.resolve().then(() => (init_projection(), projection_exports))]);
|
|
21850
|
+
},
|
|
21851
|
+
async initialize({ projection }) {
|
|
21852
|
+
const state = { defaultOptions: projection };
|
|
21853
|
+
if (projection)
|
|
21854
|
+
await prepareProjection(state, projection);
|
|
21855
|
+
return state;
|
|
21856
|
+
},
|
|
21857
|
+
destroy(state) {
|
|
21858
|
+
state.projection = void 0;
|
|
21859
|
+
state.defaultOptions = void 0;
|
|
21860
|
+
state.key = void 0;
|
|
21861
|
+
},
|
|
21862
|
+
process: processCoordinates,
|
|
21863
|
+
async *processInBatches(inputs, options, context) {
|
|
21864
|
+
for await (const input of inputs) {
|
|
21865
|
+
yield await processCoordinates(input, options, context);
|
|
21866
|
+
}
|
|
21867
|
+
}
|
|
21868
|
+
};
|
|
21869
|
+
var PrepareMapTask = {
|
|
21870
|
+
id: "prepare-map",
|
|
21871
|
+
async preload() {
|
|
21872
|
+
await Promise.resolve().then(() => (init_operations(), operations_exports));
|
|
21873
|
+
},
|
|
21874
|
+
async process({ description }, _options, context) {
|
|
21875
|
+
const { setupMap: setupMap2 } = await Promise.resolve().then(() => (init_operations(), operations_exports));
|
|
21876
|
+
return { map: setupMap2(description, context).toPrepared() };
|
|
21877
|
+
}
|
|
21878
|
+
};
|
|
21879
|
+
async function prepareProjection(state, options) {
|
|
21880
|
+
const key2 = JSON.stringify(options);
|
|
21881
|
+
if (!state.projection || state.key !== key2) {
|
|
21882
|
+
const { FullProjectionEngine: FullProjectionEngine2 } = await Promise.resolve().then(() => (init_projection(), projection_exports));
|
|
21883
|
+
const projection = new FullProjectionEngine2().createProjection(options);
|
|
21884
|
+
state.projection = projection;
|
|
21885
|
+
state.key = key2;
|
|
21886
|
+
}
|
|
21887
|
+
}
|
|
21888
|
+
|
|
21889
|
+
// dist/tasks/index.js
|
|
21841
21890
|
var import_meta = {};
|
|
21891
|
+
var _a2, _b;
|
|
21892
|
+
var isBrowser = !((_b = (_a2 = globalThis.process) == null ? void 0 : _a2.versions) == null ? void 0 : _b.node);
|
|
21842
21893
|
var path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
21843
21894
|
var moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
21844
|
-
var
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
}
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
id: "map-setup",
|
|
21853
|
-
name: "Map setup",
|
|
21854
|
-
process: async (input, _options, context) => (await Promise.resolve().then(() => (init_operations(), operations_exports))).setupMap(input, context || {}).toPrepared(),
|
|
21855
|
-
worker: new URL("./map-worker.js", moduleUrl).href,
|
|
21856
|
-
loadWorker: () => new Worker(new URL("./map-worker.js", import_meta.url), { type: "module" })
|
|
21895
|
+
var ProjectCoordinatesTask2 = {
|
|
21896
|
+
...ProjectCoordinatesTask,
|
|
21897
|
+
worker: {
|
|
21898
|
+
...!isBrowser ? { url: /* @__PURE__ */ (() => new URL("./projection-worker.js", moduleUrl).href)() } : {
|
|
21899
|
+
create: () => new Worker(new URL("./projection-worker.js", import_meta.url), { type: "module" })
|
|
21900
|
+
},
|
|
21901
|
+
capabilities: { atomic: true, streaming: true }
|
|
21902
|
+
}
|
|
21857
21903
|
};
|
|
21858
|
-
var
|
|
21859
|
-
...
|
|
21860
|
-
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
loadWorker: () => new Worker(new URL("./projection-worker.js", import_meta.url), { type: "module" })
|
|
21904
|
+
var PrepareMapTask2 = {
|
|
21905
|
+
...PrepareMapTask,
|
|
21906
|
+
worker: {
|
|
21907
|
+
...!isBrowser ? { url: /* @__PURE__ */ (() => new URL("./map-worker.js", moduleUrl).href)() } : { create: () => new Worker(new URL("./map-worker.js", import_meta.url), { type: "module" }) },
|
|
21908
|
+
capabilities: { atomic: true, streaming: false }
|
|
21909
|
+
}
|
|
21865
21910
|
};
|
|
21866
|
-
function setupMapInWorker(description, options = {}) {
|
|
21867
|
-
return (0, import_worker_utils.processOnWorker)(MapSetupWorker, description, { inputOwnership: "copy", ...options });
|
|
21868
|
-
}
|
|
21869
|
-
function projectBulkInWorker(input, options = {}) {
|
|
21870
|
-
return (0, import_worker_utils.processOnWorker)(BulkProjectionWorker, input, {
|
|
21871
|
-
inputOwnership: "copy",
|
|
21872
|
-
...options
|
|
21873
|
-
});
|
|
21874
|
-
}
|
|
21875
21911
|
//# sourceMappingURL=index.cjs.map
|