@math.gl/geospatial 5.0.0-rc.2 → 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
|
@@ -187,30 +187,6 @@ var init_proj_string = __esm({
|
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
-
// dist/projection/experimental/crs/types.js
|
|
191
|
-
function unsupportedStage(message) {
|
|
192
|
-
throw new TypeScriptCRSError("missing-transform-stage", message);
|
|
193
|
-
}
|
|
194
|
-
var _a, CRS_ERROR, TypeScriptCRSError;
|
|
195
|
-
var init_types = __esm({
|
|
196
|
-
"dist/projection/experimental/crs/types.js"() {
|
|
197
|
-
CRS_ERROR = /* @__PURE__ */ Symbol.for("@math.gl/projection/TypeScriptCRSError");
|
|
198
|
-
TypeScriptCRSError = class _TypeScriptCRSError extends Error {
|
|
199
|
-
static [(_a = CRS_ERROR, Symbol.hasInstance)](value) {
|
|
200
|
-
if (this !== _TypeScriptCRSError)
|
|
201
|
-
return Function.prototype[Symbol.hasInstance].call(this, value);
|
|
202
|
-
return value instanceof Error && value[CRS_ERROR] === true;
|
|
203
|
-
}
|
|
204
|
-
constructor(reason, message) {
|
|
205
|
-
super(message);
|
|
206
|
-
this.reason = reason;
|
|
207
|
-
this[_a] = true;
|
|
208
|
-
this.name = "TypeScriptCRSError";
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
|
|
214
190
|
// dist/projection/experimental/crs/spatial-reference.js
|
|
215
191
|
function resolveCRSInput(input, options) {
|
|
216
192
|
if (typeof input === "string" || "type" in input)
|
|
@@ -219,19 +195,19 @@ function resolveCRSInput(input, options) {
|
|
|
219
195
|
const spatialReference = "crs" in metadata ? metadata : void 0;
|
|
220
196
|
const reference = "crs" in metadata ? metadata.crs : metadata;
|
|
221
197
|
if (reference.state !== "explicit" && reference.state !== "default")
|
|
222
|
-
throw new TypeScriptCRSError("unknown-syntax", "Cannot transform an " + reference.state + " CRS reference");
|
|
198
|
+
throw new import_types.TypeScriptCRSError("unknown-syntax", "Cannot transform an " + reference.state + " CRS reference");
|
|
223
199
|
let lossy = false;
|
|
224
200
|
if ((spatialReference == null ? void 0 : spatialReference.coordinateEpoch) !== void 0)
|
|
225
|
-
unsupportedStage("Coordinate epochs require a time-dependent transformation");
|
|
201
|
+
(0, import_types.unsupportedStage)("Coordinate epochs require a time-dependent transformation");
|
|
226
202
|
if ((spatialReference == null ? void 0 : spatialReference.vertical) && spatialReference.vertical.state !== "absent") {
|
|
227
203
|
if (options.mode !== "horizontal")
|
|
228
|
-
unsupportedStage("A separately declared vertical CRS requires explicit horizontal extraction");
|
|
204
|
+
(0, import_types.unsupportedStage)("A separately declared vertical CRS requires explicit horizontal extraction");
|
|
229
205
|
lossy = true;
|
|
230
206
|
}
|
|
231
207
|
return { definition: reference.definition, spatialReference, lossy };
|
|
232
208
|
}
|
|
233
209
|
function applySpatialReference(crs, reference) {
|
|
234
|
-
var
|
|
210
|
+
var _a;
|
|
235
211
|
if (!reference)
|
|
236
212
|
return crs;
|
|
237
213
|
if (reference.coordinateFrame !== "unknown" && reference.coordinateFrame !== crs.kind)
|
|
@@ -256,11 +232,11 @@ function applySpatialReference(crs, reference) {
|
|
|
256
232
|
if (storedAxis.length === 2)
|
|
257
233
|
storedAxis += "u";
|
|
258
234
|
if (storedAxis.length !== 3 || !storedAxis.includes("e") || !storedAxis.includes("n") || !storedAxis.includes("u"))
|
|
259
|
-
unsupportedStage("Unsupported SpatialReference coordinate order");
|
|
235
|
+
(0, import_types.unsupportedStage)("Unsupported SpatialReference coordinate order");
|
|
260
236
|
if (order.length > 4 || order.length > 3 && !["m", "measure"].includes(order[3]))
|
|
261
|
-
unsupportedStage("Unsupported fourth coordinate component");
|
|
237
|
+
(0, import_types.unsupportedStage)("Unsupported fourth coordinate component");
|
|
262
238
|
}
|
|
263
|
-
if ((
|
|
239
|
+
if ((_a = reference.units) == null ? void 0 : _a.length) {
|
|
264
240
|
const units = {
|
|
265
241
|
m: 1,
|
|
266
242
|
meter: 1,
|
|
@@ -280,14 +256,15 @@ function applySpatialReference(crs, reference) {
|
|
|
280
256
|
const vertical = (storedAxis || "enu")[i] === "u";
|
|
281
257
|
const expected = crs.kind === "geocentric" ? crs.toMeter : vertical ? crs.verticalUnit : crs.kind === "geographic" ? crs.angularUnit : crs.toMeter;
|
|
282
258
|
if (Math.abs((units[reference.units[i]] ?? NaN) - expected) > 1e-12 || units[reference.units[i]] === void 0)
|
|
283
|
-
unsupportedStage("SpatialReference units disagree with its CRS");
|
|
259
|
+
(0, import_types.unsupportedStage)("SpatialReference units disagree with its CRS");
|
|
284
260
|
}
|
|
285
261
|
}
|
|
286
262
|
return Object.freeze({ ...crs, storedAxis });
|
|
287
263
|
}
|
|
264
|
+
var import_types;
|
|
288
265
|
var init_spatial_reference2 = __esm({
|
|
289
266
|
"dist/projection/experimental/crs/spatial-reference.js"() {
|
|
290
|
-
|
|
267
|
+
import_types = require("./../crs/types.shared.cjs");
|
|
291
268
|
}
|
|
292
269
|
});
|
|
293
270
|
|
|
@@ -304,12 +281,6 @@ function numberParameter(parameters, name, fallback) {
|
|
|
304
281
|
throw new Error(`Invalid numeric PROJ parameter: +${name}`);
|
|
305
282
|
return number;
|
|
306
283
|
}
|
|
307
|
-
function wrapLongitude(longitude, over = false) {
|
|
308
|
-
if (over || Math.abs(longitude) <= Math.PI)
|
|
309
|
-
return longitude;
|
|
310
|
-
const circle = 2 * Math.PI;
|
|
311
|
-
return ((longitude + Math.PI) % circle + circle) % circle - Math.PI;
|
|
312
|
-
}
|
|
313
284
|
var DEGREES_TO_RADIANS;
|
|
314
285
|
var init_parameters = __esm({
|
|
315
286
|
"dist/projection/experimental/parameters.js"() {
|
|
@@ -319,8 +290,8 @@ var init_parameters = __esm({
|
|
|
319
290
|
|
|
320
291
|
// dist/projection/experimental/crs/datum-catalog.js
|
|
321
292
|
function getDatumDefinitions(options) {
|
|
322
|
-
var
|
|
323
|
-
if (!((
|
|
293
|
+
var _a;
|
|
294
|
+
if (!((_a = options.datumCatalogs) == null ? void 0 : _a.length))
|
|
324
295
|
return builtins;
|
|
325
296
|
const cached = resolved.get(options);
|
|
326
297
|
if ((cached == null ? void 0 : cached.catalogs) === options.datumCatalogs)
|
|
@@ -718,7 +689,7 @@ function resolveLocalCRSDefinition(input, options = {}) {
|
|
|
718
689
|
return definition;
|
|
719
690
|
}
|
|
720
691
|
function normalizeCRS(input, options = {}) {
|
|
721
|
-
var
|
|
692
|
+
var _a;
|
|
722
693
|
const datums = getDatumDefinitions(options);
|
|
723
694
|
const resolved2 = resolveCRSInput(input, options);
|
|
724
695
|
const definition = resolveLocalCRSDefinition(resolved2.definition, options);
|
|
@@ -732,10 +703,10 @@ function normalizeCRS(input, options = {}) {
|
|
|
732
703
|
}
|
|
733
704
|
parsed = { parameters: parameters2 };
|
|
734
705
|
} else {
|
|
735
|
-
const parser = (
|
|
706
|
+
const parser = (_a = options.parsers) == null ? void 0 : _a.find((candidate) => candidate.canParse(definition));
|
|
736
707
|
if (!parser) {
|
|
737
708
|
const serialized = ["wkt", "projjson"].includes(inferCRSRepresentation(definition));
|
|
738
|
-
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");
|
|
709
|
+
throw new import_types2.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");
|
|
739
710
|
}
|
|
740
711
|
parsed = parser.parse(definition, options);
|
|
741
712
|
}
|
|
@@ -776,7 +747,7 @@ function normalizeCRS(input, options = {}) {
|
|
|
776
747
|
const datumName = parameters["datum"];
|
|
777
748
|
const datum = datumName && datumName !== "none" ? lookup(datums, datumName) : void 0;
|
|
778
749
|
if (datumName && datumName !== "none" && !datum)
|
|
779
|
-
unsupportedStage("Unknown datum: " + datumName + "; register a datumCatalogs plugin");
|
|
750
|
+
(0, import_types2.unsupportedStage)("Unknown datum: " + datumName + "; register a datumCatalogs plugin");
|
|
780
751
|
const ellipsoid = getEllipsoid(parameters, datum == null ? void 0 : datum.ellipse);
|
|
781
752
|
const grids = parameters["nadgrids"] ?? (datum == null ? void 0 : datum.nadgrids);
|
|
782
753
|
const gridReferences = grids === void 0 ? void 0 : grids.split(",").map((entry) => {
|
|
@@ -865,7 +836,7 @@ function getEllipsoid(parameters, datumEllipsoid) {
|
|
|
865
836
|
eccentricitySquared: radius ? 0 : 1 - (b / a) ** 2
|
|
866
837
|
});
|
|
867
838
|
}
|
|
868
|
-
var ALIASES, CORE_PARAMETERS,
|
|
839
|
+
var import_types2, ALIASES, CORE_PARAMETERS, own, keyOf;
|
|
869
840
|
var init_normalize = __esm({
|
|
870
841
|
"dist/projection/experimental/crs/normalize.js"() {
|
|
871
842
|
init_spatial_reference();
|
|
@@ -876,7 +847,7 @@ var init_normalize = __esm({
|
|
|
876
847
|
init_ellipsoid_table();
|
|
877
848
|
init_primemeridian_table();
|
|
878
849
|
init_crs_metadata();
|
|
879
|
-
|
|
850
|
+
import_types2 = require("./../crs/types.shared.cjs");
|
|
880
851
|
ALIASES = {
|
|
881
852
|
WGS84: "+proj=longlat +datum=WGS84",
|
|
882
853
|
"EPSG:4326": "+proj=longlat +datum=WGS84",
|
|
@@ -913,7 +884,6 @@ var init_normalize = __esm({
|
|
|
913
884
|
"over",
|
|
914
885
|
"lon_wrap"
|
|
915
886
|
];
|
|
916
|
-
CORE_FLAGS = ["no_defs", "over"];
|
|
917
887
|
own = (object, key2) => Object.prototype.hasOwnProperty.call(object, key2);
|
|
918
888
|
keyOf = (value) => value.toLowerCase().replace(/[\s_-]/g, "");
|
|
919
889
|
}
|
|
@@ -938,12 +908,12 @@ async function prepareEngineOptions(options) {
|
|
|
938
908
|
return { ...captured, from, to };
|
|
939
909
|
}
|
|
940
910
|
async function prepareCRSInput(captured, options) {
|
|
941
|
-
var
|
|
911
|
+
var _a;
|
|
942
912
|
const source = resolveCRSInput(captured, options);
|
|
943
913
|
const local = resolveLocalCRSDefinition(source.definition, options);
|
|
944
914
|
const reference = typeof captured === "string" || "type" in captured ? void 0 : "crs" in captured ? captured.crs : captured;
|
|
945
915
|
const representation = local === source.definition && reference ? reference.representation : inferCRSRepresentation(local);
|
|
946
|
-
if (representation !== "identifier" || ((
|
|
916
|
+
if (representation !== "identifier" || ((_a = options.parsers) == null ? void 0 : _a.some((p) => p.canParse(local)))) {
|
|
947
917
|
return captured;
|
|
948
918
|
}
|
|
949
919
|
const result = await options.resolver.resolve({
|
|
@@ -1029,10 +999,6 @@ function cache() {
|
|
|
1029
999
|
scope[CACHE_KEY] || (scope[CACHE_KEY] = /* @__PURE__ */ new WeakMap());
|
|
1030
1000
|
return scope[CACHE_KEY];
|
|
1031
1001
|
}
|
|
1032
|
-
function getLoadedProjection(projection) {
|
|
1033
|
-
var _a2;
|
|
1034
|
-
return "create" in projection ? projection : (_a2 = cache().get(projection)) == null ? void 0 : _a2.implementation;
|
|
1035
|
-
}
|
|
1036
1002
|
function preloadProjection(projection) {
|
|
1037
1003
|
if ("create" in projection)
|
|
1038
1004
|
return Promise.resolve(projection);
|
|
@@ -1078,7 +1044,7 @@ var lazyMercator = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1078
1044
|
"Mercator_Variant_A"
|
|
1079
1045
|
]
|
|
1080
1046
|
}, async () => {
|
|
1081
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1047
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-merc");
|
|
1082
1048
|
return projectionModule.mercator;
|
|
1083
1049
|
});
|
|
1084
1050
|
|
|
@@ -1086,7 +1052,7 @@ var lazyMercator = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1086
1052
|
var lazyEquidistantCylindrical = /* @__PURE__ */ createProjectionDescriptor({
|
|
1087
1053
|
name: "eqc",
|
|
1088
1054
|
aliases: ["Equirectangular", "Equidistant_Cylindrical", "Equidistant_Cylindrical_Spherical"]
|
|
1089
|
-
}, async () => (await import("@math.gl/geospatial/projection
|
|
1055
|
+
}, async () => (await import("@math.gl/geospatial/projection-projections-eqc")).equidistantCylindrical);
|
|
1090
1056
|
|
|
1091
1057
|
// dist/projection/experimental/lazy-projections/lcc.js
|
|
1092
1058
|
var lazyLambertConformalConic = /* @__PURE__ */ createProjectionDescriptor({
|
|
@@ -1099,22 +1065,22 @@ var lazyLambertConformalConic = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1099
1065
|
"Lambert Conic Conformal (1SP)",
|
|
1100
1066
|
"Lambert Conic Conformal (2SP)"
|
|
1101
1067
|
]
|
|
1102
|
-
}, async () => (await import("@math.gl/geospatial/projection
|
|
1068
|
+
}, async () => (await import("@math.gl/geospatial/projection-projections-lcc")).lambertConformalConic);
|
|
1103
1069
|
|
|
1104
1070
|
// dist/projection/experimental/lazy-projections/aea.js
|
|
1105
1071
|
var lazyAlbersEqualArea = /* @__PURE__ */ createProjectionDescriptor({ name: "aea", aliases: ["Albers_Conic_Equal_Area", "Albers_Equal_Area", "Albers"] }, async () => {
|
|
1106
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1072
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-aea");
|
|
1107
1073
|
return projectionModule.albersEqualArea;
|
|
1108
1074
|
});
|
|
1109
1075
|
|
|
1110
1076
|
// dist/projection/experimental/lazy-projections/eqdc.js
|
|
1111
1077
|
var lazyEquidistantConic = /* @__PURE__ */ createProjectionDescriptor({ name: "eqdc", aliases: ["Equidistant_Conic"] }, async () => {
|
|
1112
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1078
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-eqdc");
|
|
1113
1079
|
return projectionModule.equidistantConic;
|
|
1114
1080
|
});
|
|
1115
1081
|
|
|
1116
1082
|
// dist/projection/experimental/lazy-projections/laea.js
|
|
1117
|
-
var lazyLambertAzimuthalEqualArea = /* @__PURE__ */ createProjectionDescriptor({ name: "laea", aliases: ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area"] }, async () => (await import("@math.gl/geospatial/projection
|
|
1083
|
+
var lazyLambertAzimuthalEqualArea = /* @__PURE__ */ createProjectionDescriptor({ name: "laea", aliases: ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area"] }, async () => (await import("@math.gl/geospatial/projection-projections-laea")).lambertAzimuthalEqualArea);
|
|
1118
1084
|
|
|
1119
1085
|
// dist/projection/experimental/lazy-projections/stere.js
|
|
1120
1086
|
var lazyStereographic = /* @__PURE__ */ createProjectionDescriptor({
|
|
@@ -1126,7 +1092,7 @@ var lazyStereographic = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1126
1092
|
"Polar_Stereographic"
|
|
1127
1093
|
]
|
|
1128
1094
|
}, async () => {
|
|
1129
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1095
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-stere");
|
|
1130
1096
|
return projectionModule.stereographic;
|
|
1131
1097
|
});
|
|
1132
1098
|
|
|
@@ -1139,10 +1105,10 @@ var lazyObliqueStereographic = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1139
1105
|
"Oblique Stereographic Alternative",
|
|
1140
1106
|
"Double_Stereographic"
|
|
1141
1107
|
]
|
|
1142
|
-
}, async () => (await import("@math.gl/geospatial/projection
|
|
1108
|
+
}, async () => (await import("@math.gl/geospatial/projection-projections-sterea")).obliqueStereographic);
|
|
1143
1109
|
|
|
1144
1110
|
// dist/projection/experimental/lazy-projections/aeqd.js
|
|
1145
|
-
var lazyAzimuthalEquidistant = /* @__PURE__ */ createProjectionDescriptor({ name: "aeqd", aliases: ["Azimuthal_Equidistant"] }, async () => (await import("@math.gl/geospatial/projection
|
|
1111
|
+
var lazyAzimuthalEquidistant = /* @__PURE__ */ createProjectionDescriptor({ name: "aeqd", aliases: ["Azimuthal_Equidistant"] }, async () => (await import("@math.gl/geospatial/projection-projections-aeqd")).azimuthalEquidistant);
|
|
1146
1112
|
|
|
1147
1113
|
// dist/projection/experimental/lazy-projections/tmerc.js
|
|
1148
1114
|
var lazyTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({
|
|
@@ -1155,67 +1121,67 @@ var lazyTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1155
1121
|
"Gauss Kruger",
|
|
1156
1122
|
"Gauss_Kruger"
|
|
1157
1123
|
]
|
|
1158
|
-
}, async () => (await import("@math.gl/geospatial/projection
|
|
1124
|
+
}, async () => (await import("@math.gl/geospatial/projection-projections-tmerc")).transverseMercator);
|
|
1159
1125
|
|
|
1160
1126
|
// dist/projection/experimental/lazy-projections/etmerc.js
|
|
1161
|
-
var lazyExtendedTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "etmerc", aliases: ["Extended_Transverse_Mercator", "Extended Transverse Mercator"] }, async () => (await import("@math.gl/geospatial/projection
|
|
1127
|
+
var lazyExtendedTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "etmerc", aliases: ["Extended_Transverse_Mercator", "Extended Transverse Mercator"] }, async () => (await import("@math.gl/geospatial/projection-projections-etmerc")).extendedTransverseMercator);
|
|
1162
1128
|
|
|
1163
1129
|
// dist/projection/experimental/lazy-projections/utm.js
|
|
1164
|
-
var lazyUniversalTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "utm", aliases: ["Universal Transverse Mercator System"] }, async () => (await import("@math.gl/geospatial/projection
|
|
1130
|
+
var lazyUniversalTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "utm", aliases: ["Universal Transverse Mercator System"] }, async () => (await import("@math.gl/geospatial/projection-projections-utm")).universalTransverseMercator);
|
|
1165
1131
|
|
|
1166
1132
|
// dist/projection/experimental/lazy-projections/geocent.js
|
|
1167
1133
|
var lazyGeocentric = /* @__PURE__ */ createProjectionDescriptor({ name: "geocent", aliases: ["Geocentric", "geocentric", "Geocent"] }, async () => {
|
|
1168
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1134
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-geocent");
|
|
1169
1135
|
return projectionModule.geocentric;
|
|
1170
1136
|
});
|
|
1171
1137
|
|
|
1172
1138
|
// dist/projection/experimental/lazy-projections/bonne.js
|
|
1173
1139
|
var lazyBonne = /* @__PURE__ */ createProjectionDescriptor({ name: "bonne", aliases: ["Bonne (Werner lat_1=90)"] }, async () => {
|
|
1174
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1140
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-bonne");
|
|
1175
1141
|
return projectionModule.bonne;
|
|
1176
1142
|
});
|
|
1177
1143
|
|
|
1178
1144
|
// dist/projection/experimental/lazy-projections/cass.js
|
|
1179
1145
|
var lazyCassiniSoldner = /* @__PURE__ */ createProjectionDescriptor({ name: "cass", aliases: ["Cassini", "Cassini_Soldner"] }, async () => {
|
|
1180
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1146
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-cass");
|
|
1181
1147
|
return projectionModule.cassiniSoldner;
|
|
1182
1148
|
});
|
|
1183
1149
|
|
|
1184
1150
|
// dist/projection/experimental/lazy-projections/cea.js
|
|
1185
|
-
var lazyCylindricalEqualArea = /* @__PURE__ */ createProjectionDescriptor({ name: "cea", aliases: [] }, async () => (await import("@math.gl/geospatial/projection
|
|
1151
|
+
var lazyCylindricalEqualArea = /* @__PURE__ */ createProjectionDescriptor({ name: "cea", aliases: [] }, async () => (await import("@math.gl/geospatial/projection-projections-cea")).cylindricalEqualArea);
|
|
1186
1152
|
|
|
1187
1153
|
// dist/projection/experimental/lazy-projections/eck6.js
|
|
1188
1154
|
var lazyEckertVI = /* @__PURE__ */ createProjectionDescriptor({ name: "eck6", aliases: ["Eckert_VI"] }, async () => {
|
|
1189
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1155
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-eck6");
|
|
1190
1156
|
return projectionModule.eckertVI;
|
|
1191
1157
|
});
|
|
1192
1158
|
|
|
1193
1159
|
// dist/projection/experimental/lazy-projections/eqearth.js
|
|
1194
1160
|
var lazyEqualEarth = /* @__PURE__ */ createProjectionDescriptor({ name: "eqearth", aliases: ["Equal Earth", "Equal_Earth"] }, async () => {
|
|
1195
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1161
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-eqearth");
|
|
1196
1162
|
return projectionModule.equalEarth;
|
|
1197
1163
|
});
|
|
1198
1164
|
|
|
1199
1165
|
// dist/projection/experimental/lazy-projections/equi.js
|
|
1200
1166
|
var lazyEquirectangular = /* @__PURE__ */ createProjectionDescriptor({ name: "equi", aliases: [] }, async () => {
|
|
1201
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1167
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-equi");
|
|
1202
1168
|
return projectionModule.equirectangular;
|
|
1203
1169
|
});
|
|
1204
1170
|
|
|
1205
1171
|
// dist/projection/experimental/lazy-projections/geos.js
|
|
1206
1172
|
var lazyGeostationary = /* @__PURE__ */ createProjectionDescriptor({ name: "geos", aliases: ["Geostationary Satellite View", "Geostationary_Satellite"] }, async () => {
|
|
1207
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1173
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-geos");
|
|
1208
1174
|
return projectionModule.geostationary;
|
|
1209
1175
|
});
|
|
1210
1176
|
|
|
1211
1177
|
// dist/projection/experimental/lazy-projections/gnom.js
|
|
1212
1178
|
var lazyGnomonic = /* @__PURE__ */ createProjectionDescriptor({ name: "gnom", aliases: [] }, async () => {
|
|
1213
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1179
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-gnom");
|
|
1214
1180
|
return projectionModule.gnomonic;
|
|
1215
1181
|
});
|
|
1216
1182
|
|
|
1217
1183
|
// dist/projection/experimental/lazy-projections/gstmerc.js
|
|
1218
|
-
var lazyGaussSchreiberTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "gstmerc", aliases: ["gstmerg"] }, async () => (await import("@math.gl/geospatial/projection
|
|
1184
|
+
var lazyGaussSchreiberTransverseMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "gstmerc", aliases: ["gstmerg"] }, async () => (await import("@math.gl/geospatial/projection-projections-gstmerc")).gaussSchreiberTransverseMercator);
|
|
1219
1185
|
|
|
1220
1186
|
// dist/projection/experimental/lazy-projections/krovak.js
|
|
1221
1187
|
var lazyKrovak = /* @__PURE__ */ createProjectionDescriptor({
|
|
@@ -1227,25 +1193,25 @@ var lazyKrovak = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1227
1193
|
"Krovak Modified (North Orientated)"
|
|
1228
1194
|
]
|
|
1229
1195
|
}, async () => {
|
|
1230
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1196
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-krovak");
|
|
1231
1197
|
return projectionModule.krovak;
|
|
1232
1198
|
});
|
|
1233
1199
|
|
|
1234
1200
|
// dist/projection/experimental/lazy-projections/mill.js
|
|
1235
1201
|
var lazyMillerCylindrical = /* @__PURE__ */ createProjectionDescriptor({ name: "mill", aliases: ["Miller_Cylindrical"] }, async () => {
|
|
1236
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1202
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-mill");
|
|
1237
1203
|
return projectionModule.millerCylindrical;
|
|
1238
1204
|
});
|
|
1239
1205
|
|
|
1240
1206
|
// dist/projection/experimental/lazy-projections/moll.js
|
|
1241
1207
|
var lazyMollweide = /* @__PURE__ */ createProjectionDescriptor({ name: "moll", aliases: ["Mollweide"] }, async () => {
|
|
1242
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1208
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-moll");
|
|
1243
1209
|
return projectionModule.mollweide;
|
|
1244
1210
|
});
|
|
1245
1211
|
|
|
1246
1212
|
// dist/projection/experimental/lazy-projections/nzmg.js
|
|
1247
1213
|
var lazyNewZealandMapGrid = /* @__PURE__ */ createProjectionDescriptor({ name: "nzmg", aliases: ["New_Zealand_Map_Grid"] }, async () => {
|
|
1248
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1214
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-nzmg");
|
|
1249
1215
|
return projectionModule.newZealandMapGrid;
|
|
1250
1216
|
});
|
|
1251
1217
|
|
|
@@ -1263,19 +1229,19 @@ var lazyObliqueMercator = /* @__PURE__ */ createProjectionDescriptor({
|
|
|
1263
1229
|
"Oblique_Mercator"
|
|
1264
1230
|
]
|
|
1265
1231
|
}, async () => {
|
|
1266
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1232
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-omerc");
|
|
1267
1233
|
return projectionModule.obliqueMercator;
|
|
1268
1234
|
});
|
|
1269
1235
|
|
|
1270
1236
|
// dist/projection/experimental/lazy-projections/ortho.js
|
|
1271
1237
|
var lazyOrthographic = /* @__PURE__ */ createProjectionDescriptor({ name: "ortho", aliases: [] }, async () => {
|
|
1272
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1238
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-ortho");
|
|
1273
1239
|
return projectionModule.orthographic;
|
|
1274
1240
|
});
|
|
1275
1241
|
|
|
1276
1242
|
// dist/projection/experimental/lazy-projections/poly.js
|
|
1277
1243
|
var lazyPolyconic = /* @__PURE__ */ createProjectionDescriptor({ name: "poly", aliases: ["Polyconic", "American_Polyconic"] }, async () => {
|
|
1278
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1244
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-poly");
|
|
1279
1245
|
return projectionModule.polyconic;
|
|
1280
1246
|
});
|
|
1281
1247
|
|
|
@@ -1283,32 +1249,32 @@ var lazyPolyconic = /* @__PURE__ */ createProjectionDescriptor({ name: "poly", a
|
|
|
1283
1249
|
var lazyQuadrilateralizedSphericalCube = /* @__PURE__ */ createProjectionDescriptor({
|
|
1284
1250
|
name: "qsc",
|
|
1285
1251
|
aliases: ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube"]
|
|
1286
|
-
}, async () => (await import("@math.gl/geospatial/projection
|
|
1252
|
+
}, async () => (await import("@math.gl/geospatial/projection-projections-qsc")).quadrilateralizedSphericalCube);
|
|
1287
1253
|
|
|
1288
1254
|
// dist/projection/experimental/lazy-projections/robin.js
|
|
1289
1255
|
var lazyRobinson = /* @__PURE__ */ createProjectionDescriptor({ name: "robin", aliases: ["Robinson"] }, async () => {
|
|
1290
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1256
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-robin");
|
|
1291
1257
|
return projectionModule.robinson;
|
|
1292
1258
|
});
|
|
1293
1259
|
|
|
1294
1260
|
// dist/projection/experimental/lazy-projections/sinu.js
|
|
1295
1261
|
var lazySinusoidal = /* @__PURE__ */ createProjectionDescriptor({ name: "sinu", aliases: ["Sinusoidal"] }, async () => {
|
|
1296
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1262
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-sinu");
|
|
1297
1263
|
return projectionModule.sinusoidal;
|
|
1298
1264
|
});
|
|
1299
1265
|
|
|
1300
1266
|
// dist/projection/experimental/lazy-projections/somerc.js
|
|
1301
|
-
var lazySwissObliqueMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "somerc", aliases: [] }, async () => (await import("@math.gl/geospatial/projection
|
|
1267
|
+
var lazySwissObliqueMercator = /* @__PURE__ */ createProjectionDescriptor({ name: "somerc", aliases: [] }, async () => (await import("@math.gl/geospatial/projection-projections-somerc")).swissObliqueMercator);
|
|
1302
1268
|
|
|
1303
1269
|
// dist/projection/experimental/lazy-projections/tpers.js
|
|
1304
1270
|
var lazyTiltedPerspective = /* @__PURE__ */ createProjectionDescriptor({ name: "tpers", aliases: ["Tilted_Perspective"] }, async () => {
|
|
1305
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1271
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-tpers");
|
|
1306
1272
|
return projectionModule.tiltedPerspective;
|
|
1307
1273
|
});
|
|
1308
1274
|
|
|
1309
1275
|
// dist/projection/experimental/lazy-projections/vandg.js
|
|
1310
1276
|
var lazyVanDerGrinten = /* @__PURE__ */ createProjectionDescriptor({ name: "vandg", aliases: ["Van_der_Grinten_I", "VanDerGrinten", "Van_der_Grinten"] }, async () => {
|
|
1311
|
-
const projectionModule = await import("@math.gl/geospatial/projection
|
|
1277
|
+
const projectionModule = await import("@math.gl/geospatial/projection-projections-vandg");
|
|
1312
1278
|
return projectionModule.vanDerGrinten;
|
|
1313
1279
|
});
|
|
1314
1280
|
|
|
@@ -1319,7 +1285,7 @@ function lazyObliqueTransformation(wrapped) {
|
|
|
1319
1285
|
aliases: ["General Oblique Transformation", "General_Oblique_Transformation"]
|
|
1320
1286
|
}, async () => {
|
|
1321
1287
|
const [{ obliqueTransformation }, child] = await Promise.all([
|
|
1322
|
-
import("@math.gl/geospatial/projection
|
|
1288
|
+
import("@math.gl/geospatial/projection-projections-ob_tran"),
|
|
1323
1289
|
typeof wrapped === "string" || "create" in wrapped ? wrapped : wrapped.preload()
|
|
1324
1290
|
]);
|
|
1325
1291
|
return obliqueTransformation(child);
|
|
@@ -1626,817 +1592,8 @@ function getUnit(factor, angular) {
|
|
|
1626
1592
|
return angular ? { name, degreesPerUnit: factor / ANGULAR_UNITS["degrees"] } : { name, metersPerUnit: factor };
|
|
1627
1593
|
}
|
|
1628
1594
|
|
|
1629
|
-
// dist/projection/experimental/
|
|
1630
|
-
var
|
|
1631
|
-
function createAngularRanges(west, south, east, north) {
|
|
1632
|
-
return [
|
|
1633
|
-
[west, south],
|
|
1634
|
-
[east, north]
|
|
1635
|
-
];
|
|
1636
|
-
}
|
|
1637
|
-
function normalizeLongitude(longitude) {
|
|
1638
|
-
return longitude >= -180 && longitude < 180 ? longitude : ((longitude + 180) % 360 + 360) % 360 - 180;
|
|
1639
|
-
}
|
|
1640
|
-
function getLongitudeSpan(bounds) {
|
|
1641
|
-
const span = bounds[2] - bounds[0];
|
|
1642
|
-
return span < 0 ? span + 360 : span;
|
|
1643
|
-
}
|
|
1644
|
-
function containsGeographicPoint(bounds, point) {
|
|
1645
|
-
const [west, south, east, north] = bounds;
|
|
1646
|
-
const longitude = normalizeLongitude(point[0]);
|
|
1647
|
-
return point[1] >= south && point[1] <= north && (west <= east ? longitude >= west && longitude <= east || longitude === -180 && east === 180 : longitude >= west || longitude <= east);
|
|
1648
|
-
}
|
|
1649
|
-
function clampGeographicPoint(bounds, point) {
|
|
1650
|
-
let longitude = normalizeLongitude(point[0]);
|
|
1651
|
-
const latitude = Math.max(bounds[1], Math.min(bounds[3], point[1]));
|
|
1652
|
-
if (!containsGeographicPoint(bounds, [longitude, latitude])) {
|
|
1653
|
-
const westDistance = Math.abs(normalizeLongitude(longitude - bounds[0]));
|
|
1654
|
-
const eastDistance = Math.abs(normalizeLongitude(longitude - bounds[2]));
|
|
1655
|
-
longitude = westDistance <= eastDistance ? bounds[0] : bounds[2];
|
|
1656
|
-
}
|
|
1657
|
-
return [longitude, latitude];
|
|
1658
|
-
}
|
|
1659
|
-
function getAngularRanges(bounds, primeMeridian2 = 0, origin = 0) {
|
|
1660
|
-
const width = getLongitudeSpan(bounds);
|
|
1661
|
-
const west = bounds[0] * RADIANS2 - primeMeridian2;
|
|
1662
|
-
const middle = west + width * RADIANS2 / 2;
|
|
1663
|
-
const shift = Math.round((origin - middle) / (2 * Math.PI)) * 2 * Math.PI;
|
|
1664
|
-
return createAngularRanges(width === 360 ? origin - Math.PI : west + shift, bounds[1] * RADIANS2, width === 360 ? origin + Math.PI : west + shift + width * RADIANS2, bounds[3] * RADIANS2);
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
// dist/projection/experimental/rendering-profile/rendering-profile.js
|
|
1668
|
-
function resolveRenderingProfile(getRenderingProfile, coverage) {
|
|
1669
|
-
if (coverage) {
|
|
1670
|
-
try {
|
|
1671
|
-
const profile2 = getRenderingProfile(coverage);
|
|
1672
|
-
return resolveBounds(profile2);
|
|
1673
|
-
} catch {
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
const profile = getRenderingProfile();
|
|
1677
|
-
return resolveBounds(profile);
|
|
1678
|
-
}
|
|
1679
|
-
function resolveBounds(profile) {
|
|
1680
|
-
var _a2;
|
|
1681
|
-
const bounds = profile.bounds;
|
|
1682
|
-
if (bounds.some((corner) => corner.some((value) => !Number.isFinite(value))))
|
|
1683
|
-
throw new Error("Projection rendering bounds must be finite");
|
|
1684
|
-
return { bounds, normalize: (_a2 = profile.normalize) == null ? void 0 : _a2.bind(profile) };
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
// dist/projection/experimental/rendering-profile/identity-rendering-profile.js
|
|
1688
|
-
function getIdentityRenderingProfile() {
|
|
1689
|
-
return {
|
|
1690
|
-
bounds: [
|
|
1691
|
-
[-1, -1, 0],
|
|
1692
|
-
[1, 1, 0]
|
|
1693
|
-
]
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
// dist/projection/experimental/projection-scratch.js
|
|
1698
|
-
function createPoint() {
|
|
1699
|
-
return { x: 0, y: 0, z: 0 };
|
|
1700
|
-
}
|
|
1701
|
-
var ProjectionScratch = class {
|
|
1702
|
-
constructor() {
|
|
1703
|
-
this.point = createPoint();
|
|
1704
|
-
this.points = [this.point];
|
|
1705
|
-
this.active = 0;
|
|
1706
|
-
}
|
|
1707
|
-
get depth() {
|
|
1708
|
-
return this.active;
|
|
1709
|
-
}
|
|
1710
|
-
acquire() {
|
|
1711
|
-
var _a2;
|
|
1712
|
-
const index = this.active++;
|
|
1713
|
-
(_a2 = this.points)[index] || (_a2[index] = createPoint());
|
|
1714
|
-
return this.points[index];
|
|
1715
|
-
}
|
|
1716
|
-
release(point) {
|
|
1717
|
-
if (this.active > 0 && this.points[this.active - 1] === point)
|
|
1718
|
-
this.active--;
|
|
1719
|
-
}
|
|
1720
|
-
};
|
|
1721
|
-
|
|
1722
|
-
// dist/projection/experimental/mutable-projection.js
|
|
1723
|
-
function projectionOperation(implementation, inverse, geocentric = false) {
|
|
1724
|
-
const mutable = inverse ? implementation.inverseInPlace : implementation.forwardInPlace;
|
|
1725
|
-
if (mutable)
|
|
1726
|
-
return mutable.bind(implementation);
|
|
1727
|
-
if (geocentric) {
|
|
1728
|
-
const operation2 = inverse ? implementation.inverse3D : implementation.forward3D;
|
|
1729
|
-
return (point) => {
|
|
1730
|
-
const output = operation2.call(implementation, [point.x, point.y, point.z]);
|
|
1731
|
-
point.x = output[0];
|
|
1732
|
-
point.y = output[1];
|
|
1733
|
-
point.z = output[2];
|
|
1734
|
-
};
|
|
1735
|
-
}
|
|
1736
|
-
const operation = inverse ? implementation.inverse : implementation.forward;
|
|
1737
|
-
return (point) => {
|
|
1738
|
-
const output = operation.call(implementation, point.x, point.y);
|
|
1739
|
-
point.x = output[0];
|
|
1740
|
-
point.y = output[1];
|
|
1741
|
-
};
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
// dist/projection/experimental/typescript-projection.js
|
|
1745
|
-
init_normalize();
|
|
1746
|
-
init_types();
|
|
1747
|
-
|
|
1748
|
-
// dist/projection/experimental/datum.js
|
|
1749
|
-
var import_matrix = require("@math.gl/core/matrix");
|
|
1750
|
-
var ARC_SECOND = Math.PI / (180 * 3600);
|
|
1751
|
-
var WGS842 = {
|
|
1752
|
-
ellipsoid: {
|
|
1753
|
-
semiMajorAxis: 6378137,
|
|
1754
|
-
semiMinorAxis: 6356752314245179e-9,
|
|
1755
|
-
eccentricitySquared: 0.0066943799901413165
|
|
1756
|
-
},
|
|
1757
|
-
towgs84: [0, 0, 0]
|
|
1758
|
-
};
|
|
1759
|
-
function geodeticToGeocentricInPlace(point, ellipsoid) {
|
|
1760
|
-
if (Math.abs(point.y) > Math.PI / 2)
|
|
1761
|
-
throw new Error("Latitude outside geocentric domain");
|
|
1762
|
-
if (!(0, import_matrix.spheroidToCartesian)(point, ellipsoid))
|
|
1763
|
-
throw new Error("Geocentric coordinate must be finite");
|
|
1764
|
-
}
|
|
1765
|
-
function geocentricToGeodeticInPlace(point, ellipsoid) {
|
|
1766
|
-
const x = point.x, y = point.y, z = point.z;
|
|
1767
|
-
const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = ellipsoid;
|
|
1768
|
-
if (x === 0 && y === 0 && z === 0)
|
|
1769
|
-
throw new Error("Geodetic coordinates are undefined at the Earth center");
|
|
1770
|
-
if (es !== 0 && Math.abs(x) < 1e-12 * a && Math.abs(y) < 1e-12 * a && Math.hypot(x, y) < 1e-12 * a) {
|
|
1771
|
-
if (!Number.isFinite(Math.hypot(x, y, z)))
|
|
1772
|
-
throw new Error("Geocentric radius must be finite");
|
|
1773
|
-
point.x = 0;
|
|
1774
|
-
point.y = Math.sign(z) * Math.PI / 2;
|
|
1775
|
-
point.z = Math.abs(z) - b;
|
|
1776
|
-
return;
|
|
1777
|
-
}
|
|
1778
|
-
if (!(0, import_matrix.cartesianToSpheroid)(point, ellipsoid)) {
|
|
1779
|
-
if (!Number.isFinite(Math.hypot(x, y, z)))
|
|
1780
|
-
throw new Error("Geocentric radius must be finite");
|
|
1781
|
-
throw new Error("Geocentric inverse did not converge");
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
function createHelmert(values, inverse) {
|
|
1785
|
-
const dx = values[0], dy = values[1], dz = values[2];
|
|
1786
|
-
const rx = (values[3] || 0) * ARC_SECOND, ry = (values[4] || 0) * ARC_SECOND, rz = (values[5] || 0) * ARC_SECOND;
|
|
1787
|
-
const scale = 1 + (values[6] || 0) / 1e6;
|
|
1788
|
-
return inverse ? (point) => {
|
|
1789
|
-
const x = (point.x - dx) / scale, y = (point.y - dy) / scale, z = (point.z - dz) / scale;
|
|
1790
|
-
point.x = x + rz * y - ry * z;
|
|
1791
|
-
point.y = -rz * x + y + rx * z;
|
|
1792
|
-
point.z = ry * x - rx * y + z;
|
|
1793
|
-
} : (point) => {
|
|
1794
|
-
const x = point.x, y = point.y, z = point.z;
|
|
1795
|
-
point.x = scale * (x - rz * y + ry * z) + dx;
|
|
1796
|
-
point.y = scale * (rz * x + y - rx * z) + dy;
|
|
1797
|
-
point.z = scale * (-ry * x + rx * y + z) + dz;
|
|
1798
|
-
};
|
|
1799
|
-
}
|
|
1800
|
-
function shifted(datum) {
|
|
1801
|
-
var _a2;
|
|
1802
|
-
return Boolean((_a2 = datum.towgs84) == null ? void 0 : _a2.some((value) => value !== 0));
|
|
1803
|
-
}
|
|
1804
|
-
function createDatumTransform(source, destination) {
|
|
1805
|
-
if (!source.towgs84 || !destination.towgs84)
|
|
1806
|
-
return void 0;
|
|
1807
|
-
if (source.grids || destination.grids) {
|
|
1808
|
-
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))
|
|
1809
|
-
return void 0;
|
|
1810
|
-
const middle = createDatumTransform(source.grids ? WGS842 : source, destination.grids ? WGS842 : destination);
|
|
1811
|
-
return (point) => {
|
|
1812
|
-
if (source.grids)
|
|
1813
|
-
applyDatumGrids(point, source, false);
|
|
1814
|
-
middle == null ? void 0 : middle(point);
|
|
1815
|
-
if (destination.grids)
|
|
1816
|
-
applyDatumGrids(point, destination, true);
|
|
1817
|
-
};
|
|
1818
|
-
}
|
|
1819
|
-
if (shifted(source) || shifted(destination)) {
|
|
1820
|
-
const first = convertDatum(source, WGS842), second = convertDatum(WGS842, destination);
|
|
1821
|
-
return (point) => {
|
|
1822
|
-
first == null ? void 0 : first(point);
|
|
1823
|
-
second == null ? void 0 : second(point);
|
|
1824
|
-
};
|
|
1825
|
-
}
|
|
1826
|
-
return convertDatum(source, destination);
|
|
1827
|
-
}
|
|
1828
|
-
function convertDatum(from, to) {
|
|
1829
|
-
if (!from.towgs84 || !to.towgs84)
|
|
1830
|
-
return void 0;
|
|
1831
|
-
const a = from.ellipsoid, b = to.ellipsoid;
|
|
1832
|
-
let sameParameters = true;
|
|
1833
|
-
for (let i = 0; i < 7; i++)
|
|
1834
|
-
if ((from.towgs84[i] || 0) !== (to.towgs84[i] || 0))
|
|
1835
|
-
sameParameters = false;
|
|
1836
|
-
if (a.semiMajorAxis === b.semiMajorAxis && Math.abs(a.eccentricitySquared - b.eccentricitySquared) <= 5e-11 && sameParameters)
|
|
1837
|
-
return void 0;
|
|
1838
|
-
const sourceShift = shifted(from) ? createHelmert(from.towgs84, false) : void 0, targetShift = shifted(to) ? createHelmert(to.towgs84, true) : void 0;
|
|
1839
|
-
return (point) => {
|
|
1840
|
-
geodeticToGeocentricInPlace(point, a);
|
|
1841
|
-
sourceShift == null ? void 0 : sourceShift(point);
|
|
1842
|
-
targetShift == null ? void 0 : targetShift(point);
|
|
1843
|
-
geocentricToGeodeticInPlace(point, b);
|
|
1844
|
-
};
|
|
1845
|
-
}
|
|
1846
|
-
function applyDatumGrids(point, datum, inverse) {
|
|
1847
|
-
for (const reference of datum.grids) {
|
|
1848
|
-
if (reference.name === "null")
|
|
1849
|
-
return;
|
|
1850
|
-
if (!reference.grid) {
|
|
1851
|
-
if (reference.optional)
|
|
1852
|
-
continue;
|
|
1853
|
-
throw new Error("Required datum grid is not registered: " + reference.name);
|
|
1854
|
-
}
|
|
1855
|
-
let found = false;
|
|
1856
|
-
if (reference.grid.shiftInPlace)
|
|
1857
|
-
found = reference.grid.shiftInPlace(point, inverse);
|
|
1858
|
-
else {
|
|
1859
|
-
const output = reference.grid.shift(point.x, point.y, inverse);
|
|
1860
|
-
if (output) {
|
|
1861
|
-
point.x = output[0];
|
|
1862
|
-
point.y = output[1];
|
|
1863
|
-
found = true;
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
if (found) {
|
|
1867
|
-
if (!Number.isFinite(point.x) || !Number.isFinite(point.y) || Math.abs(point.y) > Math.PI / 2)
|
|
1868
|
-
throw new Error("Datum grid produced a coordinate outside the geographic domain");
|
|
1869
|
-
return;
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
throw new Error("No datum grid covers coordinate: " + datum.grids.map((grid) => grid.name).join(","));
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
// dist/projection/experimental/typescript-projection.js
|
|
1876
|
-
init_parameters();
|
|
1877
|
-
|
|
1878
|
-
// dist/projection/experimental/rendering-profile/geographic-rendering-profile.js
|
|
1879
|
-
init_parameters();
|
|
1880
|
-
|
|
1881
|
-
// dist/projection/experimental/rendering-profile/rectangular-rendering-profile.js
|
|
1882
|
-
function normalizeCoverage(point, coverage, center = 0, over = false) {
|
|
1883
|
-
const span = getLongitudeSpan(coverage);
|
|
1884
|
-
const west = span === 360 ? center - 180 : coverage[0] + Math.round((center - coverage[0] - span / 2) / 360) * 360;
|
|
1885
|
-
const east = west + span;
|
|
1886
|
-
if (over) {
|
|
1887
|
-
point.x = Math.max(west, Math.min(east, point.x));
|
|
1888
|
-
point.y = Math.max(coverage[1], Math.min(coverage[3], point.y));
|
|
1889
|
-
return;
|
|
1890
|
-
}
|
|
1891
|
-
const best = clampGeographicPoint(coverage, [point.x, point.y]);
|
|
1892
|
-
let longitude = best[0];
|
|
1893
|
-
if (best[0] === normalizeLongitude(point.x) && point.x >= west && point.x <= east)
|
|
1894
|
-
longitude = point.x;
|
|
1895
|
-
else if (longitude < west || longitude > east)
|
|
1896
|
-
longitude += Math.round(((west + east) / 2 - longitude) / 360) * 360;
|
|
1897
|
-
const offset = longitude - center;
|
|
1898
|
-
point.x = Math.abs(offset) <= 180 ? longitude : center + normalizeLongitude(offset);
|
|
1899
|
-
point.y = best[1];
|
|
1900
|
-
}
|
|
1901
|
-
function createRectangleRenderingProfile(resolveBounds2, coverage, origin = 0, primeMeridian2 = 0, over = false) {
|
|
1902
|
-
const center = (origin + primeMeridian2) * 180 / Math.PI;
|
|
1903
|
-
return {
|
|
1904
|
-
get bounds() {
|
|
1905
|
-
return resolveBounds2(getAngularRanges(coverage, primeMeridian2, origin));
|
|
1906
|
-
},
|
|
1907
|
-
normalize(point) {
|
|
1908
|
-
normalizeCoverage(point, coverage, center, over);
|
|
1909
|
-
}
|
|
1910
|
-
};
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
// dist/projection/experimental/rendering-profile/rendering-bounds.js
|
|
1914
|
-
init_parameters();
|
|
1915
|
-
function longitudeRange(parameters, origin, over = false) {
|
|
1916
|
-
const low = parameters[0][0] - origin, high = parameters[1][0] - origin;
|
|
1917
|
-
if (over)
|
|
1918
|
-
return [low, high];
|
|
1919
|
-
const span = high - low;
|
|
1920
|
-
if (span >= 2 * Math.PI - 1e-12)
|
|
1921
|
-
return [-Math.PI, Math.PI];
|
|
1922
|
-
let west = wrapLongitude(low);
|
|
1923
|
-
if (span > 0 && Math.abs(west - Math.PI) < 1e-12)
|
|
1924
|
-
west = -Math.PI;
|
|
1925
|
-
const east = west + span;
|
|
1926
|
-
return east > Math.PI + 1e-12 ? [-Math.PI, Math.PI] : [west, Math.min(east, Math.PI)];
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
// dist/projection/experimental/rendering-profile/geographic-rendering-profile.js
|
|
1930
|
-
function createGeographicProfile(parameters, primeMeridian2 = 0) {
|
|
1931
|
-
const center = numberParameter(parameters, "lon_wrap", 0) * DEGREES_TO_RADIANS;
|
|
1932
|
-
return (coverage) => createRectangleRenderingProfile((ranges) => {
|
|
1933
|
-
const longitude = longitudeRange(ranges, center);
|
|
1934
|
-
return [
|
|
1935
|
-
[center + longitude[0], ranges[0][1], 0],
|
|
1936
|
-
[center + longitude[1], ranges[1][1], 0]
|
|
1937
|
-
];
|
|
1938
|
-
}, coverage ?? [-180, -90, 180, 90], center, primeMeridian2);
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
// dist/projection/experimental/vertical-datum.js
|
|
1942
|
-
init_types();
|
|
1943
|
-
function compileVerticalGrid(names, grids = {}) {
|
|
1944
|
-
if (names === void 0)
|
|
1945
|
-
return void 0;
|
|
1946
|
-
const entries = [];
|
|
1947
|
-
for (const entry of names.split(",")) {
|
|
1948
|
-
const optional = entry.startsWith("@");
|
|
1949
|
-
const name = optional ? entry.slice(1) : entry;
|
|
1950
|
-
if (!name || /\s/.test(name))
|
|
1951
|
-
throw new Error("Invalid vertical grid name");
|
|
1952
|
-
if (name === "null") {
|
|
1953
|
-
entries.push(null);
|
|
1954
|
-
break;
|
|
1955
|
-
}
|
|
1956
|
-
const grid = Object.prototype.hasOwnProperty.call(grids, name) ? grids[name] : void 0;
|
|
1957
|
-
if (grid) {
|
|
1958
|
-
if (typeof grid.getOffset !== "function")
|
|
1959
|
-
throw new Error("Invalid vertical grid: " + name);
|
|
1960
|
-
entries.push(grid.getOffset.bind(grid));
|
|
1961
|
-
} else if (!optional)
|
|
1962
|
-
unsupportedStage("Required vertical grid is not registered: " + name);
|
|
1963
|
-
}
|
|
1964
|
-
return (longitude, latitude) => {
|
|
1965
|
-
for (const sample of entries) {
|
|
1966
|
-
if (!sample)
|
|
1967
|
-
return 0;
|
|
1968
|
-
const offset = sample(longitude, latitude);
|
|
1969
|
-
if (offset === void 0)
|
|
1970
|
-
continue;
|
|
1971
|
-
if (!Number.isFinite(offset))
|
|
1972
|
-
throw new Error("Vertical grid returned a non-finite offset");
|
|
1973
|
-
return offset;
|
|
1974
|
-
}
|
|
1975
|
-
throw new Error("No vertical grid covers this coordinate");
|
|
1976
|
-
};
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
// dist/projection/experimental/transform-description.js
|
|
1980
|
-
function describeCRS(crs) {
|
|
1981
|
-
const ellipsoid = Object.freeze({ ...crs.ellipsoid });
|
|
1982
|
-
return Object.freeze({
|
|
1983
|
-
kind: crs.kind,
|
|
1984
|
-
projection: crs.projection,
|
|
1985
|
-
parameters: Object.freeze(Object.fromEntries(Object.entries(crs.parameters).map(([name, value]) => [name, value ?? null]))),
|
|
1986
|
-
ellipsoid,
|
|
1987
|
-
datum: Object.freeze({
|
|
1988
|
-
ellipsoid: Object.freeze({ ...crs.datum.ellipsoid }),
|
|
1989
|
-
towgs84: crs.datum.towgs84 && Object.freeze([...crs.datum.towgs84]),
|
|
1990
|
-
grids: crs.datum.grids && Object.freeze(crs.datum.grids.map((reference) => Object.freeze({
|
|
1991
|
-
name: reference.name,
|
|
1992
|
-
optional: reference.optional,
|
|
1993
|
-
loaded: Boolean(reference.grid)
|
|
1994
|
-
})))
|
|
1995
|
-
}),
|
|
1996
|
-
angularUnit: crs.angularUnit,
|
|
1997
|
-
toMeter: crs.toMeter,
|
|
1998
|
-
verticalUnit: crs.verticalUnit,
|
|
1999
|
-
primeMeridian: crs.primeMeridian,
|
|
2000
|
-
axis: crs.axis,
|
|
2001
|
-
storedAxis: crs.storedAxis,
|
|
2002
|
-
longitudeWrap: crs.longitudeWrap,
|
|
2003
|
-
areaOfUse: crs.areaOfUse && Object.freeze([...crs.areaOfUse]),
|
|
2004
|
-
lossy: crs.lossy,
|
|
2005
|
-
algorithm: crs.algorithm && Object.freeze({ ...crs.algorithm })
|
|
2006
|
-
});
|
|
2007
|
-
}
|
|
2008
|
-
function describeTransform(source, target, forward, inverse) {
|
|
2009
|
-
const opaqueReasons = [];
|
|
2010
|
-
if (!source.algorithm)
|
|
2011
|
-
opaqueReasons.push("source-algorithm");
|
|
2012
|
-
if (!target.algorithm)
|
|
2013
|
-
opaqueReasons.push("target-algorithm");
|
|
2014
|
-
if (source.datum.grids || target.datum.grids || source.parameters["geoidgrids"] || target.parameters["geoidgrids"])
|
|
2015
|
-
opaqueReasons.push("grid-resource");
|
|
2016
|
-
return Object.freeze({
|
|
2017
|
-
version: 1,
|
|
2018
|
-
source,
|
|
2019
|
-
target,
|
|
2020
|
-
forward,
|
|
2021
|
-
inverse,
|
|
2022
|
-
lossy: source.lossy || target.lossy,
|
|
2023
|
-
complete: opaqueReasons.length === 0,
|
|
2024
|
-
opaqueReasons: Object.freeze(opaqueReasons)
|
|
2025
|
-
});
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
// dist/projection/experimental/typescript-projection.js
|
|
2029
|
-
var ProjectionTransform = class _ProjectionTransform {
|
|
2030
|
-
/** Resolve required descriptors once, then return an ordinary synchronous instance. */
|
|
2031
|
-
static async create(options = {}) {
|
|
2032
|
-
const projections = await Promise.all(requiredProjections(options).map(preloadProjection));
|
|
2033
|
-
return new _ProjectionTransform({ ...options, projections });
|
|
2034
|
-
}
|
|
2035
|
-
get targetProfile() {
|
|
2036
|
-
return this.getTargetRenderingProfile(this.targetCoverage);
|
|
2037
|
-
}
|
|
2038
|
-
/** Resolve target rendering policy independently from coordinate conversion. @internal */
|
|
2039
|
-
getTargetRenderingProfile(coverage) {
|
|
2040
|
-
return this.targetRenderingProfile && resolveRenderingProfile(this.targetRenderingProfile, coverage);
|
|
2041
|
-
}
|
|
2042
|
-
/** Deferred transforms expose metadata only once their implementations are prepared. */
|
|
2043
|
-
get description() {
|
|
2044
|
-
var _a2, _b;
|
|
2045
|
-
return ((_b = (_a2 = this.deferred) == null ? void 0 : _a2.implementation) == null ? void 0 : _b.description) ?? this.resolvedDescription;
|
|
2046
|
-
}
|
|
2047
|
-
constructor(options = {}) {
|
|
2048
|
-
var _a2, _b, _c;
|
|
2049
|
-
this.coordinateScratch = new ProjectionScratch();
|
|
2050
|
-
this.targetLongitudeOrigin = 0;
|
|
2051
|
-
const registrations = options.projections || [];
|
|
2052
|
-
const plugins = registry(registrations);
|
|
2053
|
-
if (registrations.some((projection) => !("create" in projection))) {
|
|
2054
|
-
const from = normalizeCRS(options.from ?? "WGS84", options);
|
|
2055
|
-
const to = normalizeCRS(options.to ?? "WGS84", options);
|
|
2056
|
-
this.lossy = from.lossy || to.lossy;
|
|
2057
|
-
this.deferred = { options: { ...options, projections: [...registrations] } };
|
|
2058
|
-
} else {
|
|
2059
|
-
const eager = options;
|
|
2060
|
-
const eagerPlugins = plugins;
|
|
2061
|
-
const from = compileCRS(eager.from ?? "WGS84", eagerPlugins, eager);
|
|
2062
|
-
const to = compileCRS(eager.to ?? "WGS84", eagerPlugins, eager);
|
|
2063
|
-
this.targetRenderingProfile = ((_b = (_a2 = to.implementation) == null ? void 0 : _a2.getRenderingProfile) == null ? void 0 : _b.bind(to.implementation)) ?? (to.kind === "geographic" ? createGeographicProfile(to.parameters, to.primeMeridian) : to.kind === "identity" ? getIdentityRenderingProfile : void 0);
|
|
2064
|
-
this.targetCoverage = to.areaOfUse;
|
|
2065
|
-
this.targetLongitudeOrigin = ((_c = to.implementation) == null ? void 0 : _c.longitudeOrigin) ?? (to.kind === "geographic" ? to.longitudeWrap ?? 0 : 0);
|
|
2066
|
-
this.lossy = from.lossy || to.lossy;
|
|
2067
|
-
if (this.lossy && (from.kind === "geocentric" || to.kind === "geocentric"))
|
|
2068
|
-
unsupportedStage("Horizontal extraction cannot supply ellipsoidal height for geocentric coordinates");
|
|
2069
|
-
if (this.lossy && (from.verticalGrid || to.verticalGrid))
|
|
2070
|
-
unsupportedStage("Horizontal extraction cannot be combined with vertical grids");
|
|
2071
|
-
this.forwardTransform = compileTransform(from, to, Boolean(options.enforceAxis));
|
|
2072
|
-
this.inverseTransform = compileTransform(to, from, Boolean(options.enforceAxis));
|
|
2073
|
-
this.resolvedDescription = describeTransform(describeCRS(from), describeCRS(to), this.forwardTransform.description, this.inverseTransform.description);
|
|
2074
|
-
}
|
|
2075
|
-
this.project = this.project.bind(this);
|
|
2076
|
-
this.unproject = this.unproject.bind(this);
|
|
2077
|
-
this.projectTo = this.projectTo.bind(this);
|
|
2078
|
-
this.unprojectTo = this.unprojectTo.bind(this);
|
|
2079
|
-
this.projectToSync = this.projectToSync.bind(this);
|
|
2080
|
-
this.unprojectToSync = this.unprojectToSync.bind(this);
|
|
2081
|
-
this.projectFlat = this.projectFlat.bind(this);
|
|
2082
|
-
this.unprojectFlat = this.unprojectFlat.bind(this);
|
|
2083
|
-
this.projectSync = this.projectSync.bind(this);
|
|
2084
|
-
this.unprojectSync = this.unprojectSync.bind(this);
|
|
2085
|
-
this.projectFlatSync = this.projectFlatSync.bind(this);
|
|
2086
|
-
this.unprojectFlatSync = this.unprojectFlatSync.bind(this);
|
|
2087
|
-
}
|
|
2088
|
-
load() {
|
|
2089
|
-
const state = this.deferred;
|
|
2090
|
-
if (!state)
|
|
2091
|
-
return Promise.resolve(this);
|
|
2092
|
-
if (state.implementation)
|
|
2093
|
-
return Promise.resolve(state.implementation);
|
|
2094
|
-
state.pending || (state.pending = _ProjectionTransform.create(state.options).then((projection) => {
|
|
2095
|
-
state.implementation = projection;
|
|
2096
|
-
return projection;
|
|
2097
|
-
}).catch((error) => {
|
|
2098
|
-
state.pending = void 0;
|
|
2099
|
-
throw error;
|
|
2100
|
-
}));
|
|
2101
|
-
return state.pending;
|
|
2102
|
-
}
|
|
2103
|
-
loadSync() {
|
|
2104
|
-
const state = this.deferred;
|
|
2105
|
-
if (!state)
|
|
2106
|
-
return this;
|
|
2107
|
-
if (!state.implementation) {
|
|
2108
|
-
const projections = requiredProjections(state.options).map((descriptor) => {
|
|
2109
|
-
const plugin = getLoadedProjection(descriptor);
|
|
2110
|
-
if (!plugin)
|
|
2111
|
-
throw new Error("Projection is not preloaded: " + descriptor.name + ". Call preload() first.");
|
|
2112
|
-
return plugin;
|
|
2113
|
-
});
|
|
2114
|
-
state.implementation = new _ProjectionTransform({ ...state.options, projections });
|
|
2115
|
-
}
|
|
2116
|
-
return state.implementation;
|
|
2117
|
-
}
|
|
2118
|
-
/** Synchronous variants never import algorithms; descriptors must be preloaded. */
|
|
2119
|
-
projectSync(coordinate) {
|
|
2120
|
-
return this.deferred ? this.loadSync().project(coordinate) : transformScalar(coordinate, this.forwardTransform, this.coordinateScratch);
|
|
2121
|
-
}
|
|
2122
|
-
unprojectSync(coordinate) {
|
|
2123
|
-
return this.deferred ? this.loadSync().unproject(coordinate) : transformScalar(coordinate, this.inverseTransform, this.coordinateScratch);
|
|
2124
|
-
}
|
|
2125
|
-
projectFlatSync(coordinates, dimension = 2) {
|
|
2126
|
-
return this.deferred ? this.loadSync().projectFlat(coordinates, dimension) : transformInPlace(coordinates, dimension, this.forwardTransform, this.coordinateScratch);
|
|
2127
|
-
}
|
|
2128
|
-
unprojectFlatSync(coordinates, dimension = 2) {
|
|
2129
|
-
return this.deferred ? this.loadSync().unprojectFlat(coordinates, dimension) : transformInPlace(coordinates, dimension, this.inverseTransform, this.coordinateScratch);
|
|
2130
|
-
}
|
|
2131
|
-
/** Optional warm-up. Coordinate methods also load automatically on first use. */
|
|
2132
|
-
async preload() {
|
|
2133
|
-
await this.load();
|
|
2134
|
-
}
|
|
2135
|
-
/** Eager plugins return arrays; descriptor-backed instances return promises. */
|
|
2136
|
-
project(coordinate) {
|
|
2137
|
-
const result = this.deferred ? this.projectLoaded(coordinate, false) : transformScalar(coordinate, this.forwardTransform, this.coordinateScratch);
|
|
2138
|
-
return result;
|
|
2139
|
-
}
|
|
2140
|
-
unproject(coordinate) {
|
|
2141
|
-
const result = this.deferred ? this.projectLoaded(coordinate, true) : transformScalar(coordinate, this.inverseTransform, this.coordinateScratch);
|
|
2142
|
-
return result;
|
|
2143
|
-
}
|
|
2144
|
-
/** Write one coordinate into caller-owned storage; return that same output. */
|
|
2145
|
-
projectTo(coordinate, output) {
|
|
2146
|
-
return this.deferred ? this.projectToLoaded(coordinate, output, false) : this.projectToSync(coordinate, output);
|
|
2147
|
-
}
|
|
2148
|
-
unprojectTo(coordinate, output) {
|
|
2149
|
-
return this.deferred ? this.projectToLoaded(coordinate, output, true) : this.unprojectToSync(coordinate, output);
|
|
2150
|
-
}
|
|
2151
|
-
projectToSync(coordinate, output) {
|
|
2152
|
-
if (this.deferred)
|
|
2153
|
-
return this.loadSync().projectTo(coordinate, output);
|
|
2154
|
-
validateScalarOutput(coordinate, output, Math.max(coordinate.length, this.forwardTransform.geocentricOutput ? 3 : 2));
|
|
2155
|
-
return transformScalar(coordinate, this.forwardTransform, this.coordinateScratch, output);
|
|
2156
|
-
}
|
|
2157
|
-
unprojectToSync(coordinate, output) {
|
|
2158
|
-
if (this.deferred)
|
|
2159
|
-
return this.loadSync().unprojectTo(coordinate, output);
|
|
2160
|
-
validateScalarOutput(coordinate, output, Math.max(coordinate.length, this.inverseTransform.geocentricOutput ? 3 : 2));
|
|
2161
|
-
return transformScalar(coordinate, this.inverseTransform, this.coordinateScratch, output);
|
|
2162
|
-
}
|
|
2163
|
-
projectToLoaded(coordinate, output, inverse) {
|
|
2164
|
-
validateScalarOutput(coordinate, output, coordinate.length);
|
|
2165
|
-
const input = coordinate.slice();
|
|
2166
|
-
return this.load().then((projection) => inverse ? projection.unprojectTo(input, output) : projection.projectTo(input, output));
|
|
2167
|
-
}
|
|
2168
|
-
projectLoaded(coordinate, inverse) {
|
|
2169
|
-
const input = coordinate.slice();
|
|
2170
|
-
return this.load().then((projection) => inverse ? projection.unproject(input) : projection.project(input));
|
|
2171
|
-
}
|
|
2172
|
-
/** In-place; descriptor callers must await completion before reusing the buffer. */
|
|
2173
|
-
projectFlat(coordinates, dimension = 2) {
|
|
2174
|
-
const result = this.deferred ? this.load().then((projection) => projection.projectFlat(coordinates, dimension)) : transformInPlace(coordinates, dimension, this.forwardTransform, this.coordinateScratch);
|
|
2175
|
-
return result;
|
|
2176
|
-
}
|
|
2177
|
-
unprojectFlat(coordinates, dimension = 2) {
|
|
2178
|
-
const result = this.deferred ? this.load().then((projection) => projection.unprojectFlat(coordinates, dimension)) : transformInPlace(coordinates, dimension, this.inverseTransform, this.coordinateScratch);
|
|
2179
|
-
return result;
|
|
2180
|
-
}
|
|
2181
|
-
};
|
|
2182
|
-
function requiredProjections(options) {
|
|
2183
|
-
const available = registry(options.projections || []);
|
|
2184
|
-
const required = /* @__PURE__ */ new Set();
|
|
2185
|
-
for (const definition of [options.from ?? "WGS84", options.to ?? "WGS84"]) {
|
|
2186
|
-
const crs = normalizeCRS(definition, options);
|
|
2187
|
-
if (["geographic", "identity"].includes(crs.kind))
|
|
2188
|
-
continue;
|
|
2189
|
-
const projection = available.get(pluginKey(crs.projection));
|
|
2190
|
-
if (!projection)
|
|
2191
|
-
throw new TypeScriptCRSError("missing-plugin", "Projection plugin is not registered: " + crs.projection);
|
|
2192
|
-
required.add(projection);
|
|
2193
|
-
}
|
|
2194
|
-
return [...required];
|
|
2195
|
-
}
|
|
2196
|
-
var pluginKey = (name) => name.toLowerCase().replace(/[\s_-]/g, "");
|
|
2197
|
-
function registry(projections) {
|
|
2198
|
-
const plugins = /* @__PURE__ */ new Map();
|
|
2199
|
-
for (const plugin of projections) {
|
|
2200
|
-
for (const name of new Set([plugin.name, ...plugin.aliases || []].map(pluginKey))) {
|
|
2201
|
-
if (!name || ["longlat", "latlong", "latlon", "lonlat", "identity"].includes(name) || plugins.has(name))
|
|
2202
|
-
throw new Error("Duplicate or reserved projection plugin: " + name);
|
|
2203
|
-
plugins.set(name, plugin);
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
return plugins;
|
|
2207
|
-
}
|
|
2208
|
-
function compileCRS(definition, plugins, options) {
|
|
2209
|
-
var _a2;
|
|
2210
|
-
const crs = normalizeCRS(definition, options);
|
|
2211
|
-
const plugin = plugins.get(pluginKey(crs.projection));
|
|
2212
|
-
if (!["geographic", "identity"].includes(crs.kind) && !plugin)
|
|
2213
|
-
throw new TypeScriptCRSError("missing-plugin", "Projection plugin is not registered: " + crs.projection);
|
|
2214
|
-
const allowed = /* @__PURE__ */ new Set([...CORE_PARAMETERS, ...(plugin == null ? void 0 : plugin.parameters) || []]);
|
|
2215
|
-
for (const key2 of Object.keys(crs.parameters)) {
|
|
2216
|
-
if (!allowed.has(key2))
|
|
2217
|
-
throw new TypeScriptCRSError("missing-transform-stage", "Unsupported PROJ parameter: +" + key2);
|
|
2218
|
-
const flag = CORE_FLAGS.includes(key2) || ((_a2 = plugin == null ? void 0 : plugin.flags) == null ? void 0 : _a2.includes(key2));
|
|
2219
|
-
if (flag && crs.parameters[key2] !== void 0)
|
|
2220
|
-
throw new Error("Expected a flag without a value: +" + key2);
|
|
2221
|
-
if (!flag && !crs.parameters[key2])
|
|
2222
|
-
throw new Error("PROJ parameter requires a value: +" + key2);
|
|
2223
|
-
}
|
|
2224
|
-
if (crs.parameters["type"] && crs.parameters["type"] !== "crs")
|
|
2225
|
-
throw new Error("Only +type=crs is supported");
|
|
2226
|
-
const parameters = pluginKey(crs.projection) === "fasttransversemercator" ? Object.freeze({ ...crs.parameters, approx: void 0 }) : crs.parameters;
|
|
2227
|
-
const implementation = plugin == null ? void 0 : plugin.create({
|
|
2228
|
-
...crs.ellipsoid,
|
|
2229
|
-
parameters,
|
|
2230
|
-
primeMeridian: crs.primeMeridian
|
|
2231
|
-
});
|
|
2232
|
-
if (crs.kind === "geocentric" && (!(implementation == null ? void 0 : implementation.forward3D) || !(implementation == null ? void 0 : implementation.inverse3D)))
|
|
2233
|
-
throw new Error("Geocentric plugin must implement 3D operations");
|
|
2234
|
-
const references = crs.datum.grids;
|
|
2235
|
-
const nullIndex = (references == null ? void 0 : references.findIndex((reference) => reference.name === "null")) ?? -1;
|
|
2236
|
-
const grids = references == null ? void 0 : references.slice(0, nullIndex < 0 ? void 0 : nullIndex + 1).map((reference) => {
|
|
2237
|
-
const grid = Object.prototype.hasOwnProperty.call(options.datumGrids || {}, reference.name) ? options.datumGrids[reference.name] : void 0;
|
|
2238
|
-
if (grid && typeof grid.shift !== "function")
|
|
2239
|
-
throw new Error("Invalid prepared datum grid: " + reference.name);
|
|
2240
|
-
return Object.freeze({ ...reference, grid });
|
|
2241
|
-
});
|
|
2242
|
-
for (const reference of grids || []) {
|
|
2243
|
-
if (reference.name === "null")
|
|
2244
|
-
break;
|
|
2245
|
-
if (!reference.optional && !reference.grid)
|
|
2246
|
-
unsupportedStage("Required datum grid is not registered: " + reference.name);
|
|
2247
|
-
}
|
|
2248
|
-
const datum = grids ? Object.freeze({ ...crs.datum, grids: Object.freeze(grids) }) : crs.datum;
|
|
2249
|
-
const verticalGrid = compileVerticalGrid(crs.parameters["geoidgrids"], options.verticalGrids);
|
|
2250
|
-
if (verticalGrid && (crs.kind === "geocentric" || crs.kind === "identity" || crs.lossy))
|
|
2251
|
-
unsupportedStage("Vertical grids require a non-lossy geographic or projected CRS");
|
|
2252
|
-
const algorithm = plugin ? plugin.semantics : { id: "@math.gl/geospatial/" + crs.kind, version: 1 };
|
|
2253
|
-
return { ...crs, datum, implementation, verticalGrid, algorithm };
|
|
2254
|
-
}
|
|
2255
|
-
function finite(point) {
|
|
2256
|
-
return Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z);
|
|
2257
|
-
}
|
|
2258
|
-
function compileAxis(axis, inverse) {
|
|
2259
|
-
if (axis === "enu")
|
|
2260
|
-
return void 0;
|
|
2261
|
-
const indexes = [0, 0, 0], signs = [0, 0, 0];
|
|
2262
|
-
for (let i = 0; i < 3; i++) {
|
|
2263
|
-
const char = axis[i], component = "ew".includes(char) ? 0 : "ns".includes(char) ? 1 : 2;
|
|
2264
|
-
indexes[inverse ? i : component] = inverse ? component : i;
|
|
2265
|
-
signs[inverse ? i : component] = "wsd".includes(char) ? -1 : 1;
|
|
2266
|
-
}
|
|
2267
|
-
return (point) => {
|
|
2268
|
-
const x = point.x, y = point.y, z = point.z;
|
|
2269
|
-
point.x = signs[0] * (indexes[0] === 0 ? x : indexes[0] === 1 ? y : z);
|
|
2270
|
-
point.y = signs[1] * (indexes[1] === 0 ? x : indexes[1] === 1 ? y : z);
|
|
2271
|
-
point.z = signs[2] * (indexes[2] === 0 ? x : indexes[2] === 1 ? y : z);
|
|
2272
|
-
};
|
|
2273
|
-
}
|
|
2274
|
-
function compileTransform(from, to, enforceAxis) {
|
|
2275
|
-
var _a2, _b, _c, _d;
|
|
2276
|
-
const fromAxis = from.storedAxis || (enforceAxis ? from.axis : "enu");
|
|
2277
|
-
const toAxis = to.storedAxis || (enforceAxis ? to.axis : "enu");
|
|
2278
|
-
const inputAxis = compileAxis(fromAxis, false), outputAxis = compileAxis(toAxis, true);
|
|
2279
|
-
const source = from.implementation && projectionOperation(from.implementation, true, from.kind === "geocentric");
|
|
2280
|
-
const target = to.implementation && projectionOperation(to.implementation, false, to.kind === "geocentric");
|
|
2281
|
-
const datum = createDatumTransform(from.datum, to.datum);
|
|
2282
|
-
const horizontalOnly = from.lossy || to.lossy;
|
|
2283
|
-
const fromGeocentric = from.kind === "geocentric";
|
|
2284
|
-
const inputScale = from.kind === "geographic" ? from.angularUnit : from.toMeter;
|
|
2285
|
-
const outputScale = to.kind === "geographic" ? to.angularUnit : to.toMeter;
|
|
2286
|
-
const inputVerticalScale = fromGeocentric ? 1 : from.verticalUnit, outputVerticalScale = to.kind === "geocentric" ? outputScale : to.verticalUnit;
|
|
2287
|
-
const fromPrime = from.primeMeridian, toPrime = to.primeMeridian;
|
|
2288
|
-
const longitudeWrap = to.kind === "geographic" ? to.longitudeWrap : void 0;
|
|
2289
|
-
let flat;
|
|
2290
|
-
if (!datum && !from.verticalGrid && !to.verticalGrid && !horizontalOnly && !inputAxis && !outputAxis && !fromPrime && !toPrime && from.verticalUnit === 1 && to.verticalUnit === 1 && longitudeWrap === void 0) {
|
|
2291
|
-
const context = Object.freeze({ inputScale, outputScale });
|
|
2292
|
-
if (from.kind === "geographic" && to.kind === "projected")
|
|
2293
|
-
flat = (_b = (_a2 = to.implementation) == null ? void 0 : _a2.createForwardFlat) == null ? void 0 : _b.call(_a2, context);
|
|
2294
|
-
if (from.kind === "projected" && to.kind === "geographic")
|
|
2295
|
-
flat = (_d = (_c = from.implementation) == null ? void 0 : _c.createInverseFlat) == null ? void 0 : _d.call(_c, context);
|
|
2296
|
-
}
|
|
2297
|
-
const requiresInputZ = Boolean(from.verticalGrid || to.verticalGrid) || from.kind === "geocentric" || /[ud]/.test(fromAxis.slice(0, 2)) || /[ud]/.test(toAxis.slice(0, 2));
|
|
2298
|
-
const stages = [];
|
|
2299
|
-
if (inputAxis)
|
|
2300
|
-
stages.push("input-axis");
|
|
2301
|
-
if (horizontalOnly)
|
|
2302
|
-
stages.push("discard-height");
|
|
2303
|
-
if (inputScale !== 1)
|
|
2304
|
-
stages.push("input-scale");
|
|
2305
|
-
if (source)
|
|
2306
|
-
stages.push("source-inverse");
|
|
2307
|
-
if (inputVerticalScale !== 1)
|
|
2308
|
-
stages.push("input-height-scale");
|
|
2309
|
-
stages.push("geographic-domain-check");
|
|
2310
|
-
if (fromPrime)
|
|
2311
|
-
stages.push("source-prime-meridian");
|
|
2312
|
-
if (from.verticalGrid)
|
|
2313
|
-
stages.push("source-vertical-grid");
|
|
2314
|
-
if (datum)
|
|
2315
|
-
stages.push("datum");
|
|
2316
|
-
if (to.verticalGrid)
|
|
2317
|
-
stages.push("target-vertical-grid");
|
|
2318
|
-
if (toPrime)
|
|
2319
|
-
stages.push("target-prime-meridian");
|
|
2320
|
-
if (longitudeWrap !== void 0)
|
|
2321
|
-
stages.push("longitude-wrap");
|
|
2322
|
-
if (target)
|
|
2323
|
-
stages.push("target-forward");
|
|
2324
|
-
if (outputScale !== 1)
|
|
2325
|
-
stages.push("output-scale");
|
|
2326
|
-
if (outputVerticalScale !== 1)
|
|
2327
|
-
stages.push("output-height-scale");
|
|
2328
|
-
if (horizontalOnly)
|
|
2329
|
-
stages.push("restore-height");
|
|
2330
|
-
if (outputAxis)
|
|
2331
|
-
stages.push("output-axis");
|
|
2332
|
-
return {
|
|
2333
|
-
description: Object.freeze({
|
|
2334
|
-
inputAxis: fromAxis,
|
|
2335
|
-
outputAxis: toAxis,
|
|
2336
|
-
requiresInputZ,
|
|
2337
|
-
geocentricOutput: to.kind === "geocentric",
|
|
2338
|
-
stages: Object.freeze(stages)
|
|
2339
|
-
}),
|
|
2340
|
-
flat,
|
|
2341
|
-
requiresInputZ,
|
|
2342
|
-
geocentricOutput: to.kind === "geocentric",
|
|
2343
|
-
run(point) {
|
|
2344
|
-
if (!finite(point))
|
|
2345
|
-
throw new Error("Coordinates must contain finite x, y and optional z values");
|
|
2346
|
-
inputAxis == null ? void 0 : inputAxis(point);
|
|
2347
|
-
const preservedHeight = point.z;
|
|
2348
|
-
if (horizontalOnly)
|
|
2349
|
-
point.z = 0;
|
|
2350
|
-
if (inputScale !== 1) {
|
|
2351
|
-
point.x *= inputScale;
|
|
2352
|
-
point.y *= inputScale;
|
|
2353
|
-
if (fromGeocentric)
|
|
2354
|
-
point.z *= inputScale;
|
|
2355
|
-
}
|
|
2356
|
-
source == null ? void 0 : source(point);
|
|
2357
|
-
if (inputVerticalScale !== 1)
|
|
2358
|
-
point.z *= inputVerticalScale;
|
|
2359
|
-
if (Math.abs(point.y) > Math.PI / 2 || !finite(point))
|
|
2360
|
-
throw new Error("Coordinate is outside the geographic domain");
|
|
2361
|
-
point.x += fromPrime;
|
|
2362
|
-
if (from.verticalGrid)
|
|
2363
|
-
point.z += from.verticalGrid(point.x, point.y);
|
|
2364
|
-
datum == null ? void 0 : datum(point);
|
|
2365
|
-
if (to.verticalGrid)
|
|
2366
|
-
point.z -= to.verticalGrid(point.x, point.y);
|
|
2367
|
-
point.x -= toPrime;
|
|
2368
|
-
if (longitudeWrap !== void 0)
|
|
2369
|
-
point.x = longitudeWrap + wrapLongitude(point.x - longitudeWrap);
|
|
2370
|
-
target == null ? void 0 : target(point);
|
|
2371
|
-
if (outputScale !== 1) {
|
|
2372
|
-
point.x /= outputScale;
|
|
2373
|
-
point.y /= outputScale;
|
|
2374
|
-
}
|
|
2375
|
-
if (outputVerticalScale !== 1)
|
|
2376
|
-
point.z /= outputVerticalScale;
|
|
2377
|
-
if (horizontalOnly)
|
|
2378
|
-
point.z = preservedHeight;
|
|
2379
|
-
outputAxis == null ? void 0 : outputAxis(point);
|
|
2380
|
-
if (!finite(point))
|
|
2381
|
-
throw new Error("Projection produced non-finite coordinates");
|
|
2382
|
-
}
|
|
2383
|
-
};
|
|
2384
|
-
}
|
|
2385
|
-
function transformScalar(coordinate, operation, scratch, output) {
|
|
2386
|
-
if (coordinate.length < 2)
|
|
2387
|
-
throw new Error("Coordinates must contain finite x, y and optional z values");
|
|
2388
|
-
if (coordinate.length < 3 && operation.requiresInputZ)
|
|
2389
|
-
throw new Error("This transform requires three ordinates");
|
|
2390
|
-
const length = Math.max(coordinate.length, operation.geocentricOutput ? 3 : 2);
|
|
2391
|
-
const point = scratch.acquire();
|
|
2392
|
-
try {
|
|
2393
|
-
point.x = coordinate[0];
|
|
2394
|
-
point.y = coordinate[1];
|
|
2395
|
-
point.z = coordinate.length >= 3 ? coordinate[2] : 0;
|
|
2396
|
-
operation.run(point);
|
|
2397
|
-
if (output)
|
|
2398
|
-
return writeScalarOutput(coordinate, output, point, length);
|
|
2399
|
-
const result = coordinate.slice();
|
|
2400
|
-
result[0] = point.x;
|
|
2401
|
-
result[1] = point.y;
|
|
2402
|
-
if (coordinate.length >= 3 || operation.geocentricOutput)
|
|
2403
|
-
result[2] = point.z;
|
|
2404
|
-
return result;
|
|
2405
|
-
} finally {
|
|
2406
|
-
scratch.release(point);
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
function transformInPlace(coordinates, dimension, operation, scratch) {
|
|
2410
|
-
if (!(coordinates instanceof Float32Array || coordinates instanceof Float64Array))
|
|
2411
|
-
throw new Error("In-place projection requires a Float32Array or Float64Array");
|
|
2412
|
-
if (!Number.isSafeInteger(dimension) || dimension < 2 || coordinates.length % dimension !== 0)
|
|
2413
|
-
throw new Error("Dimension must be an integer >= 2 and divide the typed array length");
|
|
2414
|
-
if (dimension < 3 && (operation.requiresInputZ || operation.geocentricOutput))
|
|
2415
|
-
throw new Error("This transform requires a dimension of at least 3");
|
|
2416
|
-
if (operation.flat) {
|
|
2417
|
-
operation.flat(coordinates, dimension);
|
|
2418
|
-
return coordinates;
|
|
2419
|
-
}
|
|
2420
|
-
const point = scratch.acquire();
|
|
2421
|
-
try {
|
|
2422
|
-
const float32 = coordinates instanceof Float32Array;
|
|
2423
|
-
for (let offset = 0; offset < coordinates.length; offset += dimension) {
|
|
2424
|
-
point.x = coordinates[offset];
|
|
2425
|
-
point.y = coordinates[offset + 1];
|
|
2426
|
-
point.z = dimension >= 3 ? coordinates[offset + 2] : 0;
|
|
2427
|
-
operation.run(point);
|
|
2428
|
-
if (float32 && (Math.abs(point.x) > 34028234663852886e22 || Math.abs(point.y) > 34028234663852886e22 || dimension >= 3 && Math.abs(point.z) > 34028234663852886e22))
|
|
2429
|
-
throw new Error("Projected coordinate exceeds Float32 range");
|
|
2430
|
-
coordinates[offset] = point.x;
|
|
2431
|
-
coordinates[offset + 1] = point.y;
|
|
2432
|
-
if (dimension >= 3)
|
|
2433
|
-
coordinates[offset + 2] = point.z;
|
|
2434
|
-
}
|
|
2435
|
-
return coordinates;
|
|
2436
|
-
} finally {
|
|
2437
|
-
scratch.release(point);
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
1595
|
+
// dist/projection/experimental/lazy-projection.js
|
|
1596
|
+
var import_typescript_projection = require("./../typescript-projection.shared.cjs");
|
|
2440
1597
|
|
|
2441
1598
|
// dist/projection/experimental/engine-options.js
|
|
2442
1599
|
function snapshotEngineOptions(options) {
|
|
@@ -2505,7 +1662,7 @@ var LazyProjectionEngine = class {
|
|
|
2505
1662
|
}
|
|
2506
1663
|
createProjection(options = {}) {
|
|
2507
1664
|
const config = { ...this.options, ...options };
|
|
2508
|
-
return new ProjectionTransform({
|
|
1665
|
+
return new import_typescript_projection.ProjectionTransform({
|
|
2509
1666
|
...config,
|
|
2510
1667
|
projections: configuredProjections(config)
|
|
2511
1668
|
});
|
|
@@ -2518,7 +1675,7 @@ var LazyProjectionEngine = class {
|
|
|
2518
1675
|
if (config.resolver) {
|
|
2519
1676
|
config = await (await Promise.resolve().then(() => (init_resolve(), resolve_exports))).prepareEngineOptions(config);
|
|
2520
1677
|
}
|
|
2521
|
-
return ProjectionTransform.create({
|
|
1678
|
+
return import_typescript_projection.ProjectionTransform.create({
|
|
2522
1679
|
...config,
|
|
2523
1680
|
projections: configuredProjections(config)
|
|
2524
1681
|
});
|