@loaders.gl/geospatial 5.0.0-alpha.13 → 5.0.0-alpha.14
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/LICENSE +52 -0
- package/dist/dbf-worker.js +59 -15
- package/dist/flatgeobuf/flatgeobuf-loader-types.js +2 -2
- package/dist/flatgeobuf/flatgeobuf-loader-types.js.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.js +1 -1
- package/dist/flatgeobuf/index.cjs +16 -25
- package/dist/flatgeobuf/index.cjs.map +2 -2
- package/dist/flatgeobuf-worker.js +2032 -508
- package/dist/flatgeobuf.d.ts +1 -2
- package/dist/flatgeobuf.d.ts.map +1 -1
- package/dist/flatgeobuf.js +1 -1
- package/dist/flatgeobuf.js.map +1 -1
- package/dist/geopackage/geopackage-loader-types.d.ts.map +1 -1
- package/dist/geopackage/geopackage-loader-types.js +1 -1
- package/dist/geopackage/geopackage-loader-types.js.map +1 -1
- package/dist/geopackage/geopackage-source-loader.js +1 -1
- package/dist/geopackage/index.cjs +14 -24
- package/dist/geopackage/index.cjs.map +2 -2
- package/dist/geopackage.d.ts +1 -2
- package/dist/geopackage.d.ts.map +1 -1
- package/dist/geopackage.js +1 -1
- package/dist/geopackage.js.map +1 -1
- package/dist/index.cjs +66 -96
- package/dist/index.cjs.map +3 -3
- package/dist/kml/gpx-loader-types.js +1 -1
- package/dist/kml/index.cjs +53 -62
- package/dist/kml/index.cjs.map +3 -3
- package/dist/kml/kml-loader-types.d.ts +2 -2
- package/dist/kml/kml-loader-types.js +2 -2
- package/dist/kml/kml-loader-types.js.map +1 -1
- package/dist/kml/kml-writer.js +2 -2
- package/dist/kml/kml-writer.js.map +1 -1
- package/dist/kml/kmz-archive.js +1 -1
- package/dist/kml/kmz-archive.js.map +1 -1
- package/dist/kml/kmz-loader-types.js +1 -1
- package/dist/kml/kmz-source.js +1 -1
- package/dist/kml/tcx-loader-types.js +1 -1
- package/dist/kml.d.ts +1 -2
- package/dist/kml.d.ts.map +1 -1
- package/dist/kml.js +1 -1
- package/dist/kml.js.map +1 -1
- package/dist/shapefile/dbf-loader-types.js +1 -1
- package/dist/shapefile/dbf-loader.d.ts +1 -0
- package/dist/shapefile/dbf-loader.d.ts.map +1 -1
- package/dist/shapefile/index.cjs +9 -17
- package/dist/shapefile/index.cjs.map +2 -2
- package/dist/shapefile/shapefile-loader-types.d.ts +2 -2
- package/dist/shapefile/shapefile-loader-types.d.ts.map +1 -1
- package/dist/shapefile/shapefile-loader-types.js +2 -2
- package/dist/shapefile/shapefile-loader-types.js.map +1 -1
- package/dist/shapefile/shp-loader-types.js +1 -1
- package/dist/shapefile/shp-loader.d.ts +1 -0
- package/dist/shapefile/shp-loader.d.ts.map +1 -1
- package/dist/shapefile.d.ts +1 -2
- package/dist/shapefile.d.ts.map +1 -1
- package/dist/shapefile.js +1 -1
- package/dist/shapefile.js.map +1 -1
- package/dist/shp-worker.js +66 -17
- package/package.json +19 -14
- package/src/flatgeobuf/flatgeobuf-loader-types.ts +1 -1
- package/src/flatgeobuf.ts +1 -2
- package/src/geopackage/geopackage-loader-types.ts +3 -1
- package/src/geopackage.ts +1 -2
- package/src/kml/kml-loader-types.ts +1 -1
- package/src/kml/kml-writer.ts +1 -1
- package/src/kml/kmz-archive.ts +1 -1
- package/src/kml.ts +1 -2
- package/src/shapefile/shapefile-loader-types.ts +3 -1
- package/src/shapefile.ts +1 -2
|
@@ -243,6 +243,8 @@
|
|
|
243
243
|
process: processOnMainThread
|
|
244
244
|
};
|
|
245
245
|
WorkerBody.onmessage = async (type, payload) => {
|
|
246
|
+
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
247
|
+
const jobContext = { ...context, reportProgress: reporter?.report };
|
|
246
248
|
try {
|
|
247
249
|
switch (type) {
|
|
248
250
|
case "preload":
|
|
@@ -255,9 +257,10 @@
|
|
|
255
257
|
const result = await process(
|
|
256
258
|
payload.input,
|
|
257
259
|
payload.options || {},
|
|
258
|
-
|
|
260
|
+
jobContext,
|
|
259
261
|
payload.context || {}
|
|
260
262
|
);
|
|
263
|
+
reporter?.finish();
|
|
261
264
|
WorkerBody.postMessage("done", { result });
|
|
262
265
|
break;
|
|
263
266
|
case "process-in-batches":
|
|
@@ -272,13 +275,14 @@
|
|
|
272
275
|
const resultIterator = processInBatches(
|
|
273
276
|
createDemandDrivenIterator(inputBatches),
|
|
274
277
|
payload.options || {},
|
|
275
|
-
|
|
278
|
+
jobContext,
|
|
276
279
|
payload.context || {}
|
|
277
280
|
);
|
|
278
281
|
for await (const batch of resultIterator) {
|
|
279
282
|
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
280
283
|
await outputAcknowledgements.next();
|
|
281
284
|
}
|
|
285
|
+
reporter?.finish();
|
|
282
286
|
await WorkerBody.postMessage("done", {});
|
|
283
287
|
} finally {
|
|
284
288
|
activeInputBatches = null;
|
|
@@ -306,6 +310,7 @@
|
|
|
306
310
|
default:
|
|
307
311
|
}
|
|
308
312
|
} catch (error) {
|
|
313
|
+
reporter?.finish();
|
|
309
314
|
const message = error instanceof Error ? error.message : "";
|
|
310
315
|
WorkerBody.postMessage("error", { error: message });
|
|
311
316
|
}
|
|
@@ -345,6 +350,35 @@
|
|
|
345
350
|
WorkerBody.postMessage("process", payload);
|
|
346
351
|
});
|
|
347
352
|
}
|
|
353
|
+
function createProgressReporter() {
|
|
354
|
+
let pending;
|
|
355
|
+
let finished = false;
|
|
356
|
+
let scheduled = false;
|
|
357
|
+
const flush = () => {
|
|
358
|
+
scheduled = false;
|
|
359
|
+
if (pending) {
|
|
360
|
+
WorkerBody.postMessage("progress", { progress: pending });
|
|
361
|
+
pending = void 0;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
return {
|
|
365
|
+
/** Records progress while retaining phase transitions. */
|
|
366
|
+
report(progress) {
|
|
367
|
+
if (finished) return;
|
|
368
|
+
if (pending && pending.phase !== progress.phase) flush();
|
|
369
|
+
pending = { ...progress };
|
|
370
|
+
if (!scheduled) {
|
|
371
|
+
scheduled = true;
|
|
372
|
+
setTimeout(flush, 0);
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
376
|
+
finish() {
|
|
377
|
+
flush();
|
|
378
|
+
finished = true;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
348
382
|
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
349
383
|
var init_create_worker = __esm({
|
|
350
384
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
@@ -391,6 +425,7 @@
|
|
|
391
425
|
options,
|
|
392
426
|
context: {
|
|
393
427
|
...loaderContext,
|
|
428
|
+
reportProgress: workerContext?.reportProgress,
|
|
394
429
|
coreApi: createWorkerCoreApi(),
|
|
395
430
|
_parse: createParseOnMainThread(workerContext?.process)
|
|
396
431
|
}
|
|
@@ -401,8 +436,10 @@
|
|
|
401
436
|
if (!loader.parseInBatches) {
|
|
402
437
|
throw new Error(`${loader.id} loader does not support batched parsing`);
|
|
403
438
|
}
|
|
404
|
-
const
|
|
439
|
+
const parserOptions = getWorkerLoaderOptions(loader, options);
|
|
440
|
+
const resultIterator = loader.parseInBatches(inputIterator, parserOptions, {
|
|
405
441
|
...loaderContext,
|
|
442
|
+
reportProgress: workerContext?.reportProgress,
|
|
406
443
|
coreApi: createWorkerCoreApi(),
|
|
407
444
|
_parse: createParseOnMainThread(workerContext?.process)
|
|
408
445
|
});
|
|
@@ -458,7 +495,17 @@
|
|
|
458
495
|
if (!context) {
|
|
459
496
|
return void 0;
|
|
460
497
|
}
|
|
461
|
-
const {
|
|
498
|
+
const {
|
|
499
|
+
fetch: fetch2,
|
|
500
|
+
loaders,
|
|
501
|
+
coreApi,
|
|
502
|
+
signal,
|
|
503
|
+
reportProgress,
|
|
504
|
+
_parse,
|
|
505
|
+
_parseSync,
|
|
506
|
+
_parseInBatches,
|
|
507
|
+
...serializableContext
|
|
508
|
+
} = context;
|
|
462
509
|
return JSON.parse(JSON.stringify(serializableContext));
|
|
463
510
|
}
|
|
464
511
|
async function parseData({
|
|
@@ -479,18 +526,15 @@
|
|
|
479
526
|
} else {
|
|
480
527
|
throw new Error(`Could not load data with ${loader.name} loader`);
|
|
481
528
|
}
|
|
482
|
-
options =
|
|
529
|
+
options = getWorkerLoaderOptions(loader, options);
|
|
530
|
+
return await parser(data, { ...options }, context, loader);
|
|
531
|
+
}
|
|
532
|
+
function getWorkerLoaderOptions(loader, options) {
|
|
533
|
+
return {
|
|
483
534
|
...options,
|
|
484
|
-
modules: {
|
|
485
|
-
|
|
486
|
-
...options.modules || {}
|
|
487
|
-
},
|
|
488
|
-
core: {
|
|
489
|
-
...options.core,
|
|
490
|
-
worker: false
|
|
491
|
-
}
|
|
535
|
+
modules: { ...loader.options?.modules, ...options.modules },
|
|
536
|
+
core: { ...options.core, worker: false }
|
|
492
537
|
};
|
|
493
|
-
return await parser(data, { ...options }, context, loader);
|
|
494
538
|
}
|
|
495
539
|
var init_create_loader_worker = __esm({
|
|
496
540
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
@@ -1235,7 +1279,7 @@
|
|
|
1235
1279
|
function spheroidToCartesian(point, geometry, result = point) {
|
|
1236
1280
|
const longitude = point.x, latitude = point.y, height = point.z;
|
|
1237
1281
|
const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = geometry;
|
|
1238
|
-
const sin = Math.sin(latitude), cos = Math.cos(latitude);
|
|
1282
|
+
const sin = Math.sin(latitude), cos = Math.abs(latitude) === Math.PI / 2 ? 0 : Math.cos(latitude);
|
|
1239
1283
|
const ratio = b / a;
|
|
1240
1284
|
const radius2 = es < 0.9 ? a / Math.sqrt(1 - es * sin * sin) : a / Math.hypot(cos, ratio * sin);
|
|
1241
1285
|
const x = (radius2 + height) * cos * Math.cos(longitude);
|
|
@@ -1246,18 +1290,19 @@
|
|
|
1246
1290
|
function cartesianToSpheroid(point, geometry, result = point) {
|
|
1247
1291
|
const x = point.x, y = point.y, z = point.z;
|
|
1248
1292
|
const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = geometry;
|
|
1293
|
+
const longitude = Math.atan2(y, x);
|
|
1249
1294
|
const p = Math.hypot(x, y), rr = Math.hypot(x, y, z);
|
|
1250
1295
|
if (!(rr > 0) || !Number.isFinite(rr))
|
|
1251
1296
|
return false;
|
|
1252
1297
|
if (es === 0)
|
|
1253
|
-
return commit(result, p === 0 ? 0 :
|
|
1298
|
+
return commit(result, p === 0 ? 0 : longitude, Math.atan2(z, p), rr - a);
|
|
1254
1299
|
if (p === 0)
|
|
1255
1300
|
return commit(result, 0, Math.sign(z) * Math.PI / 2, Math.abs(z) - b);
|
|
1256
1301
|
const horizontal = p / a, vertical = z / b;
|
|
1257
|
-
if (horizontal * horizontal + vertical * vertical < 1 - 16 *
|
|
1302
|
+
if (horizontal * horizontal + vertical * vertical < 1 - 16 * EPSILON)
|
|
1258
1303
|
return interiorInverse(x, y, z, p, a, b, result);
|
|
1259
1304
|
if (es >= 0.9)
|
|
1260
|
-
return
|
|
1305
|
+
return interiorInverse(x, y, z, p, a, b, result);
|
|
1261
1306
|
const ct = z / rr, st = p / rr;
|
|
1262
1307
|
let rx = 1 / Math.sqrt(1 - es * (2 - es) * st * st);
|
|
1263
1308
|
let cos = st * (1 - es) * rx, sin = ct * rx;
|
|
@@ -1268,64 +1313,65 @@
|
|
|
1268
1313
|
rx = 1 / Math.sqrt(1 - rk * (2 - rk) * st * st);
|
|
1269
1314
|
const nextCos = st * (1 - rk) * rx, nextSin = ct * rx;
|
|
1270
1315
|
if (Math.abs(nextSin * cos - nextCos * sin) <= 1e-12) {
|
|
1271
|
-
if (!Number.isFinite(height)
|
|
1316
|
+
if (!Number.isFinite(height))
|
|
1272
1317
|
break;
|
|
1273
|
-
return commit(result,
|
|
1318
|
+
return commit(result, longitude, Math.atan2(nextSin, Math.abs(nextCos)), height);
|
|
1274
1319
|
}
|
|
1275
1320
|
cos = nextCos;
|
|
1276
1321
|
sin = nextSin;
|
|
1277
1322
|
}
|
|
1278
|
-
return
|
|
1323
|
+
return interiorInverse(x, y, z, p, a, b, result);
|
|
1279
1324
|
}
|
|
1280
1325
|
function interiorInverse(x, y, z, p, a, b, result) {
|
|
1326
|
+
const longitude = Math.atan2(y, x);
|
|
1281
1327
|
const ratio = b / a, ratio2 = ratio * ratio;
|
|
1282
1328
|
const horizontal = p / a, vertical = z / a, delta = 1 - ratio2;
|
|
1283
1329
|
if (!(ratio2 > 0) || ratio > 1)
|
|
1284
1330
|
return false;
|
|
1285
|
-
if (z === 0) {
|
|
1286
|
-
if (horizontal < delta)
|
|
1287
|
-
return false;
|
|
1288
|
-
return commit(result, Math.atan2(y, x), 0, p - a);
|
|
1289
|
-
}
|
|
1290
1331
|
const aa = a * a, bb = b * b;
|
|
1291
1332
|
const ratioError = Number.isFinite(aa) && aa > 0 ? (bb - ratio2 * aa + productError(b, b, bb) - ratio2 * productError(a, a, aa) - productError(ratio2, aa, ratio2 * aa)) / aa : 0;
|
|
1292
1333
|
const pp = p * p, xx = x * x, yy = y * y, sum = xx + yy;
|
|
1293
1334
|
const radiusError = Number.isFinite(pp) && pp > 0 ? (sum - pp + sumError(xx, yy, sum) + productError(x, x, xx) + productError(y, y, yy) - productError(p, p, pp)) / (2 * p) : 0;
|
|
1294
|
-
const shift = a * ratio2,
|
|
1295
|
-
const correction = radiusError + sumError(p -
|
|
1335
|
+
const shift = a * ratio2, distance = p - a, base = distance + shift;
|
|
1336
|
+
const correction = radiusError + sumError(p, -a, distance) + sumError(distance, shift, base) + productError(a, ratio2, shift) + a * ratioError;
|
|
1337
|
+
if (z === 0) {
|
|
1338
|
+
if (base + correction < 0)
|
|
1339
|
+
return false;
|
|
1340
|
+
return commit(result, longitude, 0, distance);
|
|
1341
|
+
}
|
|
1296
1342
|
const weighted = Math.abs(vertical) * ratio;
|
|
1297
|
-
|
|
1343
|
+
let lower = 0, upper = ratio2 + Math.hypot(horizontal, vertical * ratio);
|
|
1344
|
+
if (!Number.isFinite(upper))
|
|
1298
1345
|
return false;
|
|
1299
|
-
let lower = 0, upper = ratio2;
|
|
1300
1346
|
let t = Math.max(weighted, horizontal - delta);
|
|
1301
1347
|
if (!(t > lower && t < upper))
|
|
1302
1348
|
t = upper / 2;
|
|
1303
|
-
|
|
1349
|
+
const gap = -(base + correction) / a;
|
|
1350
|
+
const limiting = Math.sqrt(gap * (horizontal + delta)) / delta;
|
|
1351
|
+
let latitude = gap > 0 && Math.abs(z) / limiting / a * ratio <= EPSILON * gap ? Math.atan2(Math.sign(z) * limiting / ratio, horizontal / delta) : void 0;
|
|
1352
|
+
for (let i = 0; i < 1024 && latitude === void 0; i++) {
|
|
1304
1353
|
const equatorial = delta + t;
|
|
1305
|
-
const u = horizontal / equatorial,
|
|
1354
|
+
const u = horizontal / equatorial, verticalAt = z / t / a, v = verticalAt * ratio;
|
|
1306
1355
|
const at = a * t, difference = base - at;
|
|
1307
1356
|
const offset = (difference + (sumError(base, -at, difference) + correction - productError(a, t, at))) / (a * equatorial);
|
|
1308
1357
|
const term = offset * (u + 1);
|
|
1309
1358
|
const residual = term + v * v;
|
|
1310
|
-
if (
|
|
1311
|
-
|
|
1312
|
-
const sin = Math.sin(latitude), cos = Math.cos(latitude);
|
|
1313
|
-
return commit(result, Math.atan2(y, x), latitude, p * cos + z * sin - a * Math.hypot(cos, ratio * sin));
|
|
1314
|
-
}
|
|
1359
|
+
if (!Number.isFinite(residual))
|
|
1360
|
+
return false;
|
|
1315
1361
|
if (residual > 0)
|
|
1316
1362
|
lower = t;
|
|
1317
1363
|
else
|
|
1318
1364
|
upper = t;
|
|
1319
1365
|
const derivative = -2 * (u * u / equatorial + v * v / t);
|
|
1320
1366
|
const next = t - residual / derivative;
|
|
1321
|
-
const candidate =
|
|
1322
|
-
if (
|
|
1323
|
-
|
|
1324
|
-
|
|
1367
|
+
const candidate = next > lower && next < upper ? next : lower + (upper - lower) / 2;
|
|
1368
|
+
if (Math.abs(residual) <= 4 * EPSILON * (Math.abs(term) + v * v) || upper - lower <= 4 * EPSILON * t) {
|
|
1369
|
+
latitude = Math.atan2(verticalAt, u);
|
|
1370
|
+
break;
|
|
1325
1371
|
}
|
|
1326
1372
|
t = candidate;
|
|
1327
1373
|
}
|
|
1328
|
-
return
|
|
1374
|
+
return latitude !== void 0 && commitNormal(result, longitude, latitude, p, z, a, ratio);
|
|
1329
1375
|
}
|
|
1330
1376
|
function sumError(x, y, sum) {
|
|
1331
1377
|
const part = sum - x;
|
|
@@ -1338,35 +1384,9 @@
|
|
|
1338
1384
|
const hx = sx - (sx - x), hy = sy - (sy - y), lx = x - hx, ly = y - hy;
|
|
1339
1385
|
return hx * hy - product + hx * ly + lx * hy + lx * ly;
|
|
1340
1386
|
}
|
|
1341
|
-
function
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1344
|
-
if (!Number.isFinite(norm) || norm < 1 - 8 * Number.EPSILON || !(ratio2 > 0))
|
|
1345
|
-
return false;
|
|
1346
|
-
let lower = 0, upper = Math.hypot(horizontal, vertical * ratio);
|
|
1347
|
-
if (!Number.isFinite(upper))
|
|
1348
|
-
return false;
|
|
1349
|
-
let multiplier = norm <= 1 + 8 * Number.EPSILON ? 0 : upper / 2;
|
|
1350
|
-
for (let i = 0; i < 96; i++) {
|
|
1351
|
-
const equatorial = 1 + multiplier, polar = ratio2 + multiplier;
|
|
1352
|
-
const u = horizontal / equatorial, v = vertical * ratio / polar;
|
|
1353
|
-
const length = Math.hypot(u, v);
|
|
1354
|
-
const residual = length - 1;
|
|
1355
|
-
if (Math.abs(residual) <= 4 * Number.EPSILON) {
|
|
1356
|
-
const latitude = Math.atan2(vertical / polar, horizontal / equatorial);
|
|
1357
|
-
const sin = Math.sin(latitude), cos = Math.cos(latitude);
|
|
1358
|
-
const height = p * cos + z * sin - a * Math.hypot(cos, ratio * sin);
|
|
1359
|
-
return commit(result, Math.atan2(y, x), latitude, height);
|
|
1360
|
-
}
|
|
1361
|
-
if (residual > 0)
|
|
1362
|
-
lower = multiplier;
|
|
1363
|
-
else
|
|
1364
|
-
upper = multiplier;
|
|
1365
|
-
const derivative = -(u * u / equatorial + v * v / polar) / length;
|
|
1366
|
-
const next = multiplier - residual / derivative;
|
|
1367
|
-
multiplier = Number.isFinite(next) && next > lower && next < upper ? next : (lower + upper) / 2;
|
|
1368
|
-
}
|
|
1369
|
-
return false;
|
|
1387
|
+
function commitNormal(result, longitude, latitude, p, z, a, ratio) {
|
|
1388
|
+
const sin = Math.sin(latitude), cos = Math.cos(latitude);
|
|
1389
|
+
return commit(result, longitude, latitude, p * cos + z * sin - a * Math.hypot(cos, ratio * sin));
|
|
1370
1390
|
}
|
|
1371
1391
|
function commit(result, x, y, z) {
|
|
1372
1392
|
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
|
|
@@ -1376,8 +1396,1412 @@
|
|
|
1376
1396
|
result.z = z;
|
|
1377
1397
|
return true;
|
|
1378
1398
|
}
|
|
1399
|
+
var EPSILON;
|
|
1379
1400
|
var init_spheroid = __esm({
|
|
1380
1401
|
"../../node_modules/@math.gl/core/dist/spheroid.js"() {
|
|
1402
|
+
EPSILON = Number.EPSILON;
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
// ../../node_modules/@math.gl/geospatial/dist/vendor/geographiclib-geodesic/runtime.js
|
|
1407
|
+
var geodesic;
|
|
1408
|
+
var init_runtime = __esm({
|
|
1409
|
+
"../../node_modules/@math.gl/geospatial/dist/vendor/geographiclib-geodesic/runtime.js"() {
|
|
1410
|
+
geodesic = {};
|
|
1411
|
+
geodesic.Constants = {};
|
|
1412
|
+
geodesic.Math = {};
|
|
1413
|
+
geodesic.Accumulator = {};
|
|
1414
|
+
(function(c) {
|
|
1415
|
+
"use strict";
|
|
1416
|
+
c.WGS84 = { a: 6378137, f: 1 / 298.257223563 };
|
|
1417
|
+
c.version = {
|
|
1418
|
+
major: 2,
|
|
1419
|
+
minor: 2,
|
|
1420
|
+
patch: 0
|
|
1421
|
+
};
|
|
1422
|
+
c.version_string = "2.2.0";
|
|
1423
|
+
})(geodesic.Constants);
|
|
1424
|
+
(function(m) {
|
|
1425
|
+
"use strict";
|
|
1426
|
+
m.digits = 53;
|
|
1427
|
+
m.epsilon = Math.pow(0.5, m.digits - 1);
|
|
1428
|
+
m.degree = Math.PI / 180;
|
|
1429
|
+
m.sq = function(x) {
|
|
1430
|
+
return x * x;
|
|
1431
|
+
};
|
|
1432
|
+
m.hypot = function(x, y) {
|
|
1433
|
+
return Math.sqrt(x * x + y * y);
|
|
1434
|
+
};
|
|
1435
|
+
m.cbrt = Math.cbrt || function(x) {
|
|
1436
|
+
var y = Math.pow(Math.abs(x), 1 / 3);
|
|
1437
|
+
return x > 0 ? y : x < 0 ? -y : x;
|
|
1438
|
+
};
|
|
1439
|
+
m.log1p = Math.log1p || function(x) {
|
|
1440
|
+
var y = 1 + x, z = y - 1;
|
|
1441
|
+
return z === 0 ? x : x * Math.log(y) / z;
|
|
1442
|
+
};
|
|
1443
|
+
m.atanh = Math.atanh || function(x) {
|
|
1444
|
+
var y = Math.abs(x);
|
|
1445
|
+
y = m.log1p(2 * y / (1 - y)) / 2;
|
|
1446
|
+
return x > 0 ? y : x < 0 ? -y : x;
|
|
1447
|
+
};
|
|
1448
|
+
m.copysign = function(x, y) {
|
|
1449
|
+
return Math.abs(x) * (y < 0 || y === 0 && 1 / y < 0 ? -1 : 1);
|
|
1450
|
+
};
|
|
1451
|
+
m.sum = function(u, v) {
|
|
1452
|
+
var s = u + v, up = s - v, vpp = s - up, t;
|
|
1453
|
+
up -= u;
|
|
1454
|
+
vpp -= v;
|
|
1455
|
+
t = s ? 0 - (up + vpp) : s;
|
|
1456
|
+
return { s, t };
|
|
1457
|
+
};
|
|
1458
|
+
m.polyval = function(N, p, s, x) {
|
|
1459
|
+
var y = N < 0 ? 0 : p[s++];
|
|
1460
|
+
while (--N >= 0)
|
|
1461
|
+
y = y * x + p[s++];
|
|
1462
|
+
return y;
|
|
1463
|
+
};
|
|
1464
|
+
m.AngRound = function(x) {
|
|
1465
|
+
var z = 1 / 16, y = Math.abs(x);
|
|
1466
|
+
y = y < z ? z - (z - y) : y;
|
|
1467
|
+
return m.copysign(y, x);
|
|
1468
|
+
};
|
|
1469
|
+
m.remainder = function(x, y) {
|
|
1470
|
+
x %= y;
|
|
1471
|
+
return x < -y / 2 ? x + y : x < y / 2 ? x : x - y;
|
|
1472
|
+
};
|
|
1473
|
+
m.AngNormalize = function(x) {
|
|
1474
|
+
var y = m.remainder(x, 360);
|
|
1475
|
+
return Math.abs(y) === 180 ? m.copysign(180, x) : y;
|
|
1476
|
+
};
|
|
1477
|
+
m.LatFix = function(x) {
|
|
1478
|
+
return Math.abs(x) > 90 ? NaN : x;
|
|
1479
|
+
};
|
|
1480
|
+
m.AngDiff = function(x, y) {
|
|
1481
|
+
var r = m.sum(m.remainder(-x, 360), m.remainder(y, 360)), d, e;
|
|
1482
|
+
r = m.sum(m.remainder(r.s, 360), r.t);
|
|
1483
|
+
d = r.s;
|
|
1484
|
+
e = r.t;
|
|
1485
|
+
if (d === 0 || Math.abs(d) === 180)
|
|
1486
|
+
d = m.copysign(d, e === 0 ? y - x : -e);
|
|
1487
|
+
return { d, e };
|
|
1488
|
+
};
|
|
1489
|
+
m.sincosd = function(x) {
|
|
1490
|
+
var d, r, q, s, c, sinx, cosx;
|
|
1491
|
+
d = x % 360;
|
|
1492
|
+
q = Math.round(d / 90);
|
|
1493
|
+
d -= 90 * q;
|
|
1494
|
+
r = d * this.degree;
|
|
1495
|
+
s = Math.sin(r);
|
|
1496
|
+
c = Math.cos(r);
|
|
1497
|
+
if (Math.abs(d) === 45) {
|
|
1498
|
+
c = Math.sqrt(0.5);
|
|
1499
|
+
s = m.copysign(c, r);
|
|
1500
|
+
} else if (Math.abs(d) === 30) {
|
|
1501
|
+
c = Math.sqrt(0.75);
|
|
1502
|
+
s = m.copysign(0.5, r);
|
|
1503
|
+
}
|
|
1504
|
+
switch (q & 3) {
|
|
1505
|
+
case 0:
|
|
1506
|
+
sinx = s;
|
|
1507
|
+
cosx = c;
|
|
1508
|
+
break;
|
|
1509
|
+
case 1:
|
|
1510
|
+
sinx = c;
|
|
1511
|
+
cosx = -s;
|
|
1512
|
+
break;
|
|
1513
|
+
case 2:
|
|
1514
|
+
sinx = -s;
|
|
1515
|
+
cosx = -c;
|
|
1516
|
+
break;
|
|
1517
|
+
default:
|
|
1518
|
+
sinx = -c;
|
|
1519
|
+
cosx = s;
|
|
1520
|
+
break;
|
|
1521
|
+
}
|
|
1522
|
+
cosx += 0;
|
|
1523
|
+
if (sinx === 0)
|
|
1524
|
+
sinx = m.copysign(sinx, x);
|
|
1525
|
+
return { s: sinx, c: cosx };
|
|
1526
|
+
};
|
|
1527
|
+
m.sincosde = function(x, t) {
|
|
1528
|
+
var d, r, q, s, c, sinx, cosx;
|
|
1529
|
+
d = x % 360;
|
|
1530
|
+
q = Math.round(d / 90);
|
|
1531
|
+
d = m.AngRound(d - 90 * q + t);
|
|
1532
|
+
r = d * this.degree;
|
|
1533
|
+
s = Math.sin(r);
|
|
1534
|
+
c = Math.cos(r);
|
|
1535
|
+
if (Math.abs(d) === 45) {
|
|
1536
|
+
c = Math.sqrt(0.5);
|
|
1537
|
+
s = m.copysign(c, r);
|
|
1538
|
+
} else if (Math.abs(d) === 30) {
|
|
1539
|
+
c = Math.sqrt(0.75);
|
|
1540
|
+
s = m.copysign(0.5, r);
|
|
1541
|
+
}
|
|
1542
|
+
switch (q & 3) {
|
|
1543
|
+
case 0:
|
|
1544
|
+
sinx = s;
|
|
1545
|
+
cosx = c;
|
|
1546
|
+
break;
|
|
1547
|
+
case 1:
|
|
1548
|
+
sinx = c;
|
|
1549
|
+
cosx = -s;
|
|
1550
|
+
break;
|
|
1551
|
+
case 2:
|
|
1552
|
+
sinx = -s;
|
|
1553
|
+
cosx = -c;
|
|
1554
|
+
break;
|
|
1555
|
+
default:
|
|
1556
|
+
sinx = -c;
|
|
1557
|
+
cosx = s;
|
|
1558
|
+
break;
|
|
1559
|
+
}
|
|
1560
|
+
cosx += 0;
|
|
1561
|
+
if (sinx === 0)
|
|
1562
|
+
sinx = m.copysign(sinx, x + t);
|
|
1563
|
+
return { s: sinx, c: cosx };
|
|
1564
|
+
};
|
|
1565
|
+
m.atan2d = function(y, x) {
|
|
1566
|
+
var q = 0, ang;
|
|
1567
|
+
if (Math.abs(y) > Math.abs(x)) {
|
|
1568
|
+
[y, x] = [x, y];
|
|
1569
|
+
q = 2;
|
|
1570
|
+
}
|
|
1571
|
+
if (m.copysign(1, x) < 0) {
|
|
1572
|
+
x = -x;
|
|
1573
|
+
++q;
|
|
1574
|
+
}
|
|
1575
|
+
ang = Math.atan2(y, x) / this.degree;
|
|
1576
|
+
switch (q) {
|
|
1577
|
+
// Note that atan2d(-0.0, 1.0) will return -0. However, we expect that
|
|
1578
|
+
// atan2d will not be called with y = -0. If need be, include
|
|
1579
|
+
//
|
|
1580
|
+
// case 0: ang = 0 + ang; break;
|
|
1581
|
+
//
|
|
1582
|
+
// and handle mpfr as in AngRound.
|
|
1583
|
+
case 1:
|
|
1584
|
+
ang = m.copysign(180, y) - ang;
|
|
1585
|
+
break;
|
|
1586
|
+
case 2:
|
|
1587
|
+
ang = 90 - ang;
|
|
1588
|
+
break;
|
|
1589
|
+
case 3:
|
|
1590
|
+
ang = -90 + ang;
|
|
1591
|
+
break;
|
|
1592
|
+
default:
|
|
1593
|
+
break;
|
|
1594
|
+
}
|
|
1595
|
+
return ang;
|
|
1596
|
+
};
|
|
1597
|
+
})(geodesic.Math);
|
|
1598
|
+
(function(a, m) {
|
|
1599
|
+
"use strict";
|
|
1600
|
+
a.Accumulator = function(y) {
|
|
1601
|
+
this.Set(y);
|
|
1602
|
+
};
|
|
1603
|
+
a.Accumulator.prototype.Set = function(y) {
|
|
1604
|
+
if (!y)
|
|
1605
|
+
y = 0;
|
|
1606
|
+
if (y.constructor === a.Accumulator) {
|
|
1607
|
+
this._s = y._s;
|
|
1608
|
+
this._t = y._t;
|
|
1609
|
+
} else {
|
|
1610
|
+
this._s = y;
|
|
1611
|
+
this._t = 0;
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
a.Accumulator.prototype.Add = function(y) {
|
|
1615
|
+
var u = m.sum(y, this._t), v = m.sum(u.s, this._s);
|
|
1616
|
+
u = u.t;
|
|
1617
|
+
this._s = v.s;
|
|
1618
|
+
this._t = v.t;
|
|
1619
|
+
if (this._s === 0)
|
|
1620
|
+
this._s = u;
|
|
1621
|
+
else
|
|
1622
|
+
this._t += u;
|
|
1623
|
+
};
|
|
1624
|
+
a.Accumulator.prototype.Sum = function(y) {
|
|
1625
|
+
var b;
|
|
1626
|
+
if (!y)
|
|
1627
|
+
return this._s;
|
|
1628
|
+
else {
|
|
1629
|
+
b = new a.Accumulator(this);
|
|
1630
|
+
b.Add(y);
|
|
1631
|
+
return b._s;
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
a.Accumulator.prototype.Negate = function() {
|
|
1635
|
+
this._s *= -1;
|
|
1636
|
+
this._t *= -1;
|
|
1637
|
+
};
|
|
1638
|
+
a.Accumulator.prototype.Remainder = function(y) {
|
|
1639
|
+
this._s = m.remainder(this._s, y);
|
|
1640
|
+
this.Add(0);
|
|
1641
|
+
};
|
|
1642
|
+
})(geodesic.Accumulator, geodesic.Math);
|
|
1643
|
+
geodesic.Geodesic = {};
|
|
1644
|
+
geodesic.GeodesicLine = {};
|
|
1645
|
+
geodesic.PolygonArea = {};
|
|
1646
|
+
(function(g, l, p, m, c) {
|
|
1647
|
+
"use strict";
|
|
1648
|
+
var GEOGRAPHICLIB_GEODESIC_ORDER = 6, nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA3x_ = nA3_, nC3x_, nC4x_, maxit1_ = 20, maxit2_ = maxit1_ + m.digits + 10, tol0_ = m.epsilon, tol1_ = 200 * tol0_, tol2_ = Math.sqrt(tol0_), tolb_ = tol0_, xthresh_ = 1e3 * tol2_, CAP_NONE = 0, CAP_ALL = 31, OUT_ALL = 32640, astroid, A1m1f_coeff, C1f_coeff, C1pf_coeff, A2m1f_coeff, C2f_coeff, A3_coeff, C3_coeff, C4_coeff;
|
|
1649
|
+
g.tiny_ = Math.sqrt(Number.MIN_VALUE / Number.EPSILON);
|
|
1650
|
+
g.nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1651
|
+
g.nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1652
|
+
g.nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1653
|
+
g.nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1654
|
+
g.nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1655
|
+
nC3x_ = g.nC3_ * (g.nC3_ - 1) / 2;
|
|
1656
|
+
nC4x_ = g.nC4_ * (g.nC4_ + 1) / 2;
|
|
1657
|
+
g.CAP_C1 = 1 << 0;
|
|
1658
|
+
g.CAP_C1p = 1 << 1;
|
|
1659
|
+
g.CAP_C2 = 1 << 2;
|
|
1660
|
+
g.CAP_C3 = 1 << 3;
|
|
1661
|
+
g.CAP_C4 = 1 << 4;
|
|
1662
|
+
g.NONE = 0;
|
|
1663
|
+
g.ARC = 1 << 6;
|
|
1664
|
+
g.LATITUDE = 1 << 7 | CAP_NONE;
|
|
1665
|
+
g.LONGITUDE = 1 << 8 | g.CAP_C3;
|
|
1666
|
+
g.AZIMUTH = 1 << 9 | CAP_NONE;
|
|
1667
|
+
g.DISTANCE = 1 << 10 | g.CAP_C1;
|
|
1668
|
+
g.STANDARD = g.LATITUDE | g.LONGITUDE | g.AZIMUTH | g.DISTANCE;
|
|
1669
|
+
g.DISTANCE_IN = 1 << 11 | g.CAP_C1 | g.CAP_C1p;
|
|
1670
|
+
g.REDUCEDLENGTH = 1 << 12 | g.CAP_C1 | g.CAP_C2;
|
|
1671
|
+
g.GEODESICSCALE = 1 << 13 | g.CAP_C1 | g.CAP_C2;
|
|
1672
|
+
g.AREA = 1 << 14 | g.CAP_C4;
|
|
1673
|
+
g.ALL = OUT_ALL | CAP_ALL;
|
|
1674
|
+
g.LONG_UNROLL = 1 << 15;
|
|
1675
|
+
g.OUT_MASK = OUT_ALL | g.LONG_UNROLL;
|
|
1676
|
+
g.SinCosSeries = function(sinp, sinx, cosx, c2, delta) {
|
|
1677
|
+
if (delta !== void 0) {
|
|
1678
|
+
var h = delta / 2, sh = Math.sin(h), ch = Math.cos(h);
|
|
1679
|
+
return -2 * g.SinCosSeries(false, cosx * ch - sinx * sh, sinx * ch + cosx * sh, c2.map(function(v, i) {
|
|
1680
|
+
return (i % 2 ? -v : v) * Math.sin((2 * i + 1) * h);
|
|
1681
|
+
}));
|
|
1682
|
+
}
|
|
1683
|
+
var k = c2.length, n = k - (sinp ? 1 : 0), ar = 2 * (cosx - sinx) * (cosx + sinx), y0 = n & 1 ? c2[--k] : 0, y1 = 0;
|
|
1684
|
+
n = Math.floor(n / 2);
|
|
1685
|
+
while (n--) {
|
|
1686
|
+
y1 = ar * y0 - y1 + c2[--k];
|
|
1687
|
+
y0 = ar * y1 - y0 + c2[--k];
|
|
1688
|
+
}
|
|
1689
|
+
return sinp ? 2 * sinx * cosx * y0 : (
|
|
1690
|
+
// sin(2 * x) * y0
|
|
1691
|
+
cosx * (y0 - y1)
|
|
1692
|
+
);
|
|
1693
|
+
};
|
|
1694
|
+
astroid = function(x, y) {
|
|
1695
|
+
var k, p2 = m.sq(x), q = m.sq(y), r = (p2 + q - 1) / 6, S, r2, r3, disc, u, T3, T, ang, v, uv, w;
|
|
1696
|
+
if (!(q === 0 && r <= 0)) {
|
|
1697
|
+
S = p2 * q / 4;
|
|
1698
|
+
r2 = m.sq(r);
|
|
1699
|
+
r3 = r * r2;
|
|
1700
|
+
disc = S * (S + 2 * r3);
|
|
1701
|
+
u = r;
|
|
1702
|
+
if (disc >= 0) {
|
|
1703
|
+
T3 = S + r3;
|
|
1704
|
+
T3 += T3 < 0 ? -Math.sqrt(disc) : Math.sqrt(disc);
|
|
1705
|
+
T = m.cbrt(T3);
|
|
1706
|
+
u += T + (T !== 0 ? r2 / T : 0);
|
|
1707
|
+
} else {
|
|
1708
|
+
ang = Math.atan2(Math.sqrt(-disc), -(S + r3));
|
|
1709
|
+
u += 2 * r * Math.cos(ang / 3);
|
|
1710
|
+
}
|
|
1711
|
+
v = Math.sqrt(m.sq(u) + q);
|
|
1712
|
+
uv = u < 0 ? q / (v - u) : u + v;
|
|
1713
|
+
w = (uv - q) / (2 * v);
|
|
1714
|
+
k = uv / (Math.sqrt(uv + m.sq(w)) + w);
|
|
1715
|
+
} else {
|
|
1716
|
+
k = 0;
|
|
1717
|
+
}
|
|
1718
|
+
return k;
|
|
1719
|
+
};
|
|
1720
|
+
A1m1f_coeff = [
|
|
1721
|
+
// (1-eps)*A1-1, polynomial in eps2 of order 3
|
|
1722
|
+
1,
|
|
1723
|
+
4,
|
|
1724
|
+
64,
|
|
1725
|
+
0,
|
|
1726
|
+
256
|
|
1727
|
+
];
|
|
1728
|
+
g.A1m1f = function(eps) {
|
|
1729
|
+
var p2 = Math.floor(nA1_ / 2), t = m.polyval(p2, A1m1f_coeff, 0, m.sq(eps)) / A1m1f_coeff[p2 + 1];
|
|
1730
|
+
return (t + eps) / (1 - eps);
|
|
1731
|
+
};
|
|
1732
|
+
C1f_coeff = [
|
|
1733
|
+
// C1[1]/eps^1, polynomial in eps2 of order 2
|
|
1734
|
+
-1,
|
|
1735
|
+
6,
|
|
1736
|
+
-16,
|
|
1737
|
+
32,
|
|
1738
|
+
// C1[2]/eps^2, polynomial in eps2 of order 2
|
|
1739
|
+
-9,
|
|
1740
|
+
64,
|
|
1741
|
+
-128,
|
|
1742
|
+
2048,
|
|
1743
|
+
// C1[3]/eps^3, polynomial in eps2 of order 1
|
|
1744
|
+
9,
|
|
1745
|
+
-16,
|
|
1746
|
+
768,
|
|
1747
|
+
// C1[4]/eps^4, polynomial in eps2 of order 1
|
|
1748
|
+
3,
|
|
1749
|
+
-5,
|
|
1750
|
+
512,
|
|
1751
|
+
// C1[5]/eps^5, polynomial in eps2 of order 0
|
|
1752
|
+
-7,
|
|
1753
|
+
1280,
|
|
1754
|
+
// C1[6]/eps^6, polynomial in eps2 of order 0
|
|
1755
|
+
-7,
|
|
1756
|
+
2048
|
|
1757
|
+
];
|
|
1758
|
+
g.C1f = function(eps, c2) {
|
|
1759
|
+
var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
|
|
1760
|
+
for (l2 = 1; l2 <= g.nC1_; ++l2) {
|
|
1761
|
+
p2 = Math.floor((g.nC1_ - l2) / 2);
|
|
1762
|
+
c2[l2] = d * m.polyval(p2, C1f_coeff, o, eps2) / C1f_coeff[o + p2 + 1];
|
|
1763
|
+
o += p2 + 2;
|
|
1764
|
+
d *= eps;
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
C1pf_coeff = [
|
|
1768
|
+
// C1p[1]/eps^1, polynomial in eps2 of order 2
|
|
1769
|
+
205,
|
|
1770
|
+
-432,
|
|
1771
|
+
768,
|
|
1772
|
+
1536,
|
|
1773
|
+
// C1p[2]/eps^2, polynomial in eps2 of order 2
|
|
1774
|
+
4005,
|
|
1775
|
+
-4736,
|
|
1776
|
+
3840,
|
|
1777
|
+
12288,
|
|
1778
|
+
// C1p[3]/eps^3, polynomial in eps2 of order 1
|
|
1779
|
+
-225,
|
|
1780
|
+
116,
|
|
1781
|
+
384,
|
|
1782
|
+
// C1p[4]/eps^4, polynomial in eps2 of order 1
|
|
1783
|
+
-7173,
|
|
1784
|
+
2695,
|
|
1785
|
+
7680,
|
|
1786
|
+
// C1p[5]/eps^5, polynomial in eps2 of order 0
|
|
1787
|
+
3467,
|
|
1788
|
+
7680,
|
|
1789
|
+
// C1p[6]/eps^6, polynomial in eps2 of order 0
|
|
1790
|
+
38081,
|
|
1791
|
+
61440
|
|
1792
|
+
];
|
|
1793
|
+
g.C1pf = function(eps, c2) {
|
|
1794
|
+
var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
|
|
1795
|
+
for (l2 = 1; l2 <= g.nC1p_; ++l2) {
|
|
1796
|
+
p2 = Math.floor((g.nC1p_ - l2) / 2);
|
|
1797
|
+
c2[l2] = d * m.polyval(p2, C1pf_coeff, o, eps2) / C1pf_coeff[o + p2 + 1];
|
|
1798
|
+
o += p2 + 2;
|
|
1799
|
+
d *= eps;
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
A2m1f_coeff = [
|
|
1803
|
+
// (eps+1)*A2-1, polynomial in eps2 of order 3
|
|
1804
|
+
-11,
|
|
1805
|
+
-28,
|
|
1806
|
+
-192,
|
|
1807
|
+
0,
|
|
1808
|
+
256
|
|
1809
|
+
];
|
|
1810
|
+
g.A2m1f = function(eps) {
|
|
1811
|
+
var p2 = Math.floor(nA2_ / 2), t = m.polyval(p2, A2m1f_coeff, 0, m.sq(eps)) / A2m1f_coeff[p2 + 1];
|
|
1812
|
+
return (t - eps) / (1 + eps);
|
|
1813
|
+
};
|
|
1814
|
+
C2f_coeff = [
|
|
1815
|
+
// C2[1]/eps^1, polynomial in eps2 of order 2
|
|
1816
|
+
1,
|
|
1817
|
+
2,
|
|
1818
|
+
16,
|
|
1819
|
+
32,
|
|
1820
|
+
// C2[2]/eps^2, polynomial in eps2 of order 2
|
|
1821
|
+
35,
|
|
1822
|
+
64,
|
|
1823
|
+
384,
|
|
1824
|
+
2048,
|
|
1825
|
+
// C2[3]/eps^3, polynomial in eps2 of order 1
|
|
1826
|
+
15,
|
|
1827
|
+
80,
|
|
1828
|
+
768,
|
|
1829
|
+
// C2[4]/eps^4, polynomial in eps2 of order 1
|
|
1830
|
+
7,
|
|
1831
|
+
35,
|
|
1832
|
+
512,
|
|
1833
|
+
// C2[5]/eps^5, polynomial in eps2 of order 0
|
|
1834
|
+
63,
|
|
1835
|
+
1280,
|
|
1836
|
+
// C2[6]/eps^6, polynomial in eps2 of order 0
|
|
1837
|
+
77,
|
|
1838
|
+
2048
|
|
1839
|
+
];
|
|
1840
|
+
g.C2f = function(eps, c2) {
|
|
1841
|
+
var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
|
|
1842
|
+
for (l2 = 1; l2 <= g.nC2_; ++l2) {
|
|
1843
|
+
p2 = Math.floor((g.nC2_ - l2) / 2);
|
|
1844
|
+
c2[l2] = d * m.polyval(p2, C2f_coeff, o, eps2) / C2f_coeff[o + p2 + 1];
|
|
1845
|
+
o += p2 + 2;
|
|
1846
|
+
d *= eps;
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
g.Geodesic = function(a, f) {
|
|
1850
|
+
this.a = a;
|
|
1851
|
+
this.f = f;
|
|
1852
|
+
this._f1 = 1 - this.f;
|
|
1853
|
+
this._e2 = this.f * (2 - this.f);
|
|
1854
|
+
this._ep2 = this._e2 / m.sq(this._f1);
|
|
1855
|
+
this._n = this.f / (2 - this.f);
|
|
1856
|
+
this._b = this.a * this._f1;
|
|
1857
|
+
this._c2 = (m.sq(this.a) + m.sq(this._b) * (this._e2 === 0 ? 1 : (this._e2 > 0 ? m.atanh(Math.sqrt(this._e2)) : Math.atan(Math.sqrt(-this._e2))) / Math.sqrt(Math.abs(this._e2)))) / 2;
|
|
1858
|
+
this._etol2 = 0.1 * tol2_ / Math.sqrt(Math.max(1e-3, Math.abs(this.f)) * Math.min(1, 1 - this.f / 2) / 2);
|
|
1859
|
+
if (!(isFinite(this.a) && this.a > 0))
|
|
1860
|
+
throw new Error("Equatorial radius is not positive");
|
|
1861
|
+
if (!(isFinite(this._b) && this._b > 0))
|
|
1862
|
+
throw new Error("Polar semi-axis is not positive");
|
|
1863
|
+
this._A3x = new Array(nA3x_);
|
|
1864
|
+
this._C3x = new Array(nC3x_);
|
|
1865
|
+
this._C4x = new Array(nC4x_);
|
|
1866
|
+
this.A3coeff();
|
|
1867
|
+
this.C3coeff();
|
|
1868
|
+
this.C4coeff();
|
|
1869
|
+
};
|
|
1870
|
+
A3_coeff = [
|
|
1871
|
+
// A3, coeff of eps^5, polynomial in n of order 0
|
|
1872
|
+
-3,
|
|
1873
|
+
128,
|
|
1874
|
+
// A3, coeff of eps^4, polynomial in n of order 1
|
|
1875
|
+
-2,
|
|
1876
|
+
-3,
|
|
1877
|
+
64,
|
|
1878
|
+
// A3, coeff of eps^3, polynomial in n of order 2
|
|
1879
|
+
-1,
|
|
1880
|
+
-3,
|
|
1881
|
+
-1,
|
|
1882
|
+
16,
|
|
1883
|
+
// A3, coeff of eps^2, polynomial in n of order 2
|
|
1884
|
+
3,
|
|
1885
|
+
-1,
|
|
1886
|
+
-2,
|
|
1887
|
+
8,
|
|
1888
|
+
// A3, coeff of eps^1, polynomial in n of order 1
|
|
1889
|
+
1,
|
|
1890
|
+
-1,
|
|
1891
|
+
2,
|
|
1892
|
+
// A3, coeff of eps^0, polynomial in n of order 0
|
|
1893
|
+
1,
|
|
1894
|
+
1
|
|
1895
|
+
];
|
|
1896
|
+
g.Geodesic.prototype.A3coeff = function() {
|
|
1897
|
+
var o = 0, k = 0, j, p2;
|
|
1898
|
+
for (j = nA3_ - 1; j >= 0; --j) {
|
|
1899
|
+
p2 = Math.min(nA3_ - j - 1, j);
|
|
1900
|
+
this._A3x[k++] = m.polyval(p2, A3_coeff, o, this._n) / A3_coeff[o + p2 + 1];
|
|
1901
|
+
o += p2 + 2;
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
C3_coeff = [
|
|
1905
|
+
// C3[1], coeff of eps^5, polynomial in n of order 0
|
|
1906
|
+
3,
|
|
1907
|
+
128,
|
|
1908
|
+
// C3[1], coeff of eps^4, polynomial in n of order 1
|
|
1909
|
+
2,
|
|
1910
|
+
5,
|
|
1911
|
+
128,
|
|
1912
|
+
// C3[1], coeff of eps^3, polynomial in n of order 2
|
|
1913
|
+
-1,
|
|
1914
|
+
3,
|
|
1915
|
+
3,
|
|
1916
|
+
64,
|
|
1917
|
+
// C3[1], coeff of eps^2, polynomial in n of order 2
|
|
1918
|
+
-1,
|
|
1919
|
+
0,
|
|
1920
|
+
1,
|
|
1921
|
+
8,
|
|
1922
|
+
// C3[1], coeff of eps^1, polynomial in n of order 1
|
|
1923
|
+
-1,
|
|
1924
|
+
1,
|
|
1925
|
+
4,
|
|
1926
|
+
// C3[2], coeff of eps^5, polynomial in n of order 0
|
|
1927
|
+
5,
|
|
1928
|
+
256,
|
|
1929
|
+
// C3[2], coeff of eps^4, polynomial in n of order 1
|
|
1930
|
+
1,
|
|
1931
|
+
3,
|
|
1932
|
+
128,
|
|
1933
|
+
// C3[2], coeff of eps^3, polynomial in n of order 2
|
|
1934
|
+
-3,
|
|
1935
|
+
-2,
|
|
1936
|
+
3,
|
|
1937
|
+
64,
|
|
1938
|
+
// C3[2], coeff of eps^2, polynomial in n of order 2
|
|
1939
|
+
1,
|
|
1940
|
+
-3,
|
|
1941
|
+
2,
|
|
1942
|
+
32,
|
|
1943
|
+
// C3[3], coeff of eps^5, polynomial in n of order 0
|
|
1944
|
+
7,
|
|
1945
|
+
512,
|
|
1946
|
+
// C3[3], coeff of eps^4, polynomial in n of order 1
|
|
1947
|
+
-10,
|
|
1948
|
+
9,
|
|
1949
|
+
384,
|
|
1950
|
+
// C3[3], coeff of eps^3, polynomial in n of order 2
|
|
1951
|
+
5,
|
|
1952
|
+
-9,
|
|
1953
|
+
5,
|
|
1954
|
+
192,
|
|
1955
|
+
// C3[4], coeff of eps^5, polynomial in n of order 0
|
|
1956
|
+
7,
|
|
1957
|
+
512,
|
|
1958
|
+
// C3[4], coeff of eps^4, polynomial in n of order 1
|
|
1959
|
+
-14,
|
|
1960
|
+
7,
|
|
1961
|
+
512,
|
|
1962
|
+
// C3[5], coeff of eps^5, polynomial in n of order 0
|
|
1963
|
+
21,
|
|
1964
|
+
2560
|
|
1965
|
+
];
|
|
1966
|
+
g.Geodesic.prototype.C3coeff = function() {
|
|
1967
|
+
var o = 0, k = 0, l2, j, p2;
|
|
1968
|
+
for (l2 = 1; l2 < g.nC3_; ++l2) {
|
|
1969
|
+
for (j = g.nC3_ - 1; j >= l2; --j) {
|
|
1970
|
+
p2 = Math.min(g.nC3_ - j - 1, j);
|
|
1971
|
+
this._C3x[k++] = m.polyval(p2, C3_coeff, o, this._n) / C3_coeff[o + p2 + 1];
|
|
1972
|
+
o += p2 + 2;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
};
|
|
1976
|
+
C4_coeff = [
|
|
1977
|
+
// C4[0], coeff of eps^5, polynomial in n of order 0
|
|
1978
|
+
97,
|
|
1979
|
+
15015,
|
|
1980
|
+
// C4[0], coeff of eps^4, polynomial in n of order 1
|
|
1981
|
+
1088,
|
|
1982
|
+
156,
|
|
1983
|
+
45045,
|
|
1984
|
+
// C4[0], coeff of eps^3, polynomial in n of order 2
|
|
1985
|
+
-224,
|
|
1986
|
+
-4784,
|
|
1987
|
+
1573,
|
|
1988
|
+
45045,
|
|
1989
|
+
// C4[0], coeff of eps^2, polynomial in n of order 3
|
|
1990
|
+
-10656,
|
|
1991
|
+
14144,
|
|
1992
|
+
-4576,
|
|
1993
|
+
-858,
|
|
1994
|
+
45045,
|
|
1995
|
+
// C4[0], coeff of eps^1, polynomial in n of order 4
|
|
1996
|
+
64,
|
|
1997
|
+
624,
|
|
1998
|
+
-4576,
|
|
1999
|
+
6864,
|
|
2000
|
+
-3003,
|
|
2001
|
+
15015,
|
|
2002
|
+
// C4[0], coeff of eps^0, polynomial in n of order 5
|
|
2003
|
+
100,
|
|
2004
|
+
208,
|
|
2005
|
+
572,
|
|
2006
|
+
3432,
|
|
2007
|
+
-12012,
|
|
2008
|
+
30030,
|
|
2009
|
+
45045,
|
|
2010
|
+
// C4[1], coeff of eps^5, polynomial in n of order 0
|
|
2011
|
+
1,
|
|
2012
|
+
9009,
|
|
2013
|
+
// C4[1], coeff of eps^4, polynomial in n of order 1
|
|
2014
|
+
-2944,
|
|
2015
|
+
468,
|
|
2016
|
+
135135,
|
|
2017
|
+
// C4[1], coeff of eps^3, polynomial in n of order 2
|
|
2018
|
+
5792,
|
|
2019
|
+
1040,
|
|
2020
|
+
-1287,
|
|
2021
|
+
135135,
|
|
2022
|
+
// C4[1], coeff of eps^2, polynomial in n of order 3
|
|
2023
|
+
5952,
|
|
2024
|
+
-11648,
|
|
2025
|
+
9152,
|
|
2026
|
+
-2574,
|
|
2027
|
+
135135,
|
|
2028
|
+
// C4[1], coeff of eps^1, polynomial in n of order 4
|
|
2029
|
+
-64,
|
|
2030
|
+
-624,
|
|
2031
|
+
4576,
|
|
2032
|
+
-6864,
|
|
2033
|
+
3003,
|
|
2034
|
+
135135,
|
|
2035
|
+
// C4[2], coeff of eps^5, polynomial in n of order 0
|
|
2036
|
+
8,
|
|
2037
|
+
10725,
|
|
2038
|
+
// C4[2], coeff of eps^4, polynomial in n of order 1
|
|
2039
|
+
1856,
|
|
2040
|
+
-936,
|
|
2041
|
+
225225,
|
|
2042
|
+
// C4[2], coeff of eps^3, polynomial in n of order 2
|
|
2043
|
+
-8448,
|
|
2044
|
+
4992,
|
|
2045
|
+
-1144,
|
|
2046
|
+
225225,
|
|
2047
|
+
// C4[2], coeff of eps^2, polynomial in n of order 3
|
|
2048
|
+
-1440,
|
|
2049
|
+
4160,
|
|
2050
|
+
-4576,
|
|
2051
|
+
1716,
|
|
2052
|
+
225225,
|
|
2053
|
+
// C4[3], coeff of eps^5, polynomial in n of order 0
|
|
2054
|
+
-136,
|
|
2055
|
+
63063,
|
|
2056
|
+
// C4[3], coeff of eps^4, polynomial in n of order 1
|
|
2057
|
+
1024,
|
|
2058
|
+
-208,
|
|
2059
|
+
105105,
|
|
2060
|
+
// C4[3], coeff of eps^3, polynomial in n of order 2
|
|
2061
|
+
3584,
|
|
2062
|
+
-3328,
|
|
2063
|
+
1144,
|
|
2064
|
+
315315,
|
|
2065
|
+
// C4[4], coeff of eps^5, polynomial in n of order 0
|
|
2066
|
+
-128,
|
|
2067
|
+
135135,
|
|
2068
|
+
// C4[4], coeff of eps^4, polynomial in n of order 1
|
|
2069
|
+
-2560,
|
|
2070
|
+
832,
|
|
2071
|
+
405405,
|
|
2072
|
+
// C4[5], coeff of eps^5, polynomial in n of order 0
|
|
2073
|
+
128,
|
|
2074
|
+
99099
|
|
2075
|
+
];
|
|
2076
|
+
g.Geodesic.prototype.C4coeff = function() {
|
|
2077
|
+
var o = 0, k = 0, l2, j, p2;
|
|
2078
|
+
for (l2 = 0; l2 < g.nC4_; ++l2) {
|
|
2079
|
+
for (j = g.nC4_ - 1; j >= l2; --j) {
|
|
2080
|
+
p2 = g.nC4_ - j - 1;
|
|
2081
|
+
this._C4x[k++] = m.polyval(p2, C4_coeff, o, this._n) / C4_coeff[o + p2 + 1];
|
|
2082
|
+
o += p2 + 2;
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
};
|
|
2086
|
+
g.Geodesic.prototype.A3f = function(eps) {
|
|
2087
|
+
return m.polyval(nA3x_ - 1, this._A3x, 0, eps);
|
|
2088
|
+
};
|
|
2089
|
+
g.Geodesic.prototype.C3f = function(eps, c2) {
|
|
2090
|
+
var mult = 1, o = 0, l2, p2;
|
|
2091
|
+
for (l2 = 1; l2 < g.nC3_; ++l2) {
|
|
2092
|
+
p2 = g.nC3_ - l2 - 1;
|
|
2093
|
+
mult *= eps;
|
|
2094
|
+
c2[l2] = mult * m.polyval(p2, this._C3x, o, eps);
|
|
2095
|
+
o += p2 + 1;
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
g.Geodesic.prototype.C4f = function(eps, c2) {
|
|
2099
|
+
var mult = 1, o = 0, l2, p2;
|
|
2100
|
+
for (l2 = 0; l2 < g.nC4_; ++l2) {
|
|
2101
|
+
p2 = g.nC4_ - l2 - 1;
|
|
2102
|
+
c2[l2] = mult * m.polyval(p2, this._C4x, o, eps);
|
|
2103
|
+
o += p2 + 1;
|
|
2104
|
+
mult *= eps;
|
|
2105
|
+
}
|
|
2106
|
+
};
|
|
2107
|
+
g.Geodesic.prototype.Lengths = function(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask, C1a, C2a) {
|
|
2108
|
+
outmask &= g.OUT_MASK;
|
|
2109
|
+
var vals = {}, m0x = 0, J12 = 0, A12 = 0, A22 = 0, B1, B2, l2, csig12, t;
|
|
2110
|
+
if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2111
|
+
A12 = g.A1m1f(eps);
|
|
2112
|
+
g.C1f(eps, C1a);
|
|
2113
|
+
if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2114
|
+
A22 = g.A2m1f(eps);
|
|
2115
|
+
g.C2f(eps, C2a);
|
|
2116
|
+
m0x = A12 - A22;
|
|
2117
|
+
A22 = 1 + A22;
|
|
2118
|
+
}
|
|
2119
|
+
A12 = 1 + A12;
|
|
2120
|
+
}
|
|
2121
|
+
if (outmask & g.DISTANCE) {
|
|
2122
|
+
B1 = g.SinCosSeries(true, ssig2, csig2, C1a) - g.SinCosSeries(true, ssig1, csig1, C1a);
|
|
2123
|
+
vals.s12b = A12 * (sig12 + B1);
|
|
2124
|
+
if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2125
|
+
B2 = g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a);
|
|
2126
|
+
J12 = m0x * sig12 + (A12 * B1 - A22 * B2);
|
|
2127
|
+
}
|
|
2128
|
+
} else if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2129
|
+
for (l2 = 1; l2 <= g.nC2_; ++l2)
|
|
2130
|
+
C2a[l2] = A12 * C1a[l2] - A22 * C2a[l2];
|
|
2131
|
+
J12 = m0x * sig12 + (g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a));
|
|
2132
|
+
}
|
|
2133
|
+
if (outmask & g.REDUCEDLENGTH) {
|
|
2134
|
+
vals.m0 = m0x;
|
|
2135
|
+
vals.m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12;
|
|
2136
|
+
} else
|
|
2137
|
+
vals.m12b = NaN;
|
|
2138
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2139
|
+
csig12 = csig1 * csig2 + ssig1 * ssig2;
|
|
2140
|
+
t = this._ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2);
|
|
2141
|
+
vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1;
|
|
2142
|
+
vals.M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2;
|
|
2143
|
+
}
|
|
2144
|
+
return vals;
|
|
2145
|
+
};
|
|
2146
|
+
g.Geodesic.prototype.InverseStart = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a) {
|
|
2147
|
+
var vals = {}, sbet12 = sbet2 * cbet1 - cbet2 * sbet1, cbet12 = cbet2 * cbet1 + sbet2 * sbet1, sbet12a, shortline, omg12, sbetm2, somg12, comg12, t, ssig12, csig12, x, y, lamscale, betscale, k2, eps, cbet12a, bet12a, m12b, m0, nvals, k, omg12a, lam12x;
|
|
2148
|
+
vals.sig12 = -1;
|
|
2149
|
+
sbet12a = sbet2 * cbet1;
|
|
2150
|
+
sbet12a += cbet2 * sbet1;
|
|
2151
|
+
shortline = cbet12 >= 0 && sbet12 < 0.5 && cbet2 * lam12 < 0.5;
|
|
2152
|
+
if (shortline) {
|
|
2153
|
+
sbetm2 = m.sq(sbet1 + sbet2);
|
|
2154
|
+
sbetm2 /= sbetm2 + m.sq(cbet1 + cbet2);
|
|
2155
|
+
vals.dnm = Math.sqrt(1 + this._ep2 * sbetm2);
|
|
2156
|
+
omg12 = lam12 / (this._f1 * vals.dnm);
|
|
2157
|
+
somg12 = Math.sin(omg12);
|
|
2158
|
+
comg12 = Math.cos(omg12);
|
|
2159
|
+
} else {
|
|
2160
|
+
somg12 = slam12;
|
|
2161
|
+
comg12 = clam12;
|
|
2162
|
+
}
|
|
2163
|
+
vals.salp1 = cbet2 * somg12;
|
|
2164
|
+
vals.calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * m.sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
|
|
2165
|
+
ssig12 = m.hypot(vals.salp1, vals.calp1);
|
|
2166
|
+
csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12;
|
|
2167
|
+
if (shortline && ssig12 < this._etol2) {
|
|
2168
|
+
vals.salp2 = cbet1 * somg12;
|
|
2169
|
+
vals.calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? m.sq(somg12) / (1 + comg12) : 1 - comg12);
|
|
2170
|
+
t = m.hypot(vals.salp2, vals.calp2);
|
|
2171
|
+
vals.salp2 /= t;
|
|
2172
|
+
vals.calp2 /= t;
|
|
2173
|
+
vals.sig12 = Math.atan2(ssig12, csig12);
|
|
2174
|
+
} else if (Math.abs(this._n) > 0.1 || // Skip astroid calc if too eccentric
|
|
2175
|
+
csig12 >= 0 || ssig12 >= 6 * Math.abs(this._n) * Math.PI * m.sq(cbet1)) {
|
|
2176
|
+
} else {
|
|
2177
|
+
lam12x = Math.atan2(-slam12, -clam12);
|
|
2178
|
+
if (this.f >= 0) {
|
|
2179
|
+
k2 = m.sq(sbet1) * this._ep2;
|
|
2180
|
+
eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
|
|
2181
|
+
lamscale = this.f * cbet1 * this.A3f(eps) * Math.PI;
|
|
2182
|
+
betscale = lamscale * cbet1;
|
|
2183
|
+
x = lam12x / lamscale;
|
|
2184
|
+
y = sbet12a / betscale;
|
|
2185
|
+
} else {
|
|
2186
|
+
cbet12a = cbet2 * cbet1 - sbet2 * sbet1;
|
|
2187
|
+
bet12a = Math.atan2(sbet12a, cbet12a);
|
|
2188
|
+
nvals = this.Lengths(this._n, Math.PI + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
|
|
2189
|
+
m12b = nvals.m12b;
|
|
2190
|
+
m0 = nvals.m0;
|
|
2191
|
+
x = -1 + m12b / (cbet1 * cbet2 * m0 * Math.PI);
|
|
2192
|
+
betscale = x < -0.01 ? sbet12a / x : -this.f * m.sq(cbet1) * Math.PI;
|
|
2193
|
+
lamscale = betscale / cbet1;
|
|
2194
|
+
y = lam12 / lamscale;
|
|
2195
|
+
}
|
|
2196
|
+
if (y > -tol1_ && x > -1 - xthresh_) {
|
|
2197
|
+
if (this.f >= 0) {
|
|
2198
|
+
vals.salp1 = Math.min(1, -x);
|
|
2199
|
+
vals.calp1 = -Math.sqrt(1 - m.sq(vals.salp1));
|
|
2200
|
+
} else {
|
|
2201
|
+
vals.calp1 = Math.max(x > -tol1_ ? 0 : -1, x);
|
|
2202
|
+
vals.salp1 = Math.sqrt(1 - m.sq(vals.calp1));
|
|
2203
|
+
}
|
|
2204
|
+
} else {
|
|
2205
|
+
k = astroid(x, y);
|
|
2206
|
+
omg12a = lamscale * (this.f >= 0 ? -x * k / (1 + k) : -y * (1 + k) / k);
|
|
2207
|
+
somg12 = Math.sin(omg12a);
|
|
2208
|
+
comg12 = -Math.cos(omg12a);
|
|
2209
|
+
vals.salp1 = cbet2 * somg12;
|
|
2210
|
+
vals.calp1 = sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
if (!(vals.salp1 <= 0)) {
|
|
2214
|
+
t = m.hypot(vals.salp1, vals.calp1);
|
|
2215
|
+
vals.salp1 /= t;
|
|
2216
|
+
vals.calp1 /= t;
|
|
2217
|
+
} else {
|
|
2218
|
+
vals.salp1 = 1;
|
|
2219
|
+
vals.calp1 = 0;
|
|
2220
|
+
}
|
|
2221
|
+
return vals;
|
|
2222
|
+
};
|
|
2223
|
+
g.Geodesic.prototype.Lambda12 = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam120, clam120, diffp, C1a, C2a, C3a) {
|
|
2224
|
+
var vals = {}, t, salp0, calp0, somg1, comg1, somg2, comg2, somg12, comg12, B312, eta, k2, nvals;
|
|
2225
|
+
if (sbet1 === 0 && calp1 === 0)
|
|
2226
|
+
calp1 = -g.tiny_;
|
|
2227
|
+
salp0 = salp1 * cbet1;
|
|
2228
|
+
calp0 = m.hypot(calp1, salp1 * sbet1);
|
|
2229
|
+
vals.ssig1 = sbet1;
|
|
2230
|
+
somg1 = salp0 * sbet1;
|
|
2231
|
+
vals.csig1 = comg1 = calp1 * cbet1;
|
|
2232
|
+
t = m.hypot(vals.ssig1, vals.csig1);
|
|
2233
|
+
vals.ssig1 /= t;
|
|
2234
|
+
vals.csig1 /= t;
|
|
2235
|
+
vals.salp2 = cbet2 !== cbet1 ? salp0 / cbet2 : salp1;
|
|
2236
|
+
vals.calp2 = cbet2 !== cbet1 || Math.abs(sbet2) !== -sbet1 ? Math.sqrt(m.sq(calp1 * cbet1) + (cbet1 < -sbet1 ? (cbet2 - cbet1) * (cbet1 + cbet2) : (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 : Math.abs(calp1);
|
|
2237
|
+
vals.ssig2 = sbet2;
|
|
2238
|
+
somg2 = salp0 * sbet2;
|
|
2239
|
+
vals.csig2 = comg2 = vals.calp2 * cbet2;
|
|
2240
|
+
t = m.hypot(vals.ssig2, vals.csig2);
|
|
2241
|
+
vals.ssig2 /= t;
|
|
2242
|
+
vals.csig2 /= t;
|
|
2243
|
+
vals.sig12 = Math.atan2(Math.max(0, vals.csig1 * vals.ssig2 - vals.ssig1 * vals.csig2), vals.csig1 * vals.csig2 + vals.ssig1 * vals.ssig2);
|
|
2244
|
+
somg12 = Math.max(0, comg1 * somg2 - somg1 * comg2);
|
|
2245
|
+
comg12 = comg1 * comg2 + somg1 * somg2;
|
|
2246
|
+
eta = Math.atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120);
|
|
2247
|
+
k2 = m.sq(calp0) * this._ep2;
|
|
2248
|
+
vals.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
|
|
2249
|
+
this.C3f(vals.eps, C3a);
|
|
2250
|
+
B312 = g.SinCosSeries(true, vals.ssig2, vals.csig2, C3a) - g.SinCosSeries(true, vals.ssig1, vals.csig1, C3a);
|
|
2251
|
+
vals.domg12 = -this.f * this.A3f(vals.eps) * salp0 * (vals.sig12 + B312);
|
|
2252
|
+
vals.lam12 = eta + vals.domg12;
|
|
2253
|
+
if (diffp) {
|
|
2254
|
+
if (vals.calp2 === 0)
|
|
2255
|
+
vals.dlam12 = -2 * this._f1 * dn1 / sbet1;
|
|
2256
|
+
else {
|
|
2257
|
+
nvals = this.Lengths(vals.eps, vals.sig12, vals.ssig1, vals.csig1, dn1, vals.ssig2, vals.csig2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
|
|
2258
|
+
vals.dlam12 = nvals.m12b;
|
|
2259
|
+
vals.dlam12 *= this._f1 / (vals.calp2 * cbet2);
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
return vals;
|
|
2263
|
+
};
|
|
2264
|
+
g.Geodesic.prototype.Inverse = function(lat1, lon1, lat2, lon2, outmask) {
|
|
2265
|
+
var r, vals;
|
|
2266
|
+
if (!outmask)
|
|
2267
|
+
outmask = g.STANDARD;
|
|
2268
|
+
if (outmask === g.LONG_UNROLL)
|
|
2269
|
+
outmask |= g.STANDARD;
|
|
2270
|
+
outmask &= g.OUT_MASK;
|
|
2271
|
+
r = this.InverseInt(lat1, lon1, lat2, lon2, outmask);
|
|
2272
|
+
vals = r.vals;
|
|
2273
|
+
if (outmask & g.AZIMUTH) {
|
|
2274
|
+
vals.azi1 = m.atan2d(r.salp1, r.calp1);
|
|
2275
|
+
vals.azi2 = m.atan2d(r.salp2, r.calp2);
|
|
2276
|
+
}
|
|
2277
|
+
return vals;
|
|
2278
|
+
};
|
|
2279
|
+
g.Geodesic.prototype.InverseInt = function(lat1, lon1, lat2, lon2, outmask) {
|
|
2280
|
+
var vals = {}, lon12, lon12s, lonsign, t, swapp, latsign, sbet1, cbet1, sbet2, cbet2, s12x, m12x, dn1, dn2, lam12, slam12, clam12, sig12, calp1, salp1, calp2, salp2, C1a, C2a, C3a, meridian, nvals, ssig1, csig1, ssig2, csig2, eps, omg12, dnm, numit, salp1a, calp1a, salp1b, calp1b, tripn, tripb, v, dv, dalp1, sdalp1, cdalp1, nsalp1, lengthmask, salp0, calp0, alp12, k2, A42, C4a, B41, B42, somg12, comg12, domg12, dbet1, dbet2, salp12, calp12, sdomg12, cdomg12;
|
|
2281
|
+
vals.lat1 = lat1 = m.LatFix(lat1);
|
|
2282
|
+
vals.lat2 = lat2 = m.LatFix(lat2);
|
|
2283
|
+
lat1 = m.AngRound(lat1);
|
|
2284
|
+
lat2 = m.AngRound(lat2);
|
|
2285
|
+
lon12 = m.AngDiff(lon1, lon2);
|
|
2286
|
+
lon12s = lon12.e;
|
|
2287
|
+
lon12 = lon12.d;
|
|
2288
|
+
if (outmask & g.LONG_UNROLL) {
|
|
2289
|
+
vals.lon1 = lon1;
|
|
2290
|
+
vals.lon2 = lon1 + lon12 + lon12s;
|
|
2291
|
+
} else {
|
|
2292
|
+
vals.lon1 = m.AngNormalize(lon1);
|
|
2293
|
+
vals.lon2 = m.AngNormalize(lon2);
|
|
2294
|
+
}
|
|
2295
|
+
lonsign = m.copysign(1, lon12);
|
|
2296
|
+
lon12 *= lonsign;
|
|
2297
|
+
lon12s *= lonsign;
|
|
2298
|
+
lam12 = lon12 * m.degree;
|
|
2299
|
+
t = m.sincosde(lon12, lon12s);
|
|
2300
|
+
slam12 = t.s;
|
|
2301
|
+
clam12 = t.c;
|
|
2302
|
+
lon12s = 180 - lon12 - lon12s;
|
|
2303
|
+
swapp = Math.abs(lat1) < Math.abs(lat2) || isNaN(lat2) ? -1 : 1;
|
|
2304
|
+
if (swapp < 0) {
|
|
2305
|
+
lonsign *= -1;
|
|
2306
|
+
[lat2, lat1] = [lat1, lat2];
|
|
2307
|
+
}
|
|
2308
|
+
latsign = m.copysign(1, -lat1);
|
|
2309
|
+
lat1 *= latsign;
|
|
2310
|
+
lat2 *= latsign;
|
|
2311
|
+
t = m.sincosd(lat1);
|
|
2312
|
+
sbet1 = this._f1 * t.s;
|
|
2313
|
+
cbet1 = t.c;
|
|
2314
|
+
t = m.hypot(sbet1, cbet1);
|
|
2315
|
+
sbet1 /= t;
|
|
2316
|
+
cbet1 /= t;
|
|
2317
|
+
cbet1 = Math.max(g.tiny_, cbet1);
|
|
2318
|
+
t = m.sincosd(lat2);
|
|
2319
|
+
sbet2 = this._f1 * t.s;
|
|
2320
|
+
cbet2 = t.c;
|
|
2321
|
+
t = m.hypot(sbet2, cbet2);
|
|
2322
|
+
sbet2 /= t;
|
|
2323
|
+
cbet2 /= t;
|
|
2324
|
+
cbet2 = Math.max(g.tiny_, cbet2);
|
|
2325
|
+
if (cbet1 < -sbet1) {
|
|
2326
|
+
if (cbet2 === cbet1)
|
|
2327
|
+
sbet2 = m.copysign(sbet1, sbet2);
|
|
2328
|
+
} else {
|
|
2329
|
+
if (Math.abs(sbet2) === -sbet1)
|
|
2330
|
+
cbet2 = cbet1;
|
|
2331
|
+
}
|
|
2332
|
+
dn1 = Math.sqrt(1 + this._ep2 * m.sq(sbet1));
|
|
2333
|
+
dn2 = Math.sqrt(1 + this._ep2 * m.sq(sbet2));
|
|
2334
|
+
C1a = new Array(g.nC1_ + 1);
|
|
2335
|
+
C2a = new Array(g.nC2_ + 1);
|
|
2336
|
+
C3a = new Array(g.nC3_);
|
|
2337
|
+
meridian = lat1 === -90 || slam12 === 0;
|
|
2338
|
+
if (meridian) {
|
|
2339
|
+
calp1 = clam12;
|
|
2340
|
+
salp1 = slam12;
|
|
2341
|
+
calp2 = 1;
|
|
2342
|
+
salp2 = 0;
|
|
2343
|
+
ssig1 = sbet1;
|
|
2344
|
+
csig1 = calp1 * cbet1;
|
|
2345
|
+
ssig2 = sbet2;
|
|
2346
|
+
csig2 = calp2 * cbet2;
|
|
2347
|
+
sig12 = Math.atan2(Math.max(0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2);
|
|
2348
|
+
nvals = this.Lengths(this._n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | g.DISTANCE | g.REDUCEDLENGTH, C1a, C2a);
|
|
2349
|
+
s12x = nvals.s12b;
|
|
2350
|
+
m12x = nvals.m12b;
|
|
2351
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2352
|
+
vals.M12 = nvals.M12;
|
|
2353
|
+
vals.M21 = nvals.M21;
|
|
2354
|
+
}
|
|
2355
|
+
if (sig12 < tol2_ || m12x >= 0) {
|
|
2356
|
+
if (sig12 < 3 * g.tiny_ || // Prevent negative s12 or m12 for short lines
|
|
2357
|
+
sig12 < tol0_ && (s12x < 0 || m12x < 0))
|
|
2358
|
+
sig12 = m12x = s12x = 0;
|
|
2359
|
+
m12x *= this._b;
|
|
2360
|
+
s12x *= this._b;
|
|
2361
|
+
vals.a12 = sig12 / m.degree;
|
|
2362
|
+
} else
|
|
2363
|
+
meridian = false;
|
|
2364
|
+
}
|
|
2365
|
+
somg12 = 2;
|
|
2366
|
+
if (!meridian && sbet1 === 0 && // and sbet2 == 0
|
|
2367
|
+
(this.f <= 0 || lon12s >= this.f * 180)) {
|
|
2368
|
+
calp1 = calp2 = 0;
|
|
2369
|
+
salp1 = salp2 = 1;
|
|
2370
|
+
s12x = this.a * lam12;
|
|
2371
|
+
sig12 = omg12 = lam12 / this._f1;
|
|
2372
|
+
m12x = this._b * Math.sin(sig12);
|
|
2373
|
+
if (outmask & g.GEODESICSCALE)
|
|
2374
|
+
vals.M12 = vals.M21 = Math.cos(sig12);
|
|
2375
|
+
vals.a12 = lon12 / this._f1;
|
|
2376
|
+
} else if (!meridian) {
|
|
2377
|
+
nvals = this.InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a);
|
|
2378
|
+
sig12 = nvals.sig12;
|
|
2379
|
+
salp1 = nvals.salp1;
|
|
2380
|
+
calp1 = nvals.calp1;
|
|
2381
|
+
if (sig12 >= 0) {
|
|
2382
|
+
salp2 = nvals.salp2;
|
|
2383
|
+
calp2 = nvals.calp2;
|
|
2384
|
+
dnm = nvals.dnm;
|
|
2385
|
+
s12x = sig12 * this._b * dnm;
|
|
2386
|
+
m12x = m.sq(dnm) * this._b * Math.sin(sig12 / dnm);
|
|
2387
|
+
if (outmask & g.GEODESICSCALE)
|
|
2388
|
+
vals.M12 = vals.M21 = Math.cos(sig12 / dnm);
|
|
2389
|
+
vals.a12 = sig12 / m.degree;
|
|
2390
|
+
omg12 = lam12 / (this._f1 * dnm);
|
|
2391
|
+
} else {
|
|
2392
|
+
numit = 0;
|
|
2393
|
+
salp1a = g.tiny_;
|
|
2394
|
+
calp1a = 1;
|
|
2395
|
+
salp1b = g.tiny_;
|
|
2396
|
+
calp1b = -1;
|
|
2397
|
+
for (tripn = false, tripb = false; ; ++numit) {
|
|
2398
|
+
nvals = this.Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, numit < maxit1_, C1a, C2a, C3a);
|
|
2399
|
+
v = nvals.lam12;
|
|
2400
|
+
salp2 = nvals.salp2;
|
|
2401
|
+
calp2 = nvals.calp2;
|
|
2402
|
+
sig12 = nvals.sig12;
|
|
2403
|
+
ssig1 = nvals.ssig1;
|
|
2404
|
+
csig1 = nvals.csig1;
|
|
2405
|
+
ssig2 = nvals.ssig2;
|
|
2406
|
+
csig2 = nvals.csig2;
|
|
2407
|
+
eps = nvals.eps;
|
|
2408
|
+
domg12 = nvals.domg12;
|
|
2409
|
+
dv = nvals.dlam12;
|
|
2410
|
+
if (tripb || !(Math.abs(v) >= (tripn ? 8 : 1) * tol0_) || numit == maxit2_)
|
|
2411
|
+
break;
|
|
2412
|
+
if (v > 0 && (numit < maxit1_ || calp1 / salp1 > calp1b / salp1b)) {
|
|
2413
|
+
salp1b = salp1;
|
|
2414
|
+
calp1b = calp1;
|
|
2415
|
+
} else if (v < 0 && (numit < maxit1_ || calp1 / salp1 < calp1a / salp1a)) {
|
|
2416
|
+
salp1a = salp1;
|
|
2417
|
+
calp1a = calp1;
|
|
2418
|
+
}
|
|
2419
|
+
if (numit < maxit1_ && dv > 0) {
|
|
2420
|
+
dalp1 = -v / dv;
|
|
2421
|
+
if (Math.abs(dalp1) < Math.PI) {
|
|
2422
|
+
sdalp1 = Math.sin(dalp1);
|
|
2423
|
+
cdalp1 = Math.cos(dalp1);
|
|
2424
|
+
nsalp1 = salp1 * cdalp1 + calp1 * sdalp1;
|
|
2425
|
+
if (nsalp1 > 0) {
|
|
2426
|
+
calp1 = calp1 * cdalp1 - salp1 * sdalp1;
|
|
2427
|
+
salp1 = nsalp1;
|
|
2428
|
+
t = m.hypot(salp1, calp1);
|
|
2429
|
+
salp1 /= t;
|
|
2430
|
+
calp1 /= t;
|
|
2431
|
+
tripn = Math.abs(v) <= 16 * tol0_;
|
|
2432
|
+
continue;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
salp1 = (salp1a + salp1b) / 2;
|
|
2437
|
+
calp1 = (calp1a + calp1b) / 2;
|
|
2438
|
+
t = m.hypot(salp1, calp1);
|
|
2439
|
+
salp1 /= t;
|
|
2440
|
+
calp1 /= t;
|
|
2441
|
+
tripn = false;
|
|
2442
|
+
tripb = Math.abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || Math.abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_;
|
|
2443
|
+
}
|
|
2444
|
+
lengthmask = outmask | (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE) ? g.DISTANCE : g.NONE);
|
|
2445
|
+
nvals = this.Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a);
|
|
2446
|
+
s12x = nvals.s12b;
|
|
2447
|
+
m12x = nvals.m12b;
|
|
2448
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2449
|
+
vals.M12 = nvals.M12;
|
|
2450
|
+
vals.M21 = nvals.M21;
|
|
2451
|
+
}
|
|
2452
|
+
m12x *= this._b;
|
|
2453
|
+
s12x *= this._b;
|
|
2454
|
+
vals.a12 = sig12 / m.degree;
|
|
2455
|
+
if (outmask & g.AREA) {
|
|
2456
|
+
sdomg12 = Math.sin(domg12);
|
|
2457
|
+
cdomg12 = Math.cos(domg12);
|
|
2458
|
+
somg12 = slam12 * cdomg12 - clam12 * sdomg12;
|
|
2459
|
+
comg12 = clam12 * cdomg12 + slam12 * sdomg12;
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
if (outmask & g.DISTANCE)
|
|
2464
|
+
vals.s12 = 0 + s12x;
|
|
2465
|
+
if (outmask & g.REDUCEDLENGTH)
|
|
2466
|
+
vals.m12 = 0 + m12x;
|
|
2467
|
+
if (outmask & g.AREA) {
|
|
2468
|
+
salp0 = salp1 * cbet1;
|
|
2469
|
+
calp0 = m.hypot(calp1, salp1 * sbet1);
|
|
2470
|
+
if (calp0 !== 0 && salp0 !== 0) {
|
|
2471
|
+
ssig1 = sbet1;
|
|
2472
|
+
csig1 = calp1 * cbet1;
|
|
2473
|
+
ssig2 = sbet2;
|
|
2474
|
+
csig2 = calp2 * cbet2;
|
|
2475
|
+
k2 = m.sq(calp0) * this._ep2;
|
|
2476
|
+
eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
|
|
2477
|
+
A42 = m.sq(this.a) * calp0 * salp0 * this._e2;
|
|
2478
|
+
t = m.hypot(ssig1, csig1);
|
|
2479
|
+
ssig1 /= t;
|
|
2480
|
+
csig1 /= t;
|
|
2481
|
+
t = m.hypot(ssig2, csig2);
|
|
2482
|
+
ssig2 /= t;
|
|
2483
|
+
csig2 /= t;
|
|
2484
|
+
C4a = new Array(g.nC4_);
|
|
2485
|
+
this.C4f(eps, C4a);
|
|
2486
|
+
B41 = g.SinCosSeries(false, ssig1, csig1, C4a);
|
|
2487
|
+
B42 = g.SinCosSeries(false, ssig2, csig2, C4a);
|
|
2488
|
+
vals.S12 = A42 * (sig12 < 0.01 ? g.SinCosSeries(false, ssig1, csig1, C4a, sig12) : B42 - B41);
|
|
2489
|
+
} else
|
|
2490
|
+
vals.S12 = 0;
|
|
2491
|
+
if (!meridian && somg12 == 2) {
|
|
2492
|
+
somg12 = Math.sin(omg12);
|
|
2493
|
+
comg12 = Math.cos(omg12);
|
|
2494
|
+
}
|
|
2495
|
+
if (!meridian && comg12 > -0.7071 && // Long difference not too big
|
|
2496
|
+
sbet2 - sbet1 < 1.75) {
|
|
2497
|
+
domg12 = 1 + comg12;
|
|
2498
|
+
dbet1 = 1 + cbet1;
|
|
2499
|
+
dbet2 = 1 + cbet2;
|
|
2500
|
+
alp12 = 2 * Math.atan2(somg12 * (sbet1 * dbet2 + sbet2 * dbet1), domg12 * (sbet1 * sbet2 + dbet1 * dbet2));
|
|
2501
|
+
} else {
|
|
2502
|
+
salp12 = salp2 * calp1 - calp2 * salp1;
|
|
2503
|
+
calp12 = calp2 * calp1 + salp2 * salp1;
|
|
2504
|
+
if (salp12 === 0 && calp12 < 0) {
|
|
2505
|
+
salp12 = g.tiny_ * calp1;
|
|
2506
|
+
calp12 = -1;
|
|
2507
|
+
}
|
|
2508
|
+
alp12 = Math.atan2(salp12, calp12);
|
|
2509
|
+
}
|
|
2510
|
+
vals.S12 += this._c2 * alp12;
|
|
2511
|
+
vals.S12 *= swapp * lonsign * latsign;
|
|
2512
|
+
vals.S12 += 0;
|
|
2513
|
+
}
|
|
2514
|
+
if (swapp < 0) {
|
|
2515
|
+
[salp2, salp1] = [salp1, salp2];
|
|
2516
|
+
[calp2, calp1] = [calp1, calp2];
|
|
2517
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2518
|
+
[vals.M21, vals.M12] = [vals.M12, vals.M21];
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
salp1 *= swapp * lonsign;
|
|
2522
|
+
calp1 *= swapp * latsign;
|
|
2523
|
+
salp2 *= swapp * lonsign;
|
|
2524
|
+
calp2 *= swapp * latsign;
|
|
2525
|
+
return {
|
|
2526
|
+
vals,
|
|
2527
|
+
salp1,
|
|
2528
|
+
calp1,
|
|
2529
|
+
salp2,
|
|
2530
|
+
calp2
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
g.Geodesic.prototype.GenDirect = function(lat1, lon1, azi1, arcmode, s12_a12, outmask) {
|
|
2534
|
+
var line;
|
|
2535
|
+
if (!outmask)
|
|
2536
|
+
outmask = g.STANDARD;
|
|
2537
|
+
else if (outmask === g.LONG_UNROLL)
|
|
2538
|
+
outmask |= g.STANDARD;
|
|
2539
|
+
if (!arcmode)
|
|
2540
|
+
outmask |= g.DISTANCE_IN;
|
|
2541
|
+
line = new l.GeodesicLine(this, lat1, lon1, azi1, outmask);
|
|
2542
|
+
return line.GenPosition(arcmode, s12_a12, outmask);
|
|
2543
|
+
};
|
|
2544
|
+
g.Geodesic.prototype.Direct = function(lat1, lon1, azi1, s12, outmask) {
|
|
2545
|
+
return this.GenDirect(lat1, lon1, azi1, false, s12, outmask);
|
|
2546
|
+
};
|
|
2547
|
+
g.Geodesic.prototype.ArcDirect = function(lat1, lon1, azi1, a12, outmask) {
|
|
2548
|
+
return this.GenDirect(lat1, lon1, azi1, true, a12, outmask);
|
|
2549
|
+
};
|
|
2550
|
+
g.Geodesic.prototype.Line = function(lat1, lon1, azi1, caps) {
|
|
2551
|
+
return new l.GeodesicLine(this, lat1, lon1, azi1, caps);
|
|
2552
|
+
};
|
|
2553
|
+
g.Geodesic.prototype.DirectLine = function(lat1, lon1, azi1, s12, caps) {
|
|
2554
|
+
return this.GenDirectLine(lat1, lon1, azi1, false, s12, caps);
|
|
2555
|
+
};
|
|
2556
|
+
g.Geodesic.prototype.ArcDirectLine = function(lat1, lon1, azi1, a12, caps) {
|
|
2557
|
+
return this.GenDirectLine(lat1, lon1, azi1, true, a12, caps);
|
|
2558
|
+
};
|
|
2559
|
+
g.Geodesic.prototype.GenDirectLine = function(lat1, lon1, azi1, arcmode, s12_a12, caps) {
|
|
2560
|
+
var t;
|
|
2561
|
+
if (!caps)
|
|
2562
|
+
caps = g.STANDARD | g.DISTANCE_IN;
|
|
2563
|
+
if (!arcmode)
|
|
2564
|
+
caps |= g.DISTANCE_IN;
|
|
2565
|
+
t = new l.GeodesicLine(this, lat1, lon1, azi1, caps);
|
|
2566
|
+
t.GenSetDistance(arcmode, s12_a12);
|
|
2567
|
+
return t;
|
|
2568
|
+
};
|
|
2569
|
+
g.Geodesic.prototype.InverseLine = function(lat1, lon1, lat2, lon2, caps) {
|
|
2570
|
+
var r, t, azi1;
|
|
2571
|
+
if (!caps)
|
|
2572
|
+
caps = g.STANDARD | g.DISTANCE_IN;
|
|
2573
|
+
r = this.InverseInt(lat1, lon1, lat2, lon2, g.ARC);
|
|
2574
|
+
azi1 = m.atan2d(r.salp1, r.calp1);
|
|
2575
|
+
if (caps & (g.OUT_MASK & g.DISTANCE_IN))
|
|
2576
|
+
caps |= g.DISTANCE;
|
|
2577
|
+
t = new l.GeodesicLine(this, lat1, lon1, azi1, caps, r.salp1, r.calp1);
|
|
2578
|
+
t.SetArc(r.vals.a12);
|
|
2579
|
+
return t;
|
|
2580
|
+
};
|
|
2581
|
+
g.Geodesic.prototype.Polygon = function(polyline) {
|
|
2582
|
+
return new p.PolygonArea(this, polyline);
|
|
2583
|
+
};
|
|
2584
|
+
g.WGS84 = new g.Geodesic(c.WGS84.a, c.WGS84.f);
|
|
2585
|
+
})(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.PolygonArea, geodesic.Math, geodesic.Constants);
|
|
2586
|
+
(function(g, l, m) {
|
|
2587
|
+
"use strict";
|
|
2588
|
+
l.GeodesicLine = function(geod, lat1, lon1, azi1, caps, salp1, calp1) {
|
|
2589
|
+
var t, cbet1, sbet1, eps, s, c;
|
|
2590
|
+
if (!caps)
|
|
2591
|
+
caps = g.STANDARD | g.DISTANCE_IN;
|
|
2592
|
+
this.a = geod.a;
|
|
2593
|
+
this.f = geod.f;
|
|
2594
|
+
this._b = geod._b;
|
|
2595
|
+
this._c2 = geod._c2;
|
|
2596
|
+
this._f1 = geod._f1;
|
|
2597
|
+
this.caps = caps | g.LATITUDE | g.AZIMUTH | g.LONG_UNROLL;
|
|
2598
|
+
this.lat1 = m.LatFix(lat1);
|
|
2599
|
+
this.lon1 = lon1;
|
|
2600
|
+
if (typeof salp1 === "undefined" || typeof calp1 === "undefined") {
|
|
2601
|
+
this.azi1 = m.AngNormalize(azi1);
|
|
2602
|
+
t = m.sincosd(m.AngRound(this.azi1));
|
|
2603
|
+
this.salp1 = t.s;
|
|
2604
|
+
this.calp1 = t.c;
|
|
2605
|
+
} else {
|
|
2606
|
+
this.azi1 = azi1;
|
|
2607
|
+
this.salp1 = salp1;
|
|
2608
|
+
this.calp1 = calp1;
|
|
2609
|
+
}
|
|
2610
|
+
t = m.sincosd(m.AngRound(this.lat1));
|
|
2611
|
+
sbet1 = this._f1 * t.s;
|
|
2612
|
+
cbet1 = t.c;
|
|
2613
|
+
t = m.hypot(sbet1, cbet1);
|
|
2614
|
+
sbet1 /= t;
|
|
2615
|
+
cbet1 /= t;
|
|
2616
|
+
cbet1 = Math.max(g.tiny_, cbet1);
|
|
2617
|
+
this._dn1 = Math.sqrt(1 + geod._ep2 * m.sq(sbet1));
|
|
2618
|
+
this._salp0 = this.salp1 * cbet1;
|
|
2619
|
+
this._calp0 = m.hypot(this.calp1, this.salp1 * sbet1);
|
|
2620
|
+
this._ssig1 = sbet1;
|
|
2621
|
+
this._somg1 = this._salp0 * sbet1;
|
|
2622
|
+
this._csig1 = this._comg1 = sbet1 !== 0 || this.calp1 !== 0 ? cbet1 * this.calp1 : 1;
|
|
2623
|
+
t = m.hypot(this._ssig1, this._csig1);
|
|
2624
|
+
this._ssig1 /= t;
|
|
2625
|
+
this._csig1 /= t;
|
|
2626
|
+
this._k2 = m.sq(this._calp0) * geod._ep2;
|
|
2627
|
+
eps = this._k2 / (2 * (1 + Math.sqrt(1 + this._k2)) + this._k2);
|
|
2628
|
+
if (this.caps & g.CAP_C1) {
|
|
2629
|
+
this._A1m1 = g.A1m1f(eps);
|
|
2630
|
+
this._C1a = new Array(g.nC1_ + 1);
|
|
2631
|
+
g.C1f(eps, this._C1a);
|
|
2632
|
+
this._B11 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C1a);
|
|
2633
|
+
s = Math.sin(this._B11);
|
|
2634
|
+
c = Math.cos(this._B11);
|
|
2635
|
+
this._stau1 = this._ssig1 * c + this._csig1 * s;
|
|
2636
|
+
this._ctau1 = this._csig1 * c - this._ssig1 * s;
|
|
2637
|
+
}
|
|
2638
|
+
if (this.caps & g.CAP_C1p) {
|
|
2639
|
+
this._C1pa = new Array(g.nC1p_ + 1);
|
|
2640
|
+
g.C1pf(eps, this._C1pa);
|
|
2641
|
+
}
|
|
2642
|
+
if (this.caps & g.CAP_C2) {
|
|
2643
|
+
this._A2m1 = g.A2m1f(eps);
|
|
2644
|
+
this._C2a = new Array(g.nC2_ + 1);
|
|
2645
|
+
g.C2f(eps, this._C2a);
|
|
2646
|
+
this._B21 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C2a);
|
|
2647
|
+
}
|
|
2648
|
+
if (this.caps & g.CAP_C3) {
|
|
2649
|
+
this._C3a = new Array(g.nC3_);
|
|
2650
|
+
geod.C3f(eps, this._C3a);
|
|
2651
|
+
this._A3c = -this.f * this._salp0 * geod.A3f(eps);
|
|
2652
|
+
this._B31 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C3a);
|
|
2653
|
+
}
|
|
2654
|
+
if (this.caps & g.CAP_C4) {
|
|
2655
|
+
this._C4a = new Array(g.nC4_);
|
|
2656
|
+
geod.C4f(eps, this._C4a);
|
|
2657
|
+
this._A4 = m.sq(this.a) * this._calp0 * this._salp0 * geod._e2;
|
|
2658
|
+
this._B41 = g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a);
|
|
2659
|
+
}
|
|
2660
|
+
this.a13 = this.s13 = NaN;
|
|
2661
|
+
};
|
|
2662
|
+
l.GeodesicLine.prototype.GenPosition = function(arcmode, s12_a12, outmask) {
|
|
2663
|
+
var vals = {}, sig12, ssig12, csig12, B12, AB1, ssig2, csig2, tau12, s, c, serr, omg12, lam12, lon12, E, sbet2, cbet2, somg2, comg2, salp2, calp2, dn2, B22, AB2, J12, t, B42, salp12, calp12;
|
|
2664
|
+
if (!outmask)
|
|
2665
|
+
outmask = g.STANDARD;
|
|
2666
|
+
else if (outmask === g.LONG_UNROLL)
|
|
2667
|
+
outmask |= g.STANDARD;
|
|
2668
|
+
outmask &= this.caps & g.OUT_MASK;
|
|
2669
|
+
vals.lat1 = this.lat1;
|
|
2670
|
+
vals.azi1 = this.azi1;
|
|
2671
|
+
vals.lon1 = outmask & g.LONG_UNROLL ? this.lon1 : m.AngNormalize(this.lon1);
|
|
2672
|
+
if (arcmode)
|
|
2673
|
+
vals.a12 = s12_a12;
|
|
2674
|
+
else
|
|
2675
|
+
vals.s12 = s12_a12;
|
|
2676
|
+
if (!(arcmode || this.caps & g.DISTANCE_IN & g.OUT_MASK)) {
|
|
2677
|
+
vals.a12 = NaN;
|
|
2678
|
+
return vals;
|
|
2679
|
+
}
|
|
2680
|
+
B12 = 0;
|
|
2681
|
+
AB1 = 0;
|
|
2682
|
+
if (arcmode) {
|
|
2683
|
+
sig12 = s12_a12 * m.degree;
|
|
2684
|
+
t = m.sincosd(s12_a12);
|
|
2685
|
+
ssig12 = t.s;
|
|
2686
|
+
csig12 = t.c;
|
|
2687
|
+
} else {
|
|
2688
|
+
tau12 = s12_a12 / (this._b * (1 + this._A1m1));
|
|
2689
|
+
s = Math.sin(tau12);
|
|
2690
|
+
c = Math.cos(tau12);
|
|
2691
|
+
B12 = -g.SinCosSeries(true, this._stau1 * c + this._ctau1 * s, this._ctau1 * c - this._stau1 * s, this._C1pa);
|
|
2692
|
+
sig12 = tau12 - (B12 - this._B11);
|
|
2693
|
+
ssig12 = Math.sin(sig12);
|
|
2694
|
+
csig12 = Math.cos(sig12);
|
|
2695
|
+
if (Math.abs(this.f) > 0.01) {
|
|
2696
|
+
ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
|
|
2697
|
+
csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
|
|
2698
|
+
B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
|
|
2699
|
+
serr = (1 + this._A1m1) * (sig12 + (B12 - this._B11)) - s12_a12 / this._b;
|
|
2700
|
+
sig12 = sig12 - serr / Math.sqrt(1 + this._k2 * m.sq(ssig2));
|
|
2701
|
+
ssig12 = Math.sin(sig12);
|
|
2702
|
+
csig12 = Math.cos(sig12);
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
|
|
2706
|
+
csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
|
|
2707
|
+
dn2 = Math.sqrt(1 + this._k2 * m.sq(ssig2));
|
|
2708
|
+
if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2709
|
+
if (arcmode || Math.abs(this.f) > 0.01)
|
|
2710
|
+
B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
|
|
2711
|
+
AB1 = (1 + this._A1m1) * (B12 - this._B11);
|
|
2712
|
+
}
|
|
2713
|
+
sbet2 = this._calp0 * ssig2;
|
|
2714
|
+
cbet2 = m.hypot(this._salp0, this._calp0 * csig2);
|
|
2715
|
+
if (cbet2 === 0)
|
|
2716
|
+
cbet2 = csig2 = g.tiny_;
|
|
2717
|
+
salp2 = this._salp0;
|
|
2718
|
+
calp2 = this._calp0 * csig2;
|
|
2719
|
+
if (arcmode && outmask & g.DISTANCE)
|
|
2720
|
+
vals.s12 = this._b * ((1 + this._A1m1) * sig12 + AB1);
|
|
2721
|
+
if (outmask & g.LONGITUDE) {
|
|
2722
|
+
somg2 = this._salp0 * ssig2;
|
|
2723
|
+
comg2 = csig2;
|
|
2724
|
+
E = m.copysign(1, this._salp0);
|
|
2725
|
+
omg12 = outmask & g.LONG_UNROLL ? E * (sig12 - (Math.atan2(ssig2, csig2) - Math.atan2(this._ssig1, this._csig1)) + (Math.atan2(E * somg2, comg2) - Math.atan2(E * this._somg1, this._comg1))) : Math.atan2(somg2 * this._comg1 - comg2 * this._somg1, comg2 * this._comg1 + somg2 * this._somg1);
|
|
2726
|
+
lam12 = omg12 + this._A3c * (sig12 + (g.SinCosSeries(true, ssig2, csig2, this._C3a) - this._B31));
|
|
2727
|
+
lon12 = lam12 / m.degree;
|
|
2728
|
+
vals.lon2 = outmask & g.LONG_UNROLL ? this.lon1 + lon12 : m.AngNormalize(m.AngNormalize(this.lon1) + m.AngNormalize(lon12));
|
|
2729
|
+
}
|
|
2730
|
+
if (outmask & g.LATITUDE)
|
|
2731
|
+
vals.lat2 = m.atan2d(sbet2, this._f1 * cbet2);
|
|
2732
|
+
if (outmask & g.AZIMUTH)
|
|
2733
|
+
vals.azi2 = m.atan2d(salp2, calp2);
|
|
2734
|
+
if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2735
|
+
B22 = g.SinCosSeries(true, ssig2, csig2, this._C2a);
|
|
2736
|
+
AB2 = (1 + this._A2m1) * (B22 - this._B21);
|
|
2737
|
+
J12 = (this._A1m1 - this._A2m1) * sig12 + (AB1 - AB2);
|
|
2738
|
+
if (outmask & g.REDUCEDLENGTH)
|
|
2739
|
+
vals.m12 = this._b * (dn2 * (this._csig1 * ssig2) - this._dn1 * (this._ssig1 * csig2) - this._csig1 * csig2 * J12);
|
|
2740
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2741
|
+
t = this._k2 * (ssig2 - this._ssig1) * (ssig2 + this._ssig1) / (this._dn1 + dn2);
|
|
2742
|
+
vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * this._ssig1 / this._dn1;
|
|
2743
|
+
vals.M21 = csig12 - (t * this._ssig1 - this._csig1 * J12) * ssig2 / dn2;
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
if (outmask & g.AREA) {
|
|
2747
|
+
B42 = g.SinCosSeries(false, ssig2, csig2, this._C4a);
|
|
2748
|
+
if (this._calp0 === 0 || this._salp0 === 0) {
|
|
2749
|
+
salp12 = salp2 * this.calp1 - calp2 * this.salp1;
|
|
2750
|
+
calp12 = calp2 * this.calp1 + salp2 * this.salp1;
|
|
2751
|
+
} else {
|
|
2752
|
+
salp12 = this._calp0 * this._salp0 * (csig12 <= 0 ? this._csig1 * (1 - csig12) + ssig12 * this._ssig1 : ssig12 * (this._csig1 * ssig12 / (1 + csig12) + this._ssig1));
|
|
2753
|
+
calp12 = m.sq(this._salp0) + m.sq(this._calp0) * this._csig1 * csig2;
|
|
2754
|
+
}
|
|
2755
|
+
vals.S12 = this._c2 * Math.atan2(salp12, calp12) + this._A4 * (Math.abs(sig12) < 0.01 ? g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a, sig12) : B42 - this._B41);
|
|
2756
|
+
}
|
|
2757
|
+
if (!arcmode)
|
|
2758
|
+
vals.a12 = sig12 / m.degree;
|
|
2759
|
+
return vals;
|
|
2760
|
+
};
|
|
2761
|
+
l.GeodesicLine.prototype.Position = function(s12, outmask) {
|
|
2762
|
+
return this.GenPosition(false, s12, outmask);
|
|
2763
|
+
};
|
|
2764
|
+
l.GeodesicLine.prototype.ArcPosition = function(a12, outmask) {
|
|
2765
|
+
return this.GenPosition(true, a12, outmask);
|
|
2766
|
+
};
|
|
2767
|
+
l.GeodesicLine.prototype.GenSetDistance = function(arcmode, s13_a13) {
|
|
2768
|
+
if (arcmode)
|
|
2769
|
+
this.SetArc(s13_a13);
|
|
2770
|
+
else
|
|
2771
|
+
this.SetDistance(s13_a13);
|
|
2772
|
+
};
|
|
2773
|
+
l.GeodesicLine.prototype.SetDistance = function(s13) {
|
|
2774
|
+
var r;
|
|
2775
|
+
this.s13 = s13;
|
|
2776
|
+
r = this.GenPosition(false, this.s13, g.ARC);
|
|
2777
|
+
this.a13 = 0 + r.a12;
|
|
2778
|
+
};
|
|
2779
|
+
l.GeodesicLine.prototype.SetArc = function(a13) {
|
|
2780
|
+
var r;
|
|
2781
|
+
this.a13 = a13;
|
|
2782
|
+
r = this.GenPosition(true, this.a13, g.DISTANCE);
|
|
2783
|
+
this.s13 = 0 + r.s12;
|
|
2784
|
+
};
|
|
2785
|
+
})(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.Math);
|
|
2786
|
+
}
|
|
2787
|
+
});
|
|
2788
|
+
|
|
2789
|
+
// ../../node_modules/@math.gl/geospatial/dist/ellipsoid-geodesic.js
|
|
2790
|
+
function validateFinite(value2) {
|
|
2791
|
+
if (!Number.isFinite(value2))
|
|
2792
|
+
throw new Error("Geodesic axes, azimuth, distance and arc must be finite");
|
|
2793
|
+
}
|
|
2794
|
+
function createGeodesicEngine({ semiMajorAxis: a, semiMinorAxis: b }) {
|
|
2795
|
+
validateFinite(a);
|
|
2796
|
+
validateFinite(b);
|
|
2797
|
+
return new library.Geodesic(a, (a - b) / a);
|
|
2798
|
+
}
|
|
2799
|
+
var library, nonAreaGeodesicMask;
|
|
2800
|
+
var init_ellipsoid_geodesic = __esm({
|
|
2801
|
+
"../../node_modules/@math.gl/geospatial/dist/ellipsoid-geodesic.js"() {
|
|
2802
|
+
init_runtime();
|
|
2803
|
+
library = geodesic.Geodesic;
|
|
2804
|
+
nonAreaGeodesicMask = library.ALL & ~library.AREA;
|
|
1381
2805
|
}
|
|
1382
2806
|
});
|
|
1383
2807
|
|
|
@@ -17276,10 +18700,10 @@ return true;`);
|
|
|
17276
18700
|
return number;
|
|
17277
18701
|
}
|
|
17278
18702
|
function latitudeParameter(parameters, name) {
|
|
17279
|
-
const
|
|
17280
|
-
if (Math.abs(
|
|
18703
|
+
const degrees2 = numberParameter(parameters, name, 0);
|
|
18704
|
+
if (Math.abs(degrees2) >= 90)
|
|
17281
18705
|
throw new Error(`+${name} must be between -90 and 90 degrees`);
|
|
17282
|
-
return
|
|
18706
|
+
return degrees2 * DEGREES_TO_RADIANS;
|
|
17283
18707
|
}
|
|
17284
18708
|
function wrapLongitude(longitude, over = false) {
|
|
17285
18709
|
if (over || Math.abs(longitude) <= Math.PI)
|
|
@@ -19111,11 +20535,11 @@ return true;`);
|
|
|
19111
20535
|
|
|
19112
20536
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernel.js
|
|
19113
20537
|
function angleParameter(parameters, name, fallback = 0) {
|
|
19114
|
-
const
|
|
19115
|
-
if (name !== "lon_0" && Math.abs(
|
|
20538
|
+
const degrees2 = numberParameter(parameters, name, fallback);
|
|
20539
|
+
if (name !== "lon_0" && Math.abs(degrees2) > 90) {
|
|
19116
20540
|
throw new Error("Latitude parameter must be between -90 and 90 degrees: +" + name);
|
|
19117
20541
|
}
|
|
19118
|
-
return
|
|
20542
|
+
return degrees2 * DEGREES_TO_RADIANS;
|
|
19119
20543
|
}
|
|
19120
20544
|
function flagParameter(parameters, name) {
|
|
19121
20545
|
const present = Object.prototype.hasOwnProperty.call(parameters, name);
|
|
@@ -19195,6 +20619,16 @@ return true;`);
|
|
|
19195
20619
|
}
|
|
19196
20620
|
});
|
|
19197
20621
|
|
|
20622
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/tsfnz.js
|
|
20623
|
+
function tsfnz_default(eccent, phi, sinphi) {
|
|
20624
|
+
const cosphi = Math.cos(phi);
|
|
20625
|
+
return Math.exp(eccent * Math.atanh(eccent * sinphi)) * (sinphi > 0 ? cosphi / (1 + sinphi) : (1 - sinphi) / cosphi);
|
|
20626
|
+
}
|
|
20627
|
+
var init_tsfnz = __esm({
|
|
20628
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/tsfnz.js"() {
|
|
20629
|
+
}
|
|
20630
|
+
});
|
|
20631
|
+
|
|
19198
20632
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/constants.js
|
|
19199
20633
|
var EPSLN, HALF_PI, FORTPI, TWO_PI, SPI, D2R, R2D, SEC_TO_RAD;
|
|
19200
20634
|
var init_constants3 = __esm({
|
|
@@ -19210,19 +20644,6 @@ return true;`);
|
|
|
19210
20644
|
}
|
|
19211
20645
|
});
|
|
19212
20646
|
|
|
19213
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/tsfnz.js
|
|
19214
|
-
function tsfnz_default(eccent, phi, sinphi) {
|
|
19215
|
-
var con = eccent * sinphi;
|
|
19216
|
-
var com = 0.5 * eccent;
|
|
19217
|
-
con = Math.pow((1 - con) / (1 + con), com);
|
|
19218
|
-
return Math.tan(0.5 * (HALF_PI - phi)) / con;
|
|
19219
|
-
}
|
|
19220
|
-
var init_tsfnz = __esm({
|
|
19221
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/tsfnz.js"() {
|
|
19222
|
-
init_constants3();
|
|
19223
|
-
}
|
|
19224
|
-
});
|
|
19225
|
-
|
|
19226
20647
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/sign.js
|
|
19227
20648
|
function sign_default(x) {
|
|
19228
20649
|
return x < 0 ? -1 : 1;
|
|
@@ -19303,13 +20724,10 @@ return true;`);
|
|
|
19303
20724
|
function forward(state, p) {
|
|
19304
20725
|
var lon = p.x;
|
|
19305
20726
|
var lat = p.y;
|
|
19306
|
-
if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
|
|
19307
|
-
lat = sign_default(lat) * (HALF_PI - 2 * EPSLN);
|
|
19308
|
-
}
|
|
19309
20727
|
var con = Math.abs(Math.abs(lat) - HALF_PI);
|
|
19310
20728
|
var ts, rh1;
|
|
19311
20729
|
if (con > EPSLN) {
|
|
19312
|
-
ts = tsfnz_default(state.e, lat, Math.sin(lat));
|
|
20730
|
+
ts = state.sphere ? 1 / Math.tan(Math.PI / 4 + lat / 2) : tsfnz_default(state.e, lat, Math.sin(lat));
|
|
19313
20731
|
rh1 = state.a * state.f0 * Math.pow(ts, state.ns);
|
|
19314
20732
|
} else {
|
|
19315
20733
|
con = lat * state.ns;
|
|
@@ -19368,7 +20786,6 @@ return true;`);
|
|
|
19368
20786
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/lcc.js"() {
|
|
19369
20787
|
init_msfnz();
|
|
19370
20788
|
init_tsfnz();
|
|
19371
|
-
init_sign();
|
|
19372
20789
|
init_adjust_lon();
|
|
19373
20790
|
init_phi2z();
|
|
19374
20791
|
init_constants3();
|
|
@@ -19431,15 +20848,39 @@ return true;`);
|
|
|
19431
20848
|
}
|
|
19432
20849
|
});
|
|
19433
20850
|
|
|
19434
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/
|
|
19435
|
-
function
|
|
19436
|
-
|
|
19437
|
-
|
|
20851
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/iqsfnz.js
|
|
20852
|
+
function iqsfnz_default(eccent, q) {
|
|
20853
|
+
var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
|
|
20854
|
+
const roundoff = 4 * Number.EPSILON * temp;
|
|
20855
|
+
if (Math.abs(q) > temp + roundoff)
|
|
20856
|
+
return NaN;
|
|
20857
|
+
if (Math.abs(Math.abs(q) - temp) <= roundoff) {
|
|
20858
|
+
if (q < 0) {
|
|
20859
|
+
return -1 * HALF_PI;
|
|
20860
|
+
} else {
|
|
20861
|
+
return HALF_PI;
|
|
20862
|
+
}
|
|
19438
20863
|
}
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
20864
|
+
var phi = Math.asin(0.5 * q);
|
|
20865
|
+
var dphi;
|
|
20866
|
+
var sin_phi;
|
|
20867
|
+
var cos_phi;
|
|
20868
|
+
var con;
|
|
20869
|
+
for (var i = 0; i < 30; i++) {
|
|
20870
|
+
sin_phi = Math.sin(phi);
|
|
20871
|
+
cos_phi = Math.cos(phi);
|
|
20872
|
+
con = eccent * sin_phi;
|
|
20873
|
+
dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
|
|
20874
|
+
phi += dphi;
|
|
20875
|
+
if (Math.abs(dphi) <= 1e-10) {
|
|
20876
|
+
return phi;
|
|
20877
|
+
}
|
|
20878
|
+
}
|
|
20879
|
+
return NaN;
|
|
20880
|
+
}
|
|
20881
|
+
var init_iqsfnz = __esm({
|
|
20882
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/iqsfnz.js"() {
|
|
20883
|
+
init_constants3();
|
|
19443
20884
|
}
|
|
19444
20885
|
});
|
|
19445
20886
|
|
|
@@ -19505,36 +20946,20 @@ return true;`);
|
|
|
19505
20946
|
}
|
|
19506
20947
|
con = rh1 * state.ns0 / state.a;
|
|
19507
20948
|
if (state.sphere) {
|
|
19508
|
-
|
|
20949
|
+
const sinLatitude = (state.c - con * con) / (2 * state.ns0);
|
|
20950
|
+
if (Math.abs(sinLatitude) > 1 + 8 * Number.EPSILON)
|
|
20951
|
+
return null;
|
|
20952
|
+
lat = Math.asin(Math.max(-1, Math.min(1, sinLatitude)));
|
|
19509
20953
|
} else {
|
|
19510
20954
|
qs = (state.c - con * con) / state.ns0;
|
|
19511
|
-
|
|
20955
|
+
const poleQ = qsfnz_default(state.e3, 1);
|
|
20956
|
+
lat = Math.abs(Math.abs(qs) - poleQ) <= 16 * Number.EPSILON * poleQ ? Math.sign(qs) * Math.PI / 2 : iqsfnz_default(state.e3, qs);
|
|
19512
20957
|
}
|
|
19513
20958
|
lon = adjust_lon_default(theta / state.ns0 + state.long0, state.over);
|
|
19514
20959
|
p.x = lon;
|
|
19515
20960
|
p.y = lat;
|
|
19516
20961
|
return p;
|
|
19517
20962
|
}
|
|
19518
|
-
function phi1z(eccent, qs) {
|
|
19519
|
-
var sinphi, cosphi, con, com, dphi;
|
|
19520
|
-
var phi = asinz_default(0.5 * qs);
|
|
19521
|
-
if (eccent < EPSLN) {
|
|
19522
|
-
return phi;
|
|
19523
|
-
}
|
|
19524
|
-
var eccnts = eccent * eccent;
|
|
19525
|
-
for (var i = 1; i <= 25; i++) {
|
|
19526
|
-
sinphi = Math.sin(phi);
|
|
19527
|
-
cosphi = Math.cos(phi);
|
|
19528
|
-
con = eccent * sinphi;
|
|
19529
|
-
com = 1 - con * con;
|
|
19530
|
-
dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
|
|
19531
|
-
phi = phi + dphi;
|
|
19532
|
-
if (Math.abs(dphi) <= 1e-7) {
|
|
19533
|
-
return phi;
|
|
19534
|
-
}
|
|
19535
|
-
}
|
|
19536
|
-
return null;
|
|
19537
|
-
}
|
|
19538
20963
|
function createState2(base) {
|
|
19539
20964
|
const state = {
|
|
19540
20965
|
...base,
|
|
@@ -19565,7 +20990,7 @@ return true;`);
|
|
|
19565
20990
|
init_msfnz();
|
|
19566
20991
|
init_qsfnz();
|
|
19567
20992
|
init_adjust_lon();
|
|
19568
|
-
|
|
20993
|
+
init_iqsfnz();
|
|
19569
20994
|
init_constants3();
|
|
19570
20995
|
}
|
|
19571
20996
|
});
|
|
@@ -19664,7 +21089,7 @@ return true;`);
|
|
|
19664
21089
|
|
|
19665
21090
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/adjust_lat.js
|
|
19666
21091
|
function adjust_lat_default(x) {
|
|
19667
|
-
return Math.abs(x)
|
|
21092
|
+
return Math.abs(x) <= HALF_PI ? x : x - sign_default(x) * Math.PI;
|
|
19668
21093
|
}
|
|
19669
21094
|
var init_adjust_lat = __esm({
|
|
19670
21095
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/adjust_lat.js"() {
|
|
@@ -19802,6 +21227,54 @@ return true;`);
|
|
|
19802
21227
|
}
|
|
19803
21228
|
});
|
|
19804
21229
|
|
|
21230
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/authalic-latitude.js
|
|
21231
|
+
function authalicPoleDifference(e, latitude) {
|
|
21232
|
+
const sin = Math.abs(Math.sin(latitude));
|
|
21233
|
+
const cos = Math.cos(latitude);
|
|
21234
|
+
const delta = cos * cos / (1 + sin);
|
|
21235
|
+
if (e === 0)
|
|
21236
|
+
return 2 * delta;
|
|
21237
|
+
const es = e * e;
|
|
21238
|
+
return delta * (1 + es * sin) / (1 - es * sin * sin) + (1 - es) / e * Math.atanh(e * delta / (1 - es * sin));
|
|
21239
|
+
}
|
|
21240
|
+
function authalicLatitude(e, qp, latitude) {
|
|
21241
|
+
if (latitude === 0 || e === 0)
|
|
21242
|
+
return latitude;
|
|
21243
|
+
const fraction = authalicPoleDifference(e, latitude) / qp;
|
|
21244
|
+
return Math.atan2(Math.sign(latitude) * (1 - fraction), Math.sqrt(fraction * (2 - fraction)));
|
|
21245
|
+
}
|
|
21246
|
+
function inverseAuthalicLatitude(e, qp, beta) {
|
|
21247
|
+
if (e === 0 || beta === 0 || Math.abs(beta) === Math.PI / 2)
|
|
21248
|
+
return beta;
|
|
21249
|
+
const sinBeta = Math.abs(Math.sin(beta));
|
|
21250
|
+
const cosBeta = Math.cos(beta);
|
|
21251
|
+
const target = qp * cosBeta * cosBeta / (1 + sinBeta);
|
|
21252
|
+
let latitude = Math.abs(beta);
|
|
21253
|
+
const es = e * e;
|
|
21254
|
+
let lower = 0;
|
|
21255
|
+
let upper = Math.PI / 2;
|
|
21256
|
+
for (let i = 0; i < 48; i++) {
|
|
21257
|
+
const sin = Math.sin(latitude);
|
|
21258
|
+
const denominator = 1 - es * sin * sin;
|
|
21259
|
+
const derivative = 2 * (1 - es) * Math.cos(latitude) / (denominator * denominator);
|
|
21260
|
+
const residual = authalicPoleDifference(e, latitude) - target;
|
|
21261
|
+
const step = residual / derivative;
|
|
21262
|
+
if (Math.abs(step) < 2e-15)
|
|
21263
|
+
return Math.sign(beta) * latitude;
|
|
21264
|
+
if (residual > 0)
|
|
21265
|
+
lower = latitude;
|
|
21266
|
+
else
|
|
21267
|
+
upper = latitude;
|
|
21268
|
+
const candidate = latitude + step;
|
|
21269
|
+
latitude = candidate > lower && candidate < upper ? candidate : (lower + upper) / 2;
|
|
21270
|
+
}
|
|
21271
|
+
throw new Error("Authalic latitude inverse did not converge");
|
|
21272
|
+
}
|
|
21273
|
+
var init_authalic_latitude = __esm({
|
|
21274
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/authalic-latitude.js"() {
|
|
21275
|
+
}
|
|
21276
|
+
});
|
|
21277
|
+
|
|
19805
21278
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/rendering-profile/spherical-rendering-domain.js
|
|
19806
21279
|
function geographicVector(longitude, latitude) {
|
|
19807
21280
|
return [
|
|
@@ -19993,6 +21466,25 @@ return true;`);
|
|
|
19993
21466
|
const factor = base.a * (kind === "stere" ? 2 * base.k0 : 1);
|
|
19994
21467
|
return envelope(add([base.x0, base.x0], scale(range(east), factor)), add([base.y0, base.y0], scale(range(north), factor)));
|
|
19995
21468
|
}
|
|
21469
|
+
function orthographicBounds(base, parameters, domain) {
|
|
21470
|
+
const sin0 = Math.sin(base.lat0);
|
|
21471
|
+
const cos0 = Math.cos(base.lat0);
|
|
21472
|
+
const latitudeSin = sphericalRange([0, 0, 1], parameters, domain);
|
|
21473
|
+
if (Math.abs(sin0) < 1e-15 && (!domain || Math.abs(domain.distance - Math.PI / 2) < 1e-15)) {
|
|
21474
|
+
const x = (maximize) => {
|
|
21475
|
+
const extremum = sphericalExtremum([0, 1, 0], parameters, domain, maximize);
|
|
21476
|
+
return extremum.value / Math.sqrt(1 - base.es * Math.sin(extremum.point[1]) ** 2);
|
|
21477
|
+
};
|
|
21478
|
+
const y = (sin) => (1 - base.es) * sin / Math.sqrt(1 - base.es * sin * sin);
|
|
21479
|
+
return envelope(add([base.x0, base.x0], scale([x(false), x(true)], base.a * base.k0)), add([base.y0, base.y0], scale([y(latitudeSin[0]), y(latitudeSin[1])], base.a * base.k0)));
|
|
21480
|
+
}
|
|
21481
|
+
const squareMin = latitudeSin[0] <= 0 && latitudeSin[1] >= 0 ? 0 : Math.min(latitudeSin[0] ** 2, latitudeSin[1] ** 2);
|
|
21482
|
+
const squareMax = Math.max(latitudeSin[0] ** 2, latitudeSin[1] ** 2);
|
|
21483
|
+
const nu = ordered(1 / Math.sqrt(1 - base.es * squareMin), 1 / Math.sqrt(1 - base.es * squareMax));
|
|
21484
|
+
const factor = base.a * base.k0;
|
|
21485
|
+
const yShift = base.es * sin0 * cos0 / Math.sqrt(1 - base.es * sin0 * sin0);
|
|
21486
|
+
return envelope(add([base.x0, base.x0], scale(multiply(sphericalRange([0, 1, 0], parameters, domain), nu), factor)), add([base.y0 + factor * yShift, base.y0 + factor * yShift], scale(multiply(sphericalRange([-sin0, 0, (1 - base.es) * cos0], parameters, domain), nu), factor)));
|
|
21487
|
+
}
|
|
19996
21488
|
function equidistantAzimuthalBounds(base, parameters, domain) {
|
|
19997
21489
|
const minimum = sphericalRange([Math.cos(base.lat0), 0, Math.sin(base.lat0)], parameters, domain)[0];
|
|
19998
21490
|
const radius2 = base.a / Math.sqrt(1 - base.es) * Math.acos(Math.max(-1, Math.min(1, minimum)));
|
|
@@ -20045,6 +21537,17 @@ return true;`);
|
|
|
20045
21537
|
const y = sphericalRatioRange(up, denominator, cw * p, parameters, domain);
|
|
20046
21538
|
return envelope(add([base.x0, base.x0], scale(x, base.a * (p - 1) * cw)), add([base.y0, base.y0], scale(y, base.a * (p - 1))));
|
|
20047
21539
|
}
|
|
21540
|
+
function ellipsoidalGnomonicBounds(base, region, domain) {
|
|
21541
|
+
const dot2 = sphericalRange([Math.cos(base.lat0), 0, Math.sin(base.lat0)], region, domain)[0];
|
|
21542
|
+
const angle = Math.acos(Math.max(-1, Math.min(1, dot2)));
|
|
21543
|
+
const q = 1 - base.es;
|
|
21544
|
+
const distance = base.a * angle / Math.sqrt(q);
|
|
21545
|
+
const scale2 = Math.cos(angle / q);
|
|
21546
|
+
if (!(scale2 > 0))
|
|
21547
|
+
throw new Error("Gnomonic rendering coverage approaches its ellipsoidal horizon");
|
|
21548
|
+
const radius2 = distance / scale2;
|
|
21549
|
+
return envelope([base.x0 - radius2, base.x0 + radius2], [base.y0 - radius2, base.y0 + radius2]);
|
|
21550
|
+
}
|
|
20048
21551
|
var init_azimuthal_rendering_bounds = __esm({
|
|
20049
21552
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.js"() {
|
|
20050
21553
|
init_geographic_bounds();
|
|
@@ -20053,39 +21556,15 @@ return true;`);
|
|
|
20053
21556
|
}
|
|
20054
21557
|
});
|
|
20055
21558
|
|
|
20056
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/
|
|
20057
|
-
function
|
|
20058
|
-
|
|
20059
|
-
|
|
20060
|
-
|
|
20061
|
-
|
|
20062
|
-
APA[0] += t * P01;
|
|
20063
|
-
APA[1] = t * P10;
|
|
20064
|
-
t *= es;
|
|
20065
|
-
APA[0] += t * P02;
|
|
20066
|
-
APA[1] += t * P11;
|
|
20067
|
-
APA[2] = t * P20;
|
|
20068
|
-
return APA;
|
|
21559
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/inverse-spherical-latitude.js
|
|
21560
|
+
function inverseSphericalLatitude(sin0, cos0, sinDistance, cosDistance, x, y, radius2) {
|
|
21561
|
+
const east = x * sinDistance / radius2;
|
|
21562
|
+
const meridian = cosDistance * cos0 - y * sinDistance * sin0 / radius2;
|
|
21563
|
+
const vertical = cosDistance * sin0 + y * sinDistance * cos0 / radius2;
|
|
21564
|
+
return Math.atan2(vertical, Math.hypot(east, meridian));
|
|
20069
21565
|
}
|
|
20070
|
-
var
|
|
20071
|
-
|
|
20072
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/authset.js"() {
|
|
20073
|
-
P00 = 0.3333333333333333;
|
|
20074
|
-
P01 = 0.17222222222222222;
|
|
20075
|
-
P02 = 0.10257936507936508;
|
|
20076
|
-
P10 = 0.06388888888888888;
|
|
20077
|
-
P11 = 0.0664021164021164;
|
|
20078
|
-
P20 = 0.016415012942191543;
|
|
20079
|
-
}
|
|
20080
|
-
});
|
|
20081
|
-
|
|
20082
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/authlat.js
|
|
20083
|
-
function authlat(beta, APA) {
|
|
20084
|
-
var t = beta + beta;
|
|
20085
|
-
return beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t);
|
|
20086
|
-
}
|
|
20087
|
-
var init_authlat = __esm({
|
|
20088
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/authlat.js"() {
|
|
21566
|
+
var init_inverse_spherical_latitude = __esm({
|
|
21567
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/inverse-spherical-latitude.js"() {
|
|
20089
21568
|
}
|
|
20090
21569
|
});
|
|
20091
21570
|
|
|
@@ -20103,7 +21582,6 @@ return true;`);
|
|
|
20103
21582
|
var sinphi;
|
|
20104
21583
|
state.qp = qsfnz_default(state.e, 1);
|
|
20105
21584
|
state.mmf = 0.5 / (1 - state.es);
|
|
20106
|
-
state.apa = authset(state.es);
|
|
20107
21585
|
switch (state.mode) {
|
|
20108
21586
|
case N_POLE:
|
|
20109
21587
|
state.dd = 1;
|
|
@@ -20174,7 +21652,8 @@ return true;`);
|
|
|
20174
21652
|
q = qsfnz_default(state.e, sinphi);
|
|
20175
21653
|
if (state.mode === OBLIQ || state.mode === EQUIT) {
|
|
20176
21654
|
sinb = q / state.qp;
|
|
20177
|
-
|
|
21655
|
+
const poleFraction = authalicPoleDifference(state.e, phi) / state.qp;
|
|
21656
|
+
cosb = Math.sqrt(poleFraction * (2 - poleFraction));
|
|
20178
21657
|
}
|
|
20179
21658
|
switch (state.mode) {
|
|
20180
21659
|
case OBLIQ:
|
|
@@ -20185,11 +21664,11 @@ return true;`);
|
|
|
20185
21664
|
break;
|
|
20186
21665
|
case N_POLE:
|
|
20187
21666
|
b = HALF_PI + phi;
|
|
20188
|
-
q = state.qp -
|
|
21667
|
+
q = phi >= 0 ? authalicPoleDifference(state.e, phi) : 2 * state.qp - authalicPoleDifference(state.e, phi);
|
|
20189
21668
|
break;
|
|
20190
21669
|
case S_POLE:
|
|
20191
21670
|
b = phi - HALF_PI;
|
|
20192
|
-
q = state.qp
|
|
21671
|
+
q = phi <= 0 ? authalicPoleDifference(state.e, phi) : 2 * state.qp - authalicPoleDifference(state.e, phi);
|
|
20193
21672
|
break;
|
|
20194
21673
|
}
|
|
20195
21674
|
if (Math.abs(b) < EPSLN) {
|
|
@@ -20233,22 +21712,22 @@ return true;`);
|
|
|
20233
21712
|
var cosz = 0, rh, sinz = 0;
|
|
20234
21713
|
rh = Math.sqrt(x * x + y * y);
|
|
20235
21714
|
phi = rh * 0.5;
|
|
20236
|
-
if (phi > 1) {
|
|
21715
|
+
if (phi > 1 + 8 * Number.EPSILON) {
|
|
20237
21716
|
return null;
|
|
20238
21717
|
}
|
|
20239
|
-
phi = 2 * Math.asin(phi);
|
|
21718
|
+
phi = 2 * Math.asin(Math.min(1, phi));
|
|
20240
21719
|
if (state.mode === OBLIQ || state.mode === EQUIT) {
|
|
20241
21720
|
sinz = Math.sin(phi);
|
|
20242
21721
|
cosz = Math.cos(phi);
|
|
20243
21722
|
}
|
|
20244
21723
|
switch (state.mode) {
|
|
20245
21724
|
case EQUIT:
|
|
20246
|
-
phi = Math.abs(rh) <= EPSLN ? 0 :
|
|
21725
|
+
phi = Math.abs(rh) <= EPSLN ? 0 : inverseSphericalLatitude(0, 1, sinz, cosz, x, y, rh);
|
|
20247
21726
|
x *= sinz;
|
|
20248
21727
|
y = cosz * rh;
|
|
20249
21728
|
break;
|
|
20250
21729
|
case OBLIQ:
|
|
20251
|
-
phi = Math.abs(rh) <= EPSLN ? state.lat0 :
|
|
21730
|
+
phi = Math.abs(rh) <= EPSLN ? state.lat0 : inverseSphericalLatitude(state.sinph0, state.cosph0, sinz, cosz, x, y, rh);
|
|
20252
21731
|
x *= sinz * state.cosph0;
|
|
20253
21732
|
y = (cosz - Math.sin(phi) * state.sinph0) * rh;
|
|
20254
21733
|
break;
|
|
@@ -20272,9 +21751,15 @@ return true;`);
|
|
|
20272
21751
|
p.y = state.lat0;
|
|
20273
21752
|
return p;
|
|
20274
21753
|
}
|
|
20275
|
-
|
|
21754
|
+
const sinHalfCe = 0.5 * rho / state.rq;
|
|
21755
|
+
if (sinHalfCe > 1 + 8 * Number.EPSILON)
|
|
21756
|
+
return null;
|
|
21757
|
+
sCe = 2 * Math.asin(Math.min(1, sinHalfCe));
|
|
20276
21758
|
cCe = Math.cos(sCe);
|
|
20277
|
-
|
|
21759
|
+
sCe = Math.sin(sCe);
|
|
21760
|
+
const beta = inverseSphericalLatitude(state.mode === OBLIQ ? state.sinb1 : 0, state.mode === OBLIQ ? state.cosb1 : 1, sCe, cCe, x, y, rho);
|
|
21761
|
+
phi = inverseAuthalicLatitude(state.e, state.qp, beta);
|
|
21762
|
+
x *= sCe;
|
|
20278
21763
|
if (state.mode === OBLIQ) {
|
|
20279
21764
|
ab = cCe * state.sinb1 + y * sCe * state.cosb1 / rho;
|
|
20280
21765
|
q = state.qp * ab;
|
|
@@ -20300,7 +21785,13 @@ return true;`);
|
|
|
20300
21785
|
}
|
|
20301
21786
|
}
|
|
20302
21787
|
lam = Math.atan2(x, y);
|
|
20303
|
-
|
|
21788
|
+
if (Math.abs(ab) > 1 + 8 * Number.EPSILON)
|
|
21789
|
+
return null;
|
|
21790
|
+
if (state.mode === N_POLE || state.mode === S_POLE) {
|
|
21791
|
+
const fraction = Math.max(0, Math.min(2, q / state.qp));
|
|
21792
|
+
const beta = Math.atan2(ab, Math.sqrt(fraction * (2 - fraction)));
|
|
21793
|
+
phi = inverseAuthalicLatitude(state.e, state.qp, beta);
|
|
21794
|
+
}
|
|
20304
21795
|
}
|
|
20305
21796
|
p.x = adjust_lon_default(state.long0 + lam, state.over);
|
|
20306
21797
|
p.y = phi;
|
|
@@ -20312,7 +21803,6 @@ return true;`);
|
|
|
20312
21803
|
mode: 0,
|
|
20313
21804
|
qp: 0,
|
|
20314
21805
|
mmf: 0,
|
|
20315
|
-
apa: [],
|
|
20316
21806
|
dd: 0,
|
|
20317
21807
|
rq: 0,
|
|
20318
21808
|
xmf: 0,
|
|
@@ -20331,8 +21821,8 @@ return true;`);
|
|
|
20331
21821
|
init_constants3();
|
|
20332
21822
|
init_qsfnz();
|
|
20333
21823
|
init_adjust_lon();
|
|
20334
|
-
|
|
20335
|
-
|
|
21824
|
+
init_authalic_latitude();
|
|
21825
|
+
init_inverse_spherical_latitude();
|
|
20336
21826
|
S_POLE = 1;
|
|
20337
21827
|
N_POLE = 2;
|
|
20338
21828
|
EQUIT = 3;
|
|
@@ -20344,7 +21834,7 @@ return true;`);
|
|
|
20344
21834
|
var lambertAzimuthalEqualArea;
|
|
20345
21835
|
var init_laea2 = __esm({
|
|
20346
21836
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/projections/laea.js"() {
|
|
20347
|
-
|
|
21837
|
+
init_authalic_latitude();
|
|
20348
21838
|
init_angular_rendering_profile();
|
|
20349
21839
|
init_azimuthal_rendering_bounds();
|
|
20350
21840
|
init_kernel();
|
|
@@ -20356,7 +21846,7 @@ return true;`);
|
|
|
20356
21846
|
create(context) {
|
|
20357
21847
|
const base = kernelParameters(context);
|
|
20358
21848
|
const state = createState4(base);
|
|
20359
|
-
return withAngularRenderingProfile(guardAzimuthalDomain(base, bindKernel("laea", state, forward4, inverse4)), base, Math.PI * 179 / 180, (region, domain) => equalAreaAzimuthalBounds(base, base.sphere ? 1 : state.xmf || Math.sqrt(state.qp / 2), base.sphere ? 1 : state.ymf || Math.sqrt(state.qp / 2), region, domain, base.sphere ? base.lat0 :
|
|
21849
|
+
return withAngularRenderingProfile(guardAzimuthalDomain(base, bindKernel("laea", state, forward4, inverse4)), base, Math.PI * 179 / 180, (region, domain) => equalAreaAzimuthalBounds(base, base.sphere ? 1 : state.xmf || Math.sqrt(state.qp / 2), base.sphere ? 1 : state.ymf || Math.sqrt(state.qp / 2), region, domain, base.sphere ? base.lat0 : authalicLatitude(base.e, state.qp, base.lat0), base.sphere ? (latitude) => latitude : (latitude) => authalicLatitude(base.e, state.qp, latitude)));
|
|
20360
21850
|
}
|
|
20361
21851
|
};
|
|
20362
21852
|
}
|
|
@@ -20408,6 +21898,13 @@ return true;`);
|
|
|
20408
21898
|
p.y = NaN;
|
|
20409
21899
|
return p;
|
|
20410
21900
|
}
|
|
21901
|
+
if (state.sphere && Math.abs(state.coslat0) <= EPSLN) {
|
|
21902
|
+
const sign2 = state.lat0 > 0 ? 1 : -1;
|
|
21903
|
+
const radius2 = 2 * state.a * state.k0 * Math.tan(Math.PI / 4 - sign2 * lat / 2);
|
|
21904
|
+
p.x = state.x0 + radius2 * Math.sin(dlon);
|
|
21905
|
+
p.y = state.y0 - sign2 * radius2 * Math.cos(dlon);
|
|
21906
|
+
return p;
|
|
21907
|
+
}
|
|
20411
21908
|
if (state.sphere) {
|
|
20412
21909
|
A = 2 * state.k0 / (1 + state.sinlat0 * sinlat + state.coslat0 * coslat * Math.cos(dlon));
|
|
20413
21910
|
p.x = state.a * A * coslat * Math.sin(dlon) + state.x0;
|
|
@@ -20448,7 +21945,7 @@ return true;`);
|
|
|
20448
21945
|
p.y = lat;
|
|
20449
21946
|
return p;
|
|
20450
21947
|
}
|
|
20451
|
-
lat =
|
|
21948
|
+
lat = inverseSphericalLatitude(state.sinlat0, state.coslat0, Math.sin(c), Math.cos(c), p.x, p.y, rh);
|
|
20452
21949
|
if (Math.abs(state.coslat0) < EPSLN) {
|
|
20453
21950
|
if (state.lat0 > 0) {
|
|
20454
21951
|
lon = adjust_lon_default(state.long0 + Math.atan2(p.x, -1 * p.y), state.over);
|
|
@@ -20481,7 +21978,7 @@ return true;`);
|
|
|
20481
21978
|
if (rh <= EPSLN) {
|
|
20482
21979
|
Chi = state.X0;
|
|
20483
21980
|
} else {
|
|
20484
|
-
Chi =
|
|
21981
|
+
Chi = inverseSphericalLatitude(state.sinX0, state.cosX0, Math.sin(ce), Math.cos(ce), p.x, p.y, rh);
|
|
20485
21982
|
lon = adjust_lon_default(state.long0 + Math.atan2(p.x * Math.sin(ce), rh * state.cosX0 * Math.cos(ce) - p.y * state.sinX0 * Math.sin(ce)), state.over);
|
|
20486
21983
|
}
|
|
20487
21984
|
lat = -1 * phi2z_default(state.e, Math.tan(0.5 * (HALF_PI + Chi)));
|
|
@@ -20508,6 +22005,7 @@ return true;`);
|
|
|
20508
22005
|
}
|
|
20509
22006
|
var init_stere = __esm({
|
|
20510
22007
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/stere.js"() {
|
|
22008
|
+
init_inverse_spherical_latitude();
|
|
20511
22009
|
init_constants3();
|
|
20512
22010
|
init_sign();
|
|
20513
22011
|
init_msfnz();
|
|
@@ -20658,7 +22156,7 @@ return true;`);
|
|
|
20658
22156
|
var c = 2 * Math.atan2(rho, state.R2);
|
|
20659
22157
|
sinc = Math.sin(c);
|
|
20660
22158
|
cosc = Math.cos(c);
|
|
20661
|
-
lat =
|
|
22159
|
+
lat = inverseSphericalLatitude(state.sinc0, state.cosc0, sinc, cosc, p.x, p.y, rho);
|
|
20662
22160
|
lon = Math.atan2(p.x * sinc, rho * state.cosc0 * cosc - p.y * state.sinc0 * sinc);
|
|
20663
22161
|
} else {
|
|
20664
22162
|
lat = state.phic0;
|
|
@@ -20683,6 +22181,7 @@ return true;`);
|
|
|
20683
22181
|
}
|
|
20684
22182
|
var init_sterea = __esm({
|
|
20685
22183
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/sterea.js"() {
|
|
22184
|
+
init_inverse_spherical_latitude();
|
|
20686
22185
|
init_gauss();
|
|
20687
22186
|
init_adjust_lon();
|
|
20688
22187
|
init_hypot();
|
|
@@ -20914,7 +22413,7 @@ return true;`);
|
|
|
20914
22413
|
if (Math.abs(rh) <= EPSLN) {
|
|
20915
22414
|
lat = state.lat0;
|
|
20916
22415
|
} else {
|
|
20917
|
-
lat =
|
|
22416
|
+
lat = inverseSphericalLatitude(state.sin_p12, state.cos_p12, sinz, cosz, p.x, p.y, rh);
|
|
20918
22417
|
con = Math.abs(state.lat0) - HALF_PI;
|
|
20919
22418
|
if (Math.abs(con) <= EPSLN) {
|
|
20920
22419
|
if (state.lat0 >= 0) {
|
|
@@ -20974,9 +22473,9 @@ return true;`);
|
|
|
20974
22473
|
}
|
|
20975
22474
|
var init_aeqd = __esm({
|
|
20976
22475
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/aeqd.js"() {
|
|
22476
|
+
init_inverse_spherical_latitude();
|
|
20977
22477
|
init_adjust_lon();
|
|
20978
22478
|
init_constants3();
|
|
20979
|
-
init_asinz();
|
|
20980
22479
|
init_meridian_distance();
|
|
20981
22480
|
init_vincenty();
|
|
20982
22481
|
}
|
|
@@ -21953,42 +23452,6 @@ return true;`);
|
|
|
21953
23452
|
}
|
|
21954
23453
|
});
|
|
21955
23454
|
|
|
21956
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/iqsfnz.js
|
|
21957
|
-
function iqsfnz_default(eccent, q) {
|
|
21958
|
-
var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
|
|
21959
|
-
const roundoff = 4 * Number.EPSILON * temp;
|
|
21960
|
-
if (Math.abs(q) > temp + roundoff)
|
|
21961
|
-
return NaN;
|
|
21962
|
-
if (Math.abs(Math.abs(q) - temp) <= roundoff) {
|
|
21963
|
-
if (q < 0) {
|
|
21964
|
-
return -1 * HALF_PI;
|
|
21965
|
-
} else {
|
|
21966
|
-
return HALF_PI;
|
|
21967
|
-
}
|
|
21968
|
-
}
|
|
21969
|
-
var phi = Math.asin(0.5 * q);
|
|
21970
|
-
var dphi;
|
|
21971
|
-
var sin_phi;
|
|
21972
|
-
var cos_phi;
|
|
21973
|
-
var con;
|
|
21974
|
-
for (var i = 0; i < 30; i++) {
|
|
21975
|
-
sin_phi = Math.sin(phi);
|
|
21976
|
-
cos_phi = Math.cos(phi);
|
|
21977
|
-
con = eccent * sin_phi;
|
|
21978
|
-
dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
|
|
21979
|
-
phi += dphi;
|
|
21980
|
-
if (Math.abs(dphi) <= 1e-10) {
|
|
21981
|
-
return phi;
|
|
21982
|
-
}
|
|
21983
|
-
}
|
|
21984
|
-
return NaN;
|
|
21985
|
-
}
|
|
21986
|
-
var init_iqsfnz = __esm({
|
|
21987
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/iqsfnz.js"() {
|
|
21988
|
-
init_constants3();
|
|
21989
|
-
}
|
|
21990
|
-
});
|
|
21991
|
-
|
|
21992
23455
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/cea.js
|
|
21993
23456
|
function initialize13(state) {
|
|
21994
23457
|
if (!state.sphere) {
|
|
@@ -22069,6 +23532,18 @@ return true;`);
|
|
|
22069
23532
|
}
|
|
22070
23533
|
});
|
|
22071
23534
|
|
|
23535
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/asinz.js
|
|
23536
|
+
function asinz_default(x) {
|
|
23537
|
+
if (Math.abs(x) > 1) {
|
|
23538
|
+
x = x > 1 ? 1 : -1;
|
|
23539
|
+
}
|
|
23540
|
+
return Math.asin(x);
|
|
23541
|
+
}
|
|
23542
|
+
var init_asinz = __esm({
|
|
23543
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/asinz.js"() {
|
|
23544
|
+
}
|
|
23545
|
+
});
|
|
23546
|
+
|
|
22072
23547
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/sinu.js
|
|
22073
23548
|
function initialize14(state) {
|
|
22074
23549
|
state.long0 = state.long0 || 0;
|
|
@@ -22122,7 +23597,10 @@ return true;`);
|
|
|
22122
23597
|
lat /= state.C_y;
|
|
22123
23598
|
lon = lon / (state.C_x * (state.m + Math.cos(lat)));
|
|
22124
23599
|
if (state.m) {
|
|
22125
|
-
|
|
23600
|
+
const sinLatitude = (state.m * lat + Math.sin(lat)) / state.n;
|
|
23601
|
+
if (Math.abs(sinLatitude) > 1 + 8 * Number.EPSILON)
|
|
23602
|
+
return null;
|
|
23603
|
+
lat = asinz_default(sinLatitude);
|
|
22126
23604
|
} else if (state.n !== 1) {
|
|
22127
23605
|
lat = asinz_default(Math.sin(lat) / state.n);
|
|
22128
23606
|
}
|
|
@@ -22209,6 +23687,42 @@ return true;`);
|
|
|
22209
23687
|
}
|
|
22210
23688
|
});
|
|
22211
23689
|
|
|
23690
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/authset.js
|
|
23691
|
+
function authset(es) {
|
|
23692
|
+
var t;
|
|
23693
|
+
var APA = [];
|
|
23694
|
+
APA[0] = es * P00;
|
|
23695
|
+
t = es * es;
|
|
23696
|
+
APA[0] += t * P01;
|
|
23697
|
+
APA[1] = t * P10;
|
|
23698
|
+
t *= es;
|
|
23699
|
+
APA[0] += t * P02;
|
|
23700
|
+
APA[1] += t * P11;
|
|
23701
|
+
APA[2] = t * P20;
|
|
23702
|
+
return APA;
|
|
23703
|
+
}
|
|
23704
|
+
var P00, P01, P02, P10, P11, P20;
|
|
23705
|
+
var init_authset = __esm({
|
|
23706
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/authset.js"() {
|
|
23707
|
+
P00 = 0.3333333333333333;
|
|
23708
|
+
P01 = 0.17222222222222222;
|
|
23709
|
+
P02 = 0.10257936507936508;
|
|
23710
|
+
P10 = 0.06388888888888888;
|
|
23711
|
+
P11 = 0.0664021164021164;
|
|
23712
|
+
P20 = 0.016415012942191543;
|
|
23713
|
+
}
|
|
23714
|
+
});
|
|
23715
|
+
|
|
23716
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/authlat.js
|
|
23717
|
+
function authlat(beta, APA) {
|
|
23718
|
+
var t = beta + beta;
|
|
23719
|
+
return beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t);
|
|
23720
|
+
}
|
|
23721
|
+
var init_authlat = __esm({
|
|
23722
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/authlat.js"() {
|
|
23723
|
+
}
|
|
23724
|
+
});
|
|
23725
|
+
|
|
22212
23726
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/eqearth.js
|
|
22213
23727
|
function initialize16(state) {
|
|
22214
23728
|
state.long0 = state.long0 !== void 0 ? state.long0 : 0;
|
|
@@ -22245,6 +23759,11 @@ return true;`);
|
|
|
22245
23759
|
p.x /= state.rqda;
|
|
22246
23760
|
p.y /= state.rqda;
|
|
22247
23761
|
}
|
|
23762
|
+
const poleParam = Math.PI / 3;
|
|
23763
|
+
const poleSq = poleParam * poleParam;
|
|
23764
|
+
const poleY = poleParam * (A1 + A2 * poleSq + poleSq ** 3 * (A3 + A4 * poleSq));
|
|
23765
|
+
if (Math.abs(p.y) > poleY + 8 * Number.EPSILON * poleY)
|
|
23766
|
+
return null;
|
|
22248
23767
|
var EPS = 1e-9, NITER = 12, paramLat = p.y, paramLatSq, paramLatPow6, fy, fpy, dlat, i;
|
|
22249
23768
|
for (i = 0; i < NITER; ++i) {
|
|
22250
23769
|
paramLatSq = paramLat * paramLat;
|
|
@@ -22259,7 +23778,11 @@ return true;`);
|
|
|
22259
23778
|
paramLatSq = paramLat * paramLat;
|
|
22260
23779
|
paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
|
|
22261
23780
|
p.x = M * p.x * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)) / Math.cos(paramLat);
|
|
22262
|
-
|
|
23781
|
+
const sinBeta = Math.sin(paramLat) / M;
|
|
23782
|
+
const poleRoundoff = 8 * Number.EPSILON;
|
|
23783
|
+
if (Math.abs(sinBeta) > 1 + poleRoundoff)
|
|
23784
|
+
return null;
|
|
23785
|
+
p.y = Math.abs(sinBeta) >= 1 - poleRoundoff ? Math.sign(sinBeta) * Math.PI / 2 : Math.asin(sinBeta);
|
|
22263
23786
|
if (state.es !== 0) {
|
|
22264
23787
|
p.y = authlat(p.y, state.apa);
|
|
22265
23788
|
}
|
|
@@ -22356,6 +23879,8 @@ return true;`);
|
|
|
22356
23879
|
p.x -= state.x0;
|
|
22357
23880
|
p.y -= state.y0;
|
|
22358
23881
|
var lat = p.y / state.a;
|
|
23882
|
+
if (Math.abs(lat) > Math.PI / 2 && Math.abs(lat) <= Math.PI / 2 + 8 * Number.EPSILON)
|
|
23883
|
+
lat = Math.sign(lat) * Math.PI / 2;
|
|
22359
23884
|
var lon = adjust_lon_default(state.long0 + p.x / (state.a * Math.cos(state.lat0)), state.over);
|
|
22360
23885
|
p.x = lon;
|
|
22361
23886
|
p.y = lat;
|
|
@@ -22657,14 +24182,74 @@ return true;`);
|
|
|
22657
24182
|
}
|
|
22658
24183
|
});
|
|
22659
24184
|
|
|
24185
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/ellipsoidal-gnomonic.js
|
|
24186
|
+
function prepareEllipsoidalGnomonic(base) {
|
|
24187
|
+
return {
|
|
24188
|
+
engine: createGeodesicEngine({ semiMajorAxis: 1, semiMinorAxis: Math.sqrt(1 - base.es) }),
|
|
24189
|
+
latitude: base.lat0 * degrees
|
|
24190
|
+
};
|
|
24191
|
+
}
|
|
24192
|
+
function forwardEllipsoidalGnomonic(base, state, p) {
|
|
24193
|
+
const result = state.engine.Inverse(state.latitude, 0, p.y * degrees, adjust_lon_default(p.x - base.long0, base.over) * degrees, nonAreaGeodesicMask);
|
|
24194
|
+
if (!(result.M12 > 0))
|
|
24195
|
+
throw new Error("Coordinate is outside the ellipsoidal gnomonic horizon");
|
|
24196
|
+
const radius2 = base.a * result.m12 / result.M12;
|
|
24197
|
+
const azimuth = result.azi1 / degrees;
|
|
24198
|
+
p.x = base.x0 + radius2 * Math.sin(azimuth);
|
|
24199
|
+
p.y = base.y0 + radius2 * Math.cos(azimuth);
|
|
24200
|
+
return p;
|
|
24201
|
+
}
|
|
24202
|
+
function inverseEllipsoidalGnomonic(base, state, p) {
|
|
24203
|
+
const x = (p.x - base.x0) / base.a;
|
|
24204
|
+
const y = (p.y - base.y0) / base.a;
|
|
24205
|
+
const radius2 = Math.hypot(x, y);
|
|
24206
|
+
if (radius2 === 0) {
|
|
24207
|
+
p.x = base.long0;
|
|
24208
|
+
p.y = base.lat0;
|
|
24209
|
+
return p;
|
|
24210
|
+
}
|
|
24211
|
+
const line = state.engine.Line(state.latitude, 0, Math.atan2(x, y) * degrees, nonAreaGeodesicMask);
|
|
24212
|
+
const little = radius2 <= 1;
|
|
24213
|
+
const target = little ? radius2 : 1 / radius2;
|
|
24214
|
+
let distance = Math.atan(radius2);
|
|
24215
|
+
for (let iteration = 0; iteration < 20; iteration++) {
|
|
24216
|
+
const result = line.Position(distance, nonAreaGeodesicMask);
|
|
24217
|
+
const step = little ? (result.m12 - target * result.M12) * result.M12 : (target * result.m12 - result.M12) * result.m12;
|
|
24218
|
+
if (!Number.isFinite(step))
|
|
24219
|
+
break;
|
|
24220
|
+
distance -= step;
|
|
24221
|
+
if (Math.abs(step) < 1e-14) {
|
|
24222
|
+
const final = line.Position(distance, nonAreaGeodesicMask);
|
|
24223
|
+
if (!(final.M12 > 0))
|
|
24224
|
+
break;
|
|
24225
|
+
p.x = adjust_lon_default(base.long0 + final.lon2 / degrees, base.over);
|
|
24226
|
+
p.y = final.lat2 / degrees;
|
|
24227
|
+
return p;
|
|
24228
|
+
}
|
|
24229
|
+
}
|
|
24230
|
+
throw new Error("Ellipsoidal gnomonic inverse did not converge");
|
|
24231
|
+
}
|
|
24232
|
+
var degrees;
|
|
24233
|
+
var init_ellipsoidal_gnomonic = __esm({
|
|
24234
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/ellipsoidal-gnomonic.js"() {
|
|
24235
|
+
init_ellipsoid_geodesic();
|
|
24236
|
+
init_adjust_lon();
|
|
24237
|
+
degrees = 180 / Math.PI;
|
|
24238
|
+
}
|
|
24239
|
+
});
|
|
24240
|
+
|
|
22660
24241
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/gnom.js
|
|
22661
24242
|
function initialize19(state) {
|
|
24243
|
+
if (!state.sphere)
|
|
24244
|
+
state.ellipsoid = prepareEllipsoidalGnomonic(state);
|
|
22662
24245
|
state.sin_p14 = Math.sin(state.lat0);
|
|
22663
24246
|
state.cos_p14 = Math.cos(state.lat0);
|
|
22664
24247
|
state.infinity_dist = 1e3 * state.a;
|
|
22665
24248
|
state.rc = 1;
|
|
22666
24249
|
}
|
|
22667
24250
|
function forward19(state, p) {
|
|
24251
|
+
if (state.ellipsoid)
|
|
24252
|
+
return forwardEllipsoidalGnomonic(state, state.ellipsoid, p);
|
|
22668
24253
|
var sinphi, cosphi;
|
|
22669
24254
|
var dlon;
|
|
22670
24255
|
var coslon;
|
|
@@ -22691,6 +24276,8 @@ return true;`);
|
|
|
22691
24276
|
return p;
|
|
22692
24277
|
}
|
|
22693
24278
|
function inverse19(state, p) {
|
|
24279
|
+
if (state.ellipsoid)
|
|
24280
|
+
return inverseEllipsoidalGnomonic(state, state.ellipsoid, p);
|
|
22694
24281
|
var rh;
|
|
22695
24282
|
var sinc, cosc;
|
|
22696
24283
|
var c;
|
|
@@ -22730,6 +24317,7 @@ return true;`);
|
|
|
22730
24317
|
}
|
|
22731
24318
|
var init_gnom = __esm({
|
|
22732
24319
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/gnom.js"() {
|
|
24320
|
+
init_ellipsoidal_gnomonic();
|
|
22733
24321
|
init_adjust_lon();
|
|
22734
24322
|
init_asinz();
|
|
22735
24323
|
init_constants3();
|
|
@@ -22751,7 +24339,7 @@ return true;`);
|
|
|
22751
24339
|
create(context) {
|
|
22752
24340
|
const base = catalogueParameters(context);
|
|
22753
24341
|
const state = createState19(base);
|
|
22754
|
-
return withAngularRenderingProfile(bindCatalogueKernel("gnom", context, state, forward19, inverse19, horizonGuard(base)), base, Math.PI * 80 / 180, (region, domain) => sphericalAzimuthalBounds(catalogueBoundsParameters(base, context), region, domain, "gnom"), Math.PI / 2);
|
|
24342
|
+
return withAngularRenderingProfile(bindCatalogueKernel("gnom", context, state, forward19, inverse19, base.sphere ? horizonGuard(base) : void 0), base, Math.min(Math.PI * 80 / 180, (1 - base.es) * Math.PI * 0.45), (region, domain) => base.sphere ? sphericalAzimuthalBounds(catalogueBoundsParameters(base, context), region, domain, "gnom") : ellipsoidalGnomonicBounds(catalogueBoundsParameters(base, context), region, domain), (1 - base.es) * Math.PI / 2);
|
|
22755
24343
|
}
|
|
22756
24344
|
};
|
|
22757
24345
|
}
|
|
@@ -22889,7 +24477,7 @@ return true;`);
|
|
|
22889
24477
|
state.a = 6377397155e-3;
|
|
22890
24478
|
state.es = 0.006674372230614;
|
|
22891
24479
|
state.e = Math.sqrt(state.es);
|
|
22892
|
-
state.s45 =
|
|
24480
|
+
state.s45 = Math.PI / 4;
|
|
22893
24481
|
state.s90 = 2 * state.s45;
|
|
22894
24482
|
state.fi0 = state.lat0;
|
|
22895
24483
|
state.e2 = state.es;
|
|
@@ -23098,53 +24686,55 @@ return true;`);
|
|
|
23098
24686
|
var lon = p.x;
|
|
23099
24687
|
var lat = p.y;
|
|
23100
24688
|
var delta_lon = adjust_lon_default(lon - state.long0, state.over);
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23104
|
-
|
|
23105
|
-
|
|
24689
|
+
const sin = Math.sin(Math.abs(lat));
|
|
24690
|
+
const cos = Math.cos(lat);
|
|
24691
|
+
const target = Math.abs(lat) === Math.PI / 2 ? 0 : Math.PI * cos * cos / (1 + sin);
|
|
24692
|
+
let v = Math.cbrt(6 * target);
|
|
24693
|
+
let lower = 0;
|
|
24694
|
+
let upper = Math.PI;
|
|
24695
|
+
v = Math.min(v, upper);
|
|
24696
|
+
for (let i = 0; i < 32 && v > 0; i++) {
|
|
24697
|
+
const residual = sineComplement(v) - target;
|
|
24698
|
+
const step = residual / (2 * Math.sin(v / 2) ** 2);
|
|
24699
|
+
if (Math.abs(step) <= 16 * Number.EPSILON * v)
|
|
23106
24700
|
break;
|
|
23107
|
-
|
|
23108
|
-
|
|
23109
|
-
|
|
23110
|
-
|
|
23111
|
-
|
|
23112
|
-
if (Math.
|
|
24701
|
+
if (residual > 0)
|
|
24702
|
+
upper = v;
|
|
24703
|
+
else
|
|
24704
|
+
lower = v;
|
|
24705
|
+
const next = v - step;
|
|
24706
|
+
if (next === v || upper - lower <= 8 * Number.EPSILON * Math.max(1, v))
|
|
23113
24707
|
break;
|
|
23114
|
-
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
|
|
23118
|
-
delta_lon = 0;
|
|
24708
|
+
v = next >= lower && next <= upper ? next : (lower + upper) / 2;
|
|
24709
|
+
if (i === 31)
|
|
24710
|
+
throw new Error("Mollweide forward did not converge");
|
|
23119
24711
|
}
|
|
23120
|
-
var x =
|
|
23121
|
-
var y =
|
|
24712
|
+
var x = 2 * Math.SQRT2 / Math.PI * state.a * delta_lon * Math.sin(v / 2) + state.x0;
|
|
24713
|
+
var y = Math.sign(lat) * Math.SQRT2 * state.a * Math.cos(v / 2) + state.y0;
|
|
23122
24714
|
p.x = x;
|
|
23123
24715
|
p.y = y;
|
|
23124
24716
|
return p;
|
|
23125
24717
|
}
|
|
23126
24718
|
function inverse23(state, p) {
|
|
23127
|
-
|
|
23128
|
-
|
|
23129
|
-
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
if (!state.over &&
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
if (!state.over && lon > Math.PI) {
|
|
23141
|
-
lon = Math.PI;
|
|
23142
|
-
}
|
|
23143
|
-
arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
|
|
23144
|
-
if (Math.abs(arg) > 1) {
|
|
23145
|
-
arg = Math.sign(arg);
|
|
24719
|
+
const x = p.x - state.x0;
|
|
24720
|
+
const y = (p.y - state.y0) / (Math.SQRT2 * state.a);
|
|
24721
|
+
if (Math.abs(y) > 1 + 8 * Number.EPSILON)
|
|
24722
|
+
return null;
|
|
24723
|
+
const normalizedX = x / (2 * Math.SQRT2 * state.a);
|
|
24724
|
+
const ellipse = normalizedX * normalizedX + y * y;
|
|
24725
|
+
if (!state.over && ellipse > 1 + 8 * Number.EPSILON)
|
|
24726
|
+
return null;
|
|
24727
|
+
let v = 2 * Math.acos(Math.min(1, Math.abs(y)));
|
|
24728
|
+
let sinHalf = Math.sin(v / 2);
|
|
24729
|
+
if (!state.over && Math.abs(ellipse - 1) <= 8 * Number.EPSILON) {
|
|
24730
|
+
sinHalf = Math.min(1, Math.abs(normalizedX));
|
|
24731
|
+
v = 2 * Math.asin(sinHalf);
|
|
23146
24732
|
}
|
|
23147
|
-
|
|
24733
|
+
if (sinHalf === 0 && Math.abs(x) > 8 * Number.EPSILON * state.a)
|
|
24734
|
+
return null;
|
|
24735
|
+
const longitude = sinHalf === 0 ? 0 : Math.PI * normalizedX / sinHalf;
|
|
24736
|
+
var lon = adjust_lon_default(state.long0 + longitude, state.over);
|
|
24737
|
+
var lat = Math.sign(y) * (Math.PI / 2 - 2 * Math.asin(Math.sqrt(sineComplement(v) / (2 * Math.PI))));
|
|
23148
24738
|
p.x = lon;
|
|
23149
24739
|
p.y = lat;
|
|
23150
24740
|
return p;
|
|
@@ -23157,10 +24747,15 @@ return true;`);
|
|
|
23157
24747
|
initialize23(state);
|
|
23158
24748
|
return state;
|
|
23159
24749
|
}
|
|
24750
|
+
function sineComplement(v) {
|
|
24751
|
+
if (v > 0.5)
|
|
24752
|
+
return v - Math.sin(v);
|
|
24753
|
+
const squared = v * v;
|
|
24754
|
+
return v * squared * (1 / 6 + squared * (-1 / 120 + squared * (1 / 5040 + squared * (-1 / 362880 + squared * (1 / 39916800 + squared * (-1 / 6227020800 + squared / 1307674368e3))))));
|
|
24755
|
+
}
|
|
23160
24756
|
var init_moll = __esm({
|
|
23161
24757
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/moll.js"() {
|
|
23162
24758
|
init_adjust_lon();
|
|
23163
|
-
init_constants3();
|
|
23164
24759
|
}
|
|
23165
24760
|
});
|
|
23166
24761
|
|
|
@@ -23693,83 +25288,42 @@ return true;`);
|
|
|
23693
25288
|
});
|
|
23694
25289
|
|
|
23695
25290
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/ortho.js
|
|
23696
|
-
function
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
|
|
23709
|
-
sinphi = Math.sin(lat);
|
|
23710
|
-
cosphi = Math.cos(lat);
|
|
23711
|
-
coslon = Math.cos(dlon);
|
|
23712
|
-
g = state.sin_p14 * sinphi + state.cos_p14 * cosphi * coslon;
|
|
23713
|
-
ksp = 1;
|
|
23714
|
-
if (g > 0 || Math.abs(g) <= EPSLN) {
|
|
23715
|
-
x = (state.x0 || 0) + state.a * ksp * cosphi * Math.sin(dlon);
|
|
23716
|
-
y = (state.y0 || 0) + state.a * ksp * (state.cos_p14 * sinphi - state.sin_p14 * cosphi * coslon);
|
|
23717
|
-
}
|
|
23718
|
-
p.x = x;
|
|
23719
|
-
p.y = y;
|
|
25291
|
+
function createState26(base) {
|
|
25292
|
+
const sin0 = Math.sin(base.lat0);
|
|
25293
|
+
const cos0 = Math.cos(base.lat0);
|
|
25294
|
+
const nu0 = 1 / Math.sqrt(1 - base.es * sin0 * sin0);
|
|
25295
|
+
return { ...base, sin0, cos0, originY: -base.es * nu0 * sin0 * cos0 };
|
|
25296
|
+
}
|
|
25297
|
+
function forward26(s, p) {
|
|
25298
|
+
const longitude = adjust_lon_default(p.x - s.long0, s.over);
|
|
25299
|
+
const sin = Math.sin(p.y);
|
|
25300
|
+
const cos = Math.cos(p.y);
|
|
25301
|
+
const nu = 1 / Math.sqrt(1 - s.es * sin * sin);
|
|
25302
|
+
p.x = s.x0 + s.a * s.k0 * nu * cos * Math.sin(longitude);
|
|
25303
|
+
p.y = s.y0 + s.a * s.k0 * (nu * ((1 - s.es) * sin * s.cos0 - cos * Math.cos(longitude) * s.sin0) - s.originY);
|
|
23720
25304
|
return p;
|
|
23721
25305
|
}
|
|
23722
|
-
function inverse26(
|
|
23723
|
-
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
|
|
23728
|
-
|
|
23729
|
-
|
|
23730
|
-
|
|
23731
|
-
|
|
23732
|
-
|
|
23733
|
-
|
|
23734
|
-
|
|
23735
|
-
|
|
23736
|
-
|
|
23737
|
-
|
|
23738
|
-
lat0 = state.lat0 || 0;
|
|
23739
|
-
lon = long0;
|
|
23740
|
-
if (Math.abs(rh) <= EPSLN) {
|
|
23741
|
-
lat = lat0;
|
|
23742
|
-
p.x = lon;
|
|
23743
|
-
p.y = lat;
|
|
23744
|
-
return p;
|
|
23745
|
-
}
|
|
23746
|
-
lat = asinz_default(cosz * state.sin_p14 + p.y * sinz * state.cos_p14 / rh);
|
|
23747
|
-
con = Math.abs(lat0) - HALF_PI;
|
|
23748
|
-
if (Math.abs(con) <= EPSLN) {
|
|
23749
|
-
if (lat0 >= 0) {
|
|
23750
|
-
lon = adjust_lon_default(long0 + Math.atan2(p.x, -p.y), state.over);
|
|
23751
|
-
} else {
|
|
23752
|
-
lon = adjust_lon_default(long0 - Math.atan2(-p.x, p.y), state.over);
|
|
23753
|
-
}
|
|
23754
|
-
p.x = lon;
|
|
23755
|
-
p.y = lat;
|
|
23756
|
-
return p;
|
|
23757
|
-
}
|
|
23758
|
-
lon = adjust_lon_default(long0 + Math.atan2(p.x * sinz, rh * state.cos_p14 * cosz - p.y * state.sin_p14 * sinz), state.over);
|
|
23759
|
-
p.x = lon;
|
|
23760
|
-
p.y = lat;
|
|
25306
|
+
function inverse26(s, p) {
|
|
25307
|
+
const x = (p.x - s.x0) / (s.a * s.k0);
|
|
25308
|
+
const y = (p.y - s.y0) / (s.a * s.k0) + s.originY;
|
|
25309
|
+
const q = 1 - s.es;
|
|
25310
|
+
const a = s.cos0 * s.cos0 + s.sin0 * s.sin0 / q;
|
|
25311
|
+
const b = y * s.sin0 * s.cos0 * s.es / q;
|
|
25312
|
+
const c = x * x + y * y * (s.sin0 * s.sin0 + s.cos0 * s.cos0 / q) - 1;
|
|
25313
|
+
const discriminant = b * b - a * c;
|
|
25314
|
+
if (discriminant < -32 * Number.EPSILON * a) {
|
|
25315
|
+
throw new Error("Coordinate is outside the orthographic ellipse");
|
|
25316
|
+
}
|
|
25317
|
+
const t = (-b + Math.sqrt(Math.max(0, discriminant))) / a;
|
|
25318
|
+
const radial = t * s.cos0 - y * s.sin0;
|
|
25319
|
+
const z = t * s.sin0 + y * s.cos0;
|
|
25320
|
+
p.x = adjust_lon_default(s.long0 + Math.atan2(x, radial), s.over);
|
|
25321
|
+
p.y = Math.atan2(z, q * Math.hypot(radial, x));
|
|
23761
25322
|
return p;
|
|
23762
25323
|
}
|
|
23763
|
-
function createState26(base, options = {}) {
|
|
23764
|
-
const state = { ...base, sin_p14: 0, cos_p14: 0, ...options };
|
|
23765
|
-
initialize26(state);
|
|
23766
|
-
return state;
|
|
23767
|
-
}
|
|
23768
25324
|
var init_ortho = __esm({
|
|
23769
25325
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/ortho.js"() {
|
|
23770
25326
|
init_adjust_lon();
|
|
23771
|
-
init_asinz();
|
|
23772
|
-
init_constants3();
|
|
23773
25327
|
}
|
|
23774
25328
|
});
|
|
23775
25329
|
|
|
@@ -23784,71 +25338,21 @@ return true;`);
|
|
|
23784
25338
|
orthographic = {
|
|
23785
25339
|
name: "ortho",
|
|
23786
25340
|
aliases: [],
|
|
23787
|
-
parameters: ["lon_0", "x_0", "y_0", "lat_0"],
|
|
25341
|
+
parameters: ["lon_0", "x_0", "y_0", "lat_0", "k", "k_0"],
|
|
23788
25342
|
create(context) {
|
|
23789
25343
|
const base = catalogueParameters(context);
|
|
23790
25344
|
const state = createState26(base);
|
|
23791
|
-
return withAngularRenderingProfile(bindCatalogueKernel("ortho", context, state, forward26, inverse26, horizonGuard(base, 0, true)), base, Math.PI / 2, (region, domain) =>
|
|
25345
|
+
return withAngularRenderingProfile(bindCatalogueKernel("ortho", context, state, forward26, inverse26, horizonGuard(base, 0, true)), base, Math.PI / 2, (region, domain) => orthographicBounds(catalogueBoundsParameters(base, context), region, domain), Math.PI / 2);
|
|
23792
25346
|
}
|
|
23793
25347
|
};
|
|
23794
25348
|
}
|
|
23795
25349
|
});
|
|
23796
25350
|
|
|
23797
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e0fn.js
|
|
23798
|
-
function e0fn_default(x) {
|
|
23799
|
-
return 1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x));
|
|
23800
|
-
}
|
|
23801
|
-
var init_e0fn = __esm({
|
|
23802
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e0fn.js"() {
|
|
23803
|
-
}
|
|
23804
|
-
});
|
|
23805
|
-
|
|
23806
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e1fn.js
|
|
23807
|
-
function e1fn_default(x) {
|
|
23808
|
-
return 0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x));
|
|
23809
|
-
}
|
|
23810
|
-
var init_e1fn = __esm({
|
|
23811
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e1fn.js"() {
|
|
23812
|
-
}
|
|
23813
|
-
});
|
|
23814
|
-
|
|
23815
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e2fn.js
|
|
23816
|
-
function e2fn_default(x) {
|
|
23817
|
-
return 0.05859375 * x * x * (1 + 0.75 * x);
|
|
23818
|
-
}
|
|
23819
|
-
var init_e2fn = __esm({
|
|
23820
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e2fn.js"() {
|
|
23821
|
-
}
|
|
23822
|
-
});
|
|
23823
|
-
|
|
23824
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e3fn.js
|
|
23825
|
-
function e3fn_default(x) {
|
|
23826
|
-
return x * x * x * (35 / 3072);
|
|
23827
|
-
}
|
|
23828
|
-
var init_e3fn = __esm({
|
|
23829
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/e3fn.js"() {
|
|
23830
|
-
}
|
|
23831
|
-
});
|
|
23832
|
-
|
|
23833
|
-
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/mlfn.js
|
|
23834
|
-
function mlfn_default(e0, e1, e2, e3, phi) {
|
|
23835
|
-
return e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi);
|
|
23836
|
-
}
|
|
23837
|
-
var init_mlfn = __esm({
|
|
23838
|
-
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/common/mlfn.js"() {
|
|
23839
|
-
}
|
|
23840
|
-
});
|
|
23841
|
-
|
|
23842
25351
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/poly.js
|
|
23843
|
-
function
|
|
23844
|
-
state.
|
|
23845
|
-
state.
|
|
23846
|
-
state.
|
|
23847
|
-
state.e0 = e0fn_default(state.es);
|
|
23848
|
-
state.e1 = e1fn_default(state.es);
|
|
23849
|
-
state.e2 = e2fn_default(state.es);
|
|
23850
|
-
state.e3 = e3fn_default(state.es);
|
|
23851
|
-
state.ml0 = state.a * mlfn_default(state.e0, state.e1, state.e2, state.e3, state.lat0);
|
|
25352
|
+
function initialize26(state) {
|
|
25353
|
+
state.meridianPole = meridianDistance(state.a, state.es, 0, Math.PI / 2);
|
|
25354
|
+
state.poleRadius = state.a / Math.sqrt(1 - state.es);
|
|
25355
|
+
state.ml0 = meridianDistance(state.a, state.es, 0, state.lat0);
|
|
23852
25356
|
}
|
|
23853
25357
|
function forward27(state, p) {
|
|
23854
25358
|
var lon = p.x;
|
|
@@ -23857,21 +25361,21 @@ return true;`);
|
|
|
23857
25361
|
var dlon = adjust_lon_default(lon - state.long0, state.over);
|
|
23858
25362
|
el = dlon * Math.sin(lat);
|
|
23859
25363
|
if (state.sphere) {
|
|
23860
|
-
if (
|
|
25364
|
+
if (lat === 0) {
|
|
23861
25365
|
x = state.a * dlon;
|
|
23862
25366
|
y = -1 * state.a * state.lat0;
|
|
23863
25367
|
} else {
|
|
23864
25368
|
x = state.a * Math.sin(el) / Math.tan(lat);
|
|
23865
|
-
y = state.a * (
|
|
25369
|
+
y = state.a * (lat - state.lat0 + 2 * Math.sin(el / 2) ** 2 / Math.tan(lat));
|
|
23866
25370
|
}
|
|
23867
25371
|
} else {
|
|
23868
|
-
if (
|
|
25372
|
+
if (lat === 0) {
|
|
23869
25373
|
x = state.a * dlon;
|
|
23870
25374
|
y = -1 * state.ml0;
|
|
23871
25375
|
} else {
|
|
23872
25376
|
var nl = gN_default(state.a, state.e, Math.sin(lat)) / Math.tan(lat);
|
|
23873
25377
|
x = nl * Math.sin(el);
|
|
23874
|
-
y = state.a
|
|
25378
|
+
y = meridianDistance(state.a, state.es, state.lat0, lat) + nl * (2 * Math.sin(el / 2) ** 2);
|
|
23875
25379
|
}
|
|
23876
25380
|
}
|
|
23877
25381
|
p.x = x + state.x0;
|
|
@@ -23884,6 +25388,16 @@ return true;`);
|
|
|
23884
25388
|
var phi, dphi;
|
|
23885
25389
|
x = p.x - state.x0;
|
|
23886
25390
|
y = p.y - state.y0;
|
|
25391
|
+
const meridian = y + (state.sphere ? state.a * state.lat0 : state.ml0);
|
|
25392
|
+
const sign2 = meridian < 0 ? -1 : 1;
|
|
25393
|
+
const pole = state.sphere ? state.a * Math.PI / 2 : state.meridianPole;
|
|
25394
|
+
const poleOffset = pole - sign2 * meridian;
|
|
25395
|
+
const radius2 = Math.hypot(x, poleOffset);
|
|
25396
|
+
if (radius2 / state.a < 1e-6) {
|
|
25397
|
+
p.x = adjust_lon_default(state.long0 + Math.atan2(x, poleOffset), state.over);
|
|
25398
|
+
p.y = sign2 * (Math.PI / 2 - radius2 / state.poleRadius);
|
|
25399
|
+
return p;
|
|
25400
|
+
}
|
|
23887
25401
|
if (state.sphere) {
|
|
23888
25402
|
if (Math.abs(y + state.a * state.lat0) <= EPSLN) {
|
|
23889
25403
|
lon = adjust_lon_default(x / state.a + state.long0, state.over);
|
|
@@ -23897,11 +25411,15 @@ return true;`);
|
|
|
23897
25411
|
tanphi = Math.tan(phi);
|
|
23898
25412
|
dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
|
|
23899
25413
|
phi += dphi;
|
|
23900
|
-
if (Math.abs(dphi) <=
|
|
25414
|
+
if (Math.abs(dphi) <= 1e-14) {
|
|
23901
25415
|
lat = phi;
|
|
23902
25416
|
break;
|
|
23903
25417
|
}
|
|
23904
25418
|
}
|
|
25419
|
+
lat = refineInverseLatitude(state, lat === void 0 ? phi : lat, x, y);
|
|
25420
|
+
if (lat === void 0)
|
|
25421
|
+
return null;
|
|
25422
|
+
phi = lat;
|
|
23905
25423
|
lon = adjust_lon_default(state.long0 + Math.asin(x * Math.tan(phi) / state.a) / Math.sin(lat), state.over);
|
|
23906
25424
|
}
|
|
23907
25425
|
} else {
|
|
@@ -23917,16 +25435,20 @@ return true;`);
|
|
|
23917
25435
|
for (i = MAX_ITER4; i; --i) {
|
|
23918
25436
|
con = state.e * Math.sin(phi);
|
|
23919
25437
|
cl = Math.sqrt(1 - con * con) * Math.tan(phi);
|
|
23920
|
-
mln = state.a
|
|
23921
|
-
mlnp =
|
|
25438
|
+
mln = meridianDistance(state.a, state.es, 0, phi);
|
|
25439
|
+
mlnp = (1 - state.es) / Math.pow(1 - con * con, 1.5);
|
|
23922
25440
|
ma = mln / state.a;
|
|
23923
25441
|
dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (state.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
|
|
23924
25442
|
phi -= dphi;
|
|
23925
|
-
if (Math.abs(dphi) <=
|
|
25443
|
+
if (Math.abs(dphi) <= 1e-14) {
|
|
23926
25444
|
lat = phi;
|
|
23927
25445
|
break;
|
|
23928
25446
|
}
|
|
23929
25447
|
}
|
|
25448
|
+
lat = refineInverseLatitude(state, lat === void 0 ? phi : lat, x, y);
|
|
25449
|
+
if (lat === void 0)
|
|
25450
|
+
return null;
|
|
25451
|
+
phi = lat;
|
|
23930
25452
|
cl = Math.sqrt(1 - state.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
|
|
23931
25453
|
lon = adjust_lon_default(state.long0 + Math.asin(x * cl / state.a) / Math.sin(lat), state.over);
|
|
23932
25454
|
}
|
|
@@ -23936,22 +25458,50 @@ return true;`);
|
|
|
23936
25458
|
return p;
|
|
23937
25459
|
}
|
|
23938
25460
|
function createState27(base, options = {}) {
|
|
23939
|
-
const state = {
|
|
23940
|
-
|
|
25461
|
+
const state = {
|
|
25462
|
+
...base,
|
|
25463
|
+
ml0: 0,
|
|
25464
|
+
meridianPole: 0,
|
|
25465
|
+
poleRadius: 0,
|
|
25466
|
+
...options
|
|
25467
|
+
};
|
|
25468
|
+
initialize26(state);
|
|
23941
25469
|
return state;
|
|
23942
25470
|
}
|
|
25471
|
+
function refineInverseLatitude(state, latitude, x, y) {
|
|
25472
|
+
for (let i = 0; i < 8; i++) {
|
|
25473
|
+
if (!Number.isFinite(latitude) || Math.abs(latitude) >= Math.PI / 2)
|
|
25474
|
+
return void 0;
|
|
25475
|
+
const sin = Math.sin(latitude), cos = Math.cos(latitude);
|
|
25476
|
+
const denominator = 1 - state.es * sin * sin;
|
|
25477
|
+
const normal = state.sphere ? state.a : gN_default(state.a, state.e, sin);
|
|
25478
|
+
const radius2 = normal / Math.tan(latitude);
|
|
25479
|
+
const arc = Math.asin(x / radius2);
|
|
25480
|
+
const easting = radius2 * Math.sin(arc);
|
|
25481
|
+
const oneMinusCos = 2 * Math.sin(arc / 2) ** 2;
|
|
25482
|
+
const meridian = state.sphere ? state.a * (latitude - state.lat0) : meridianDistance(state.a, state.es, state.lat0, latitude);
|
|
25483
|
+
const correction = radius2 * oneMinusCos;
|
|
25484
|
+
const northing = meridian + correction;
|
|
25485
|
+
const error = northing - y;
|
|
25486
|
+
if (Math.abs(easting - x) <= 64 * Number.EPSILON * Math.max(state.a, Math.abs(x)) && Math.abs(error) <= 64 * Number.EPSILON * Math.max(Math.abs(y), Math.abs(meridian), Math.abs(correction), state.a * Math.max(Math.abs(latitude), Math.abs(state.lat0))))
|
|
25487
|
+
return latitude;
|
|
25488
|
+
const meridianDerivative = state.sphere ? state.a : state.a * (1 - state.es) / Math.pow(denominator, 1.5);
|
|
25489
|
+
const radiusDerivative = normal * ((state.sphere ? 0 : state.es * cos * cos / denominator) - 1 / (sin * sin));
|
|
25490
|
+
const derivative = meridianDerivative + radiusDerivative * (-oneMinusCos / Math.cos(arc));
|
|
25491
|
+
const step = error / derivative;
|
|
25492
|
+
if (!Number.isFinite(step) || Math.abs(step) > 1e-6)
|
|
25493
|
+
return void 0;
|
|
25494
|
+
latitude -= step;
|
|
25495
|
+
}
|
|
25496
|
+
return void 0;
|
|
25497
|
+
}
|
|
23943
25498
|
var MAX_ITER4;
|
|
23944
25499
|
var init_poly = __esm({
|
|
23945
25500
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/poly.js"() {
|
|
23946
|
-
init_e0fn();
|
|
23947
|
-
init_e1fn();
|
|
23948
|
-
init_e2fn();
|
|
23949
|
-
init_e3fn();
|
|
23950
25501
|
init_adjust_lon();
|
|
23951
|
-
init_adjust_lat();
|
|
23952
|
-
init_mlfn();
|
|
23953
25502
|
init_constants3();
|
|
23954
25503
|
init_gN();
|
|
25504
|
+
init_meridian_distance();
|
|
23955
25505
|
MAX_ITER4 = 20;
|
|
23956
25506
|
}
|
|
23957
25507
|
});
|
|
@@ -23980,7 +25530,7 @@ return true;`);
|
|
|
23980
25530
|
});
|
|
23981
25531
|
|
|
23982
25532
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/qsc.js
|
|
23983
|
-
function
|
|
25533
|
+
function initialize27(state) {
|
|
23984
25534
|
state.x0 = state.x0 || 0;
|
|
23985
25535
|
state.y0 = state.y0 || 0;
|
|
23986
25536
|
state.lat0 = state.lat0 || 0;
|
|
@@ -24022,7 +25572,7 @@ return true;`);
|
|
|
24022
25572
|
theta = lon - HALF_PI;
|
|
24023
25573
|
} else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
|
|
24024
25574
|
area2 = AREA_ENUM.AREA_1;
|
|
24025
|
-
theta = lon > 0 ? lon -
|
|
25575
|
+
theta = lon > 0 ? lon - Math.PI : lon + Math.PI;
|
|
24026
25576
|
} else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
|
|
24027
25577
|
area2 = AREA_ENUM.AREA_2;
|
|
24028
25578
|
theta = lon + HALF_PI;
|
|
@@ -24043,7 +25593,7 @@ return true;`);
|
|
|
24043
25593
|
theta = -lon - HALF_PI;
|
|
24044
25594
|
} else {
|
|
24045
25595
|
area2 = AREA_ENUM.AREA_3;
|
|
24046
|
-
theta = lon > 0 ? -lon +
|
|
25596
|
+
theta = lon > 0 ? -lon + Math.PI : -lon - Math.PI;
|
|
24047
25597
|
}
|
|
24048
25598
|
} else {
|
|
24049
25599
|
var q, r, s;
|
|
@@ -24052,7 +25602,7 @@ return true;`);
|
|
|
24052
25602
|
if (state.face === FACE_ENUM.RIGHT) {
|
|
24053
25603
|
lon = qsc_shift_lon_origin(lon, +HALF_PI);
|
|
24054
25604
|
} else if (state.face === FACE_ENUM.BACK) {
|
|
24055
|
-
lon = qsc_shift_lon_origin(lon, +
|
|
25605
|
+
lon = qsc_shift_lon_origin(lon, +Math.PI);
|
|
24056
25606
|
} else if (state.face === FACE_ENUM.LEFT) {
|
|
24057
25607
|
lon = qsc_shift_lon_origin(lon, -HALF_PI);
|
|
24058
25608
|
}
|
|
@@ -24064,16 +25614,16 @@ return true;`);
|
|
|
24064
25614
|
r = coslat * sinlon;
|
|
24065
25615
|
s = sinlat;
|
|
24066
25616
|
if (state.face === FACE_ENUM.FRONT) {
|
|
24067
|
-
phi = Math.
|
|
25617
|
+
phi = Math.atan2(Math.hypot(r, s), q);
|
|
24068
25618
|
theta = qsc_fwd_equat_face_theta(phi, s, r);
|
|
24069
25619
|
} else if (state.face === FACE_ENUM.RIGHT) {
|
|
24070
|
-
phi = Math.
|
|
25620
|
+
phi = Math.atan2(Math.hypot(q, s), r);
|
|
24071
25621
|
theta = qsc_fwd_equat_face_theta(phi, s, -q);
|
|
24072
25622
|
} else if (state.face === FACE_ENUM.BACK) {
|
|
24073
|
-
phi = Math.
|
|
25623
|
+
phi = Math.atan2(Math.hypot(r, s), -q);
|
|
24074
25624
|
theta = qsc_fwd_equat_face_theta(phi, s, -r);
|
|
24075
25625
|
} else if (state.face === FACE_ENUM.LEFT) {
|
|
24076
|
-
phi = Math.
|
|
25626
|
+
phi = Math.atan2(Math.hypot(q, s), -r);
|
|
24077
25627
|
theta = qsc_fwd_equat_face_theta(phi, s, q);
|
|
24078
25628
|
} else {
|
|
24079
25629
|
phi = theta = 0;
|
|
@@ -24085,20 +25635,20 @@ return true;`);
|
|
|
24085
25635
|
theta -= HALF_PI;
|
|
24086
25636
|
} else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
|
|
24087
25637
|
area2 = AREA_ENUM.AREA_2;
|
|
24088
|
-
theta = theta >= 0 ? theta -
|
|
25638
|
+
theta = theta >= 0 ? theta - Math.PI : theta + Math.PI;
|
|
24089
25639
|
} else {
|
|
24090
25640
|
area2 = AREA_ENUM.AREA_3;
|
|
24091
25641
|
theta += HALF_PI;
|
|
24092
25642
|
}
|
|
24093
25643
|
}
|
|
24094
|
-
mu = Math.atan(12 /
|
|
24095
|
-
t = Math.sqrt(
|
|
25644
|
+
mu = Math.atan(12 / Math.PI * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
|
|
25645
|
+
t = Math.sqrt(2 * Math.sin(phi / 2) ** 2 / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
|
|
24096
25646
|
if (area2 === AREA_ENUM.AREA_1) {
|
|
24097
25647
|
mu += HALF_PI;
|
|
24098
25648
|
} else if (area2 === AREA_ENUM.AREA_2) {
|
|
24099
|
-
mu +=
|
|
25649
|
+
mu += Math.PI;
|
|
24100
25650
|
} else if (area2 === AREA_ENUM.AREA_3) {
|
|
24101
|
-
mu += 1.5 *
|
|
25651
|
+
mu += 1.5 * Math.PI;
|
|
24102
25652
|
}
|
|
24103
25653
|
xy.x = t * Math.cos(mu);
|
|
24104
25654
|
xy.y = t * Math.sin(mu);
|
|
@@ -24108,13 +25658,12 @@ return true;`);
|
|
|
24108
25658
|
}
|
|
24109
25659
|
function inverse28(state, p) {
|
|
24110
25660
|
var lam = 0, latitude = 0;
|
|
24111
|
-
var mu,
|
|
25661
|
+
var mu, cosmu, tannu;
|
|
24112
25662
|
var tantheta, theta, cosphi, phi;
|
|
24113
25663
|
var t;
|
|
24114
25664
|
var area2 = 0;
|
|
24115
25665
|
p.x = (p.x - state.x0) / state.a;
|
|
24116
25666
|
p.y = (p.y - state.y0) / state.a;
|
|
24117
|
-
nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
|
|
24118
25667
|
mu = Math.atan2(p.y, p.x);
|
|
24119
25668
|
if (p.x >= 0 && p.x >= Math.abs(p.y)) {
|
|
24120
25669
|
area2 = AREA_ENUM.AREA_0;
|
|
@@ -24123,36 +25672,37 @@ return true;`);
|
|
|
24123
25672
|
mu -= HALF_PI;
|
|
24124
25673
|
} else if (p.x < 0 && -p.x >= Math.abs(p.y)) {
|
|
24125
25674
|
area2 = AREA_ENUM.AREA_2;
|
|
24126
|
-
mu = mu < 0 ? mu +
|
|
25675
|
+
mu = mu < 0 ? mu + Math.PI : mu - Math.PI;
|
|
24127
25676
|
} else {
|
|
24128
25677
|
area2 = AREA_ENUM.AREA_3;
|
|
24129
25678
|
mu += HALF_PI;
|
|
24130
25679
|
}
|
|
24131
|
-
t =
|
|
25680
|
+
t = Math.PI / 12 * Math.tan(mu);
|
|
24132
25681
|
tantheta = Math.sin(t) / (Math.cos(t) - 1 / Math.sqrt(2));
|
|
24133
25682
|
theta = Math.atan(tantheta);
|
|
24134
25683
|
cosmu = Math.cos(mu);
|
|
24135
|
-
tannu = Math.
|
|
24136
|
-
|
|
25684
|
+
tannu = Math.hypot(p.x, p.y);
|
|
25685
|
+
const oneMinusCosPhi = cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
|
|
25686
|
+
cosphi = 1 - oneMinusCosPhi;
|
|
24137
25687
|
if (cosphi < -1) {
|
|
24138
25688
|
cosphi = -1;
|
|
24139
25689
|
} else if (cosphi > 1) {
|
|
24140
25690
|
cosphi = 1;
|
|
24141
25691
|
}
|
|
24142
25692
|
if (state.face === FACE_ENUM.TOP) {
|
|
24143
|
-
phi = Math.
|
|
25693
|
+
phi = 2 * Math.asin(Math.sqrt(Math.min(1, oneMinusCosPhi / 2)));
|
|
24144
25694
|
latitude = HALF_PI - phi;
|
|
24145
25695
|
if (area2 === AREA_ENUM.AREA_0) {
|
|
24146
25696
|
lam = theta + HALF_PI;
|
|
24147
25697
|
} else if (area2 === AREA_ENUM.AREA_1) {
|
|
24148
|
-
lam = theta < 0 ? theta +
|
|
25698
|
+
lam = theta < 0 ? theta + Math.PI : theta - Math.PI;
|
|
24149
25699
|
} else if (area2 === AREA_ENUM.AREA_2) {
|
|
24150
25700
|
lam = theta - HALF_PI;
|
|
24151
25701
|
} else {
|
|
24152
25702
|
lam = theta;
|
|
24153
25703
|
}
|
|
24154
25704
|
} else if (state.face === FACE_ENUM.BOTTOM) {
|
|
24155
|
-
phi = Math.
|
|
25705
|
+
phi = 2 * Math.asin(Math.sqrt(Math.min(1, oneMinusCosPhi / 2)));
|
|
24156
25706
|
latitude = phi - HALF_PI;
|
|
24157
25707
|
if (area2 === AREA_ENUM.AREA_0) {
|
|
24158
25708
|
lam = -theta + HALF_PI;
|
|
@@ -24161,23 +25711,14 @@ return true;`);
|
|
|
24161
25711
|
} else if (area2 === AREA_ENUM.AREA_2) {
|
|
24162
25712
|
lam = -theta - HALF_PI;
|
|
24163
25713
|
} else {
|
|
24164
|
-
lam = theta < 0 ? -theta -
|
|
25714
|
+
lam = theta < 0 ? -theta - Math.PI : -theta + Math.PI;
|
|
24165
25715
|
}
|
|
24166
25716
|
} else {
|
|
24167
25717
|
var q, r, s;
|
|
24168
25718
|
q = cosphi;
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24172
|
-
} else {
|
|
24173
|
-
s = Math.sqrt(1 - t) * Math.sin(theta);
|
|
24174
|
-
}
|
|
24175
|
-
t += s * s;
|
|
24176
|
-
if (t >= 1) {
|
|
24177
|
-
r = 0;
|
|
24178
|
-
} else {
|
|
24179
|
-
r = Math.sqrt(1 - t);
|
|
24180
|
-
}
|
|
25719
|
+
const sinphi = Math.sqrt(Math.max(0, oneMinusCosPhi * (2 - oneMinusCosPhi)));
|
|
25720
|
+
s = sinphi * Math.sin(theta);
|
|
25721
|
+
r = sinphi * Math.cos(theta);
|
|
24181
25722
|
if (area2 === AREA_ENUM.AREA_1) {
|
|
24182
25723
|
t = r;
|
|
24183
25724
|
r = -s;
|
|
@@ -24202,26 +25743,18 @@ return true;`);
|
|
|
24202
25743
|
q = r;
|
|
24203
25744
|
r = -t;
|
|
24204
25745
|
}
|
|
24205
|
-
latitude = Math.
|
|
25746
|
+
latitude = Math.atan2(s, Math.hypot(q, r));
|
|
24206
25747
|
lam = Math.atan2(r, q);
|
|
24207
25748
|
if (state.face === FACE_ENUM.RIGHT) {
|
|
24208
25749
|
lam = qsc_shift_lon_origin(lam, -HALF_PI);
|
|
24209
25750
|
} else if (state.face === FACE_ENUM.BACK) {
|
|
24210
|
-
lam = qsc_shift_lon_origin(lam, -
|
|
25751
|
+
lam = qsc_shift_lon_origin(lam, -Math.PI);
|
|
24211
25752
|
} else if (state.face === FACE_ENUM.LEFT) {
|
|
24212
25753
|
lam = qsc_shift_lon_origin(lam, +HALF_PI);
|
|
24213
25754
|
}
|
|
24214
25755
|
}
|
|
24215
25756
|
if (state.es !== 0) {
|
|
24216
|
-
|
|
24217
|
-
var tanphi, xa;
|
|
24218
|
-
invert_sign = latitude < 0 ? 1 : 0;
|
|
24219
|
-
tanphi = Math.tan(latitude);
|
|
24220
|
-
xa = state.b / Math.sqrt(tanphi * tanphi + state.one_minus_f_squared);
|
|
24221
|
-
latitude = Math.atan(Math.sqrt(state.a * state.a - xa * xa) / (state.one_minus_f * xa));
|
|
24222
|
-
if (invert_sign) {
|
|
24223
|
-
latitude = -latitude;
|
|
24224
|
-
}
|
|
25757
|
+
latitude = Math.atan2(Math.sin(latitude), state.one_minus_f_squared * Math.cos(latitude));
|
|
24225
25758
|
}
|
|
24226
25759
|
lam += state.long0;
|
|
24227
25760
|
p.x = lam;
|
|
@@ -24229,20 +25762,20 @@ return true;`);
|
|
|
24229
25762
|
return p;
|
|
24230
25763
|
}
|
|
24231
25764
|
function qsc_fwd_equat_face_theta(phi, y, x) {
|
|
24232
|
-
return phi
|
|
25765
|
+
return phi === 0 ? 0 : Math.atan2(y, x);
|
|
24233
25766
|
}
|
|
24234
25767
|
function qsc_shift_lon_origin(lon, offset) {
|
|
24235
25768
|
var slon = lon + offset;
|
|
24236
|
-
if (slon < -
|
|
25769
|
+
if (slon < -Math.PI) {
|
|
24237
25770
|
slon += TWO_PI;
|
|
24238
|
-
} else if (slon > +
|
|
25771
|
+
} else if (slon > +Math.PI) {
|
|
24239
25772
|
slon -= TWO_PI;
|
|
24240
25773
|
}
|
|
24241
25774
|
return slon;
|
|
24242
25775
|
}
|
|
24243
25776
|
function createState28(base, options = {}) {
|
|
24244
25777
|
const state = { ...base, face: 0, one_minus_f: 0, one_minus_f_squared: 0, ...options };
|
|
24245
|
-
|
|
25778
|
+
initialize27(state);
|
|
24246
25779
|
return state;
|
|
24247
25780
|
}
|
|
24248
25781
|
var FACE_ENUM, AREA_ENUM;
|
|
@@ -24340,7 +25873,7 @@ return true;`);
|
|
|
24340
25873
|
}
|
|
24341
25874
|
return x;
|
|
24342
25875
|
}
|
|
24343
|
-
function
|
|
25876
|
+
function initialize28(state) {
|
|
24344
25877
|
state.x0 = state.x0 || 0;
|
|
24345
25878
|
state.y0 = state.y0 || 0;
|
|
24346
25879
|
state.long0 = state.long0 || 0;
|
|
@@ -24413,7 +25946,7 @@ return true;`);
|
|
|
24413
25946
|
...base,
|
|
24414
25947
|
...options
|
|
24415
25948
|
};
|
|
24416
|
-
|
|
25949
|
+
initialize28(state);
|
|
24417
25950
|
return state;
|
|
24418
25951
|
}
|
|
24419
25952
|
var COEFS_X, COEFS_Y, FXC, FYC, C1, RC1, NODES, poly3_val, poly3_der;
|
|
@@ -24526,7 +26059,7 @@ return true;`);
|
|
|
24526
26059
|
});
|
|
24527
26060
|
|
|
24528
26061
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/somerc.js
|
|
24529
|
-
function
|
|
26062
|
+
function initialize29(state) {
|
|
24530
26063
|
if (!state.k0) {
|
|
24531
26064
|
state.k0 = 1;
|
|
24532
26065
|
}
|
|
@@ -24548,44 +26081,37 @@ return true;`);
|
|
|
24548
26081
|
state.K = k1 - state.alpha * k2 + state.alpha * e / 2 * k3;
|
|
24549
26082
|
}
|
|
24550
26083
|
function forward30(state, p) {
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24555
|
-
|
|
24556
|
-
|
|
24557
|
-
|
|
24558
|
-
p.y = state.
|
|
24559
|
-
p.x = state.R * rotI + state.x0;
|
|
26084
|
+
const sp = state.e * Math.sin(p.y);
|
|
26085
|
+
const latitude = 2 * Math.atan(Math.exp(state.alpha * (Math.log(Math.tan(Math.PI / 4 + p.y / 2)) - state.e / 2 * Math.log((1 + sp) / (1 - sp))) + state.K)) - Math.PI / 2;
|
|
26086
|
+
const longitude = state.alpha * (p.x - state.lambda0);
|
|
26087
|
+
const cos = Math.cos(latitude);
|
|
26088
|
+
const rotatedLatitude = Math.asin(Math.cos(state.b0) * Math.sin(latitude) - Math.sin(state.b0) * cos * Math.cos(longitude));
|
|
26089
|
+
const rotatedLongitude = Math.asin(cos * Math.sin(longitude) / Math.cos(rotatedLatitude));
|
|
26090
|
+
p.x = state.x0 + state.R * rotatedLongitude;
|
|
26091
|
+
p.y = state.y0 + state.R * Math.log(Math.tan(Math.PI / 4 + rotatedLatitude / 2));
|
|
24560
26092
|
return p;
|
|
24561
26093
|
}
|
|
24562
26094
|
function inverse30(state, p) {
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24566
|
-
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
return void 0;
|
|
26095
|
+
const longitude = (p.x - state.x0) / state.R;
|
|
26096
|
+
const latitude = 2 * (Math.atan(Math.exp((p.y - state.y0) / state.R)) - Math.PI / 4);
|
|
26097
|
+
let phi = Math.asin(Math.cos(state.b0) * Math.sin(latitude) + Math.sin(state.b0) * Math.cos(latitude) * Math.cos(longitude));
|
|
26098
|
+
const lambda = Math.asin(Math.cos(latitude) * Math.sin(longitude) / Math.cos(phi));
|
|
26099
|
+
const con = (state.K - Math.log(Math.tan(Math.PI / 4 + phi / 2))) / state.alpha;
|
|
26100
|
+
for (let iteration = 0; iteration < 6; iteration++) {
|
|
26101
|
+
const esp = state.e * Math.sin(phi);
|
|
26102
|
+
const step = (con + Math.log(Math.tan(Math.PI / 4 + phi / 2)) - state.e / 2 * Math.log((1 + esp) / (1 - esp))) * (1 - esp * esp) * Math.cos(phi) / (1 - state.es);
|
|
26103
|
+
phi -= step;
|
|
26104
|
+
if (Math.abs(step) < 1e-10) {
|
|
26105
|
+
p.x = state.lambda0 + lambda / state.alpha;
|
|
26106
|
+
p.y = phi;
|
|
26107
|
+
return p;
|
|
24577
26108
|
}
|
|
24578
|
-
S = 1 / state.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - state.K) + state.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(state.e * Math.sin(phy)) / 2));
|
|
24579
|
-
prevPhy = phy;
|
|
24580
|
-
phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
|
|
24581
26109
|
}
|
|
24582
|
-
|
|
24583
|
-
p.y = phy;
|
|
24584
|
-
return p;
|
|
26110
|
+
return null;
|
|
24585
26111
|
}
|
|
24586
26112
|
function createState30(base, options = {}) {
|
|
24587
26113
|
const state = { ...base, lambda0: 0, rf: 0, R: 0, alpha: 0, b0: 0, K: 0, ...options };
|
|
24588
|
-
|
|
26114
|
+
initialize29(state);
|
|
24589
26115
|
return state;
|
|
24590
26116
|
}
|
|
24591
26117
|
var init_somerc = __esm({
|
|
@@ -24617,7 +26143,7 @@ return true;`);
|
|
|
24617
26143
|
});
|
|
24618
26144
|
|
|
24619
26145
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/tpers.js
|
|
24620
|
-
function
|
|
26146
|
+
function initialize30(state) {
|
|
24621
26147
|
if (Math.abs(Math.abs(state.lat0) - HALF_PI) < EPSLN) {
|
|
24622
26148
|
state.mode = state.lat0 < 0 ? mode.S_POLE : mode.N_POLE;
|
|
24623
26149
|
} else if (Math.abs(state.lat0) < EPSLN) {
|
|
@@ -24752,7 +26278,7 @@ return true;`);
|
|
|
24752
26278
|
sw: 0,
|
|
24753
26279
|
...options
|
|
24754
26280
|
};
|
|
24755
|
-
|
|
26281
|
+
initialize30(state);
|
|
24756
26282
|
return state;
|
|
24757
26283
|
}
|
|
24758
26284
|
var mode;
|
|
@@ -24802,7 +26328,7 @@ return true;`);
|
|
|
24802
26328
|
});
|
|
24803
26329
|
|
|
24804
26330
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/kernels/vandg.js
|
|
24805
|
-
function
|
|
26331
|
+
function initialize31(state) {
|
|
24806
26332
|
state.R = state.a;
|
|
24807
26333
|
}
|
|
24808
26334
|
function forward32(state, p) {
|
|
@@ -24904,7 +26430,7 @@ return true;`);
|
|
|
24904
26430
|
}
|
|
24905
26431
|
function createState32(base, options = {}) {
|
|
24906
26432
|
const state = { ...base, R: 0, ...options };
|
|
24907
|
-
|
|
26433
|
+
initialize31(state);
|
|
24908
26434
|
return state;
|
|
24909
26435
|
}
|
|
24910
26436
|
var init_vandg = __esm({
|
|
@@ -25059,12 +26585,12 @@ return true;`);
|
|
|
25059
26585
|
return {
|
|
25060
26586
|
get bounds() {
|
|
25061
26587
|
const bounds = child2.bounds;
|
|
25062
|
-
const
|
|
26588
|
+
const degrees2 = (corner) => [
|
|
25063
26589
|
corner[0] * 180 / Math.PI,
|
|
25064
26590
|
corner[1] * 180 / Math.PI,
|
|
25065
26591
|
corner[2]
|
|
25066
26592
|
];
|
|
25067
|
-
return geographic ? [
|
|
26593
|
+
return geographic ? [degrees2(bounds[0]), degrees2(bounds[1])] : bounds;
|
|
25068
26594
|
},
|
|
25069
26595
|
normalize(point) {
|
|
25070
26596
|
source?.normalize(point);
|
|
@@ -25433,8 +26959,8 @@ return true;`);
|
|
|
25433
26959
|
if (!projected || parameters["proj"] !== "stere" || Math.abs(latitude) !== 90 || key(direction) !== (north ? "south" : "north"))
|
|
25434
26960
|
unsupportedStage("Axis meridians require an outward-facing polar stereographic axis");
|
|
25435
26961
|
const longitude = object(meridian)["longitude"];
|
|
25436
|
-
const
|
|
25437
|
-
const quarterTurns = finite2((
|
|
26962
|
+
const degrees2 = typeof longitude === "number" ? finite2(longitude) : finite2(object(longitude)["value"]) * unit(object(longitude)["unit"], DEGREES_TO_RADIANS) / DEGREES_TO_RADIANS;
|
|
26963
|
+
const quarterTurns = finite2((degrees2 - Number(parameters["lon_0"] || 0)) / 90);
|
|
25438
26964
|
if (Math.abs(quarterTurns - Math.round(quarterTurns)) > 1e-12)
|
|
25439
26965
|
unsupportedStage("Non-cardinal axis meridians require an orientation operation");
|
|
25440
26966
|
const quadrant = (Math.round(quarterTurns) % 4 + 4) % 4;
|
|
@@ -27957,7 +29483,7 @@ return true;`);
|
|
|
27957
29483
|
|
|
27958
29484
|
// ../../node_modules/@math.gl/geospatial/dist/wkb/wkb-builder.js
|
|
27959
29485
|
function measureGeometry(geometryWriter, options) {
|
|
27960
|
-
const builder = new WKBBuilder({ mode: "measure"
|
|
29486
|
+
const builder = new WKBBuilder({ ...options, mode: "measure" });
|
|
27961
29487
|
geometryWriter(builder);
|
|
27962
29488
|
return builder.finishGeometry();
|
|
27963
29489
|
}
|
|
@@ -28147,6 +29673,11 @@ return true;`);
|
|
|
28147
29673
|
if (valueOffsets.length !== geometryWriters.length + 1) {
|
|
28148
29674
|
throw new Error("WKB valueOffsets length must equal geometry count plus one");
|
|
28149
29675
|
}
|
|
29676
|
+
for (let i = 0; i < valueOffsets.length; i++) {
|
|
29677
|
+
if (!Number.isInteger(valueOffsets[i]) || valueOffsets[i] < 0 || i > 0 && valueOffsets[i] < valueOffsets[i - 1]) {
|
|
29678
|
+
throw new Error("WKB valueOffsets must be nonnegative and nondecreasing");
|
|
29679
|
+
}
|
|
29680
|
+
}
|
|
28150
29681
|
if (valueOffsets[valueOffsets.length - 1] > values.byteLength) {
|
|
28151
29682
|
throw new Error("WKB values buffer is smaller than its final offset");
|
|
28152
29683
|
}
|
|
@@ -28155,10 +29686,10 @@ return true;`);
|
|
|
28155
29686
|
if (!geometryWriter)
|
|
28156
29687
|
continue;
|
|
28157
29688
|
const builder = new _WKBBuilder({
|
|
29689
|
+
...options,
|
|
28158
29690
|
mode: "write",
|
|
28159
29691
|
target: values,
|
|
28160
29692
|
byteOffset: valueOffsets[geometryIndex],
|
|
28161
|
-
...options,
|
|
28162
29693
|
dimension: options.dimensionResolver?.(geometryIndex) ?? options.dimension
|
|
28163
29694
|
});
|
|
28164
29695
|
geometryWriter(builder);
|
|
@@ -31235,21 +32766,9 @@ return true;`);
|
|
|
31235
32766
|
}
|
|
31236
32767
|
});
|
|
31237
32768
|
|
|
31238
|
-
// src/flatgeobuf.ts
|
|
31239
|
-
var flatgeobuf_exports = {};
|
|
31240
|
-
__export(flatgeobuf_exports, {
|
|
31241
|
-
FlatGeobufLoaderWithParser: () => FlatGeobufLoaderWithParser
|
|
31242
|
-
});
|
|
31243
|
-
var init_flatgeobuf = __esm({
|
|
31244
|
-
"src/flatgeobuf.ts"() {
|
|
31245
|
-
"use strict";
|
|
31246
|
-
init_flatgeobuf_loader();
|
|
31247
|
-
}
|
|
31248
|
-
});
|
|
31249
|
-
|
|
31250
32769
|
// src/flatgeobuf/flatgeobuf-loader-types.ts
|
|
31251
32770
|
async function preload() {
|
|
31252
|
-
const { FlatGeobufLoaderWithParser: FlatGeobufLoaderWithParser2 } = await Promise.resolve().then(() => (
|
|
32771
|
+
const { FlatGeobufLoaderWithParser: FlatGeobufLoaderWithParser2 } = await Promise.resolve().then(() => (init_flatgeobuf_loader(), flatgeobuf_loader_exports));
|
|
31253
32772
|
return FlatGeobufLoaderWithParser2;
|
|
31254
32773
|
}
|
|
31255
32774
|
var VERSION, FGB_MAGIC_NUMBER, FlatGeobufLoader, FlatGeobufWorkerLoader;
|
|
@@ -31257,7 +32776,7 @@ return true;`);
|
|
|
31257
32776
|
"src/flatgeobuf/flatgeobuf-loader-types.ts"() {
|
|
31258
32777
|
"use strict";
|
|
31259
32778
|
init_flatgeobuf_format();
|
|
31260
|
-
VERSION = true ? "5.0.0-alpha.
|
|
32779
|
+
VERSION = true ? "5.0.0-alpha.14" : "latest";
|
|
31261
32780
|
FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
|
|
31262
32781
|
FlatGeobufLoader = {
|
|
31263
32782
|
...FlatGeobufFormat,
|
|
@@ -31321,6 +32840,11 @@ return true;`);
|
|
|
31321
32840
|
});
|
|
31322
32841
|
|
|
31323
32842
|
// src/flatgeobuf/flatgeobuf-loader.ts
|
|
32843
|
+
var flatgeobuf_loader_exports = {};
|
|
32844
|
+
__export(flatgeobuf_loader_exports, {
|
|
32845
|
+
FlatGeobufLoaderWithParser: () => FlatGeobufLoaderWithParser,
|
|
32846
|
+
FlatGeobufWorkerLoaderWithParser: () => FlatGeobufWorkerLoaderWithParser
|
|
32847
|
+
});
|
|
31324
32848
|
function parseSync(arrayBuffer, options = {}) {
|
|
31325
32849
|
return parseFlatGeobuf(arrayBuffer, getOptions(options));
|
|
31326
32850
|
}
|