@nika-js/onlymap 0.2.3 → 0.3.1

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.
Files changed (62) hide show
  1. package/.vscode/onlymap.code-snippets +13 -0
  2. package/LICENSE.md +4 -0
  3. package/README.md +30 -7
  4. package/THIRD-PARTY-LICENSES.md +7874 -0
  5. package/dist/{Arrow.dom-7AXne1TU.js → Arrow.dom-BNjbQ9jb.js} +23 -23
  6. package/dist/LercDecode.es-CVmNpXBp.js +303 -0
  7. package/dist/assets/LercDecode.es-BJb2dZu5.js +305 -0
  8. package/dist/assets/__vite-browser-external-DDArsqdc.js +29 -0
  9. package/dist/assets/lerc-wasm.wasm +0 -0
  10. package/dist/assets/lzw-BY5a_5nb.js +83 -0
  11. package/dist/assets/worker-DtIrTJB7.js +305 -0
  12. package/dist/assets/zstd-QGAv3PMm.js +383 -0
  13. package/dist/{basemap-BdvB-SHy.js → basemap-BSb-g03Z.js} +5729 -5684
  14. package/dist/basemap-registry.d.ts +10 -0
  15. package/dist/basemap.d.ts +23 -0
  16. package/dist/color.d.ts +9 -0
  17. package/dist/{convert-arrow-schema-CvZ3cT5m.js → convert-arrow-schema-DrAihRf9.js} +31 -31
  18. package/dist/ctx.d.ts +3 -0
  19. package/dist/deck.d.ts +28 -0
  20. package/dist/deck.js +16 -0
  21. package/dist/elements/om-map.d.ts +29 -0
  22. package/dist/html-data.d.ts +2 -2
  23. package/dist/index-CIEkseeV.js +3108 -0
  24. package/dist/index-D67FynN5.js +594 -0
  25. package/dist/{index-CJOMgp8k.js → index-QSkZjzIL.js} +4 -4
  26. package/dist/index-WeMwLoaQ.js +1446 -0
  27. package/dist/{index-BxzDKZpu.js → index-lV5eG2Xt.js} +22439 -21347
  28. package/dist/index.d.ts +13 -0
  29. package/dist/ir-snapshot.d.ts +2 -0
  30. package/dist/ir.d.ts +10 -0
  31. package/dist/layer-registry.d.ts +15 -1
  32. package/dist/legend-spec.d.ts +66 -0
  33. package/dist/lerc-DJzRIT6z.js +30 -0
  34. package/dist/lerc-wasm.wasm +0 -0
  35. package/dist/lzw-BY5a_5nb.js +83 -0
  36. package/dist/mgrs-BY9bIvp4.js +799 -0
  37. package/dist/onlymapjs.css +1 -1
  38. package/dist/onlymapjs.js +55 -35
  39. package/dist/programmatic.d.ts +35 -0
  40. package/dist/raster-BKf1dx54.js +8843 -0
  41. package/dist/raster.d.ts +61 -0
  42. package/dist/react/om-layer.d.ts +2 -0
  43. package/dist/react.js +18 -16
  44. package/dist/{recordbatch-HRu0SMKp.js → recordbatch-Bpc0uxFn.js} +200 -200
  45. package/dist/runtime-core.d.ts +73 -1
  46. package/dist/scene-lighting.d.ts +83 -0
  47. package/dist/selection.d.ts +1 -1
  48. package/dist/snapshot.d.ts +14 -0
  49. package/dist/{table-accessors-DBjWgN0C.js → table-accessors-CYWTzpQI.js} +71 -76
  50. package/dist/terrain.d.ts +113 -0
  51. package/dist/version.d.ts +1 -1
  52. package/dist/zstd-jXobGRcq.js +14 -0
  53. package/docs/custom-layers.md +99 -0
  54. package/llms.txt +5 -5
  55. package/onlymapjs.html-data.json +163 -29
  56. package/package.json +35 -15
  57. package/skills/onlymapjs/SKILL.md +3 -1
  58. package/skills/onlymapjs/references/syntax.md +53 -3
  59. package/dist/index-BVQ0s1Zh.js +0 -1457
  60. package/dist/index-CvBHiOGD.js +0 -605
  61. package/dist/index-Vc8QfNEf.js +0 -3907
  62. package/dist/onlymapjs.umd.cjs +0 -8634
@@ -1,3907 +0,0 @@
1
- var Ri = Object.defineProperty;
2
- var Ii = (t, a, i) => a in t ? Ri(t, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[a] = i;
3
- var N = (t, a, i) => Ii(t, typeof a != "symbol" ? a + "" : a, i);
4
- import { t as zt, $ as ca, a0 as ua, a1 as wi } from "./index-BxzDKZpu.js";
5
- import { c as Si } from "./convert-arrow-schema-CvZ3cT5m.js";
6
- import { ai as Ni, af as Nt, h as Ci, au as Pi, a2 as Oi } from "./recordbatch-HRu0SMKp.js";
7
- class Ti {
8
- constructor(a) {
9
- N(this, "schema");
10
- N(this, "arrowSchema");
11
- N(this, "arrowBuilders");
12
- N(this, "length");
13
- this.schema = a, this.arrowSchema = Si(a), this.arrowBuilders = this.arrowSchema.fields.map((i) => Ni({ type: i.type, nullValues: [null] })), this.length = 0;
14
- }
15
- addObjectRow(a) {
16
- for (let i = 0; i < this.arrowBuilders.length; i++) {
17
- const s = this.schema.fields[i].name, e = a[s];
18
- this.arrowBuilders[i].append(e);
19
- }
20
- this.length++;
21
- }
22
- addArrayRow(a) {
23
- for (let i = 0; i < this.arrowBuilders.length; i++)
24
- this.arrowBuilders[i].append(a[i]);
25
- this.length++;
26
- }
27
- /** Makes sure that a first batch with schema is sent even if no rows */
28
- firstBatch() {
29
- const a = this._getArrowRecordBatch();
30
- return a.numCols !== 0 ? null : {
31
- shape: "arrow-table",
32
- batchType: "data",
33
- length: a.numRows,
34
- schema: this.schema,
35
- data: new Nt(a)
36
- };
37
- }
38
- /** Flush the current batch if conditions are right */
39
- flushBatch() {
40
- const a = this._getArrowRecordBatch();
41
- return a.numCols === 0 ? null : {
42
- shape: "arrow-table",
43
- batchType: "data",
44
- length: a.numRows,
45
- schema: this.schema,
46
- data: new Nt(a)
47
- };
48
- }
49
- /** Get a last batch if any data is left */
50
- finishBatch() {
51
- const a = this._getArrowRecordBatch();
52
- return this.arrowBuilders.forEach((i) => i.finish()), a.numCols === 0 ? null : {
53
- shape: "arrow-table",
54
- batchType: "data",
55
- length: a.numRows,
56
- schema: this.schema,
57
- data: new Nt(a)
58
- };
59
- }
60
- /** Return a table with all the accumulated data */
61
- finishTable() {
62
- const a = this._getArrowRecordBatch();
63
- return this.arrowBuilders.forEach((i) => i.finish()), {
64
- shape: "arrow-table",
65
- schema: this.schema,
66
- data: new Nt(a)
67
- };
68
- }
69
- /** Extract a record batch flushing the currently accumulated data in the builders */
70
- _getArrowRecordBatch() {
71
- const { arrowBuilders: a, arrowSchema: i } = this, s = a.map((o) => o.flush()), e = s[0].length, r = new Ci(i.fields), n = new Pi(r, 0, e, 0, void 0, s);
72
- return new Oi(i, n);
73
- }
74
- }
75
- function Li(t, a) {
76
- for (const i of t)
77
- i.geometry.coordinates = Fa(i.geometry.coordinates, a);
78
- return t;
79
- }
80
- function Fa(t, a) {
81
- return Di(t) ? a(t) : t.map((i) => Fa(i, a));
82
- }
83
- function Di(t) {
84
- return Array.isArray(t) && Number.isFinite(t[0]) && Number.isFinite(t[1]);
85
- }
86
- class ea {
87
- constructor(a) {
88
- N(this, "offset");
89
- N(this, "arrayBuffers");
90
- N(this, "ended");
91
- N(this, "maxRewindBytes");
92
- const { maxRewindBytes: i = 0 } = a || {};
93
- this.offset = 0, this.arrayBuffers = [], this.ended = !1, this.maxRewindBytes = i;
94
- }
95
- /**
96
- * @param arrayBuffer
97
- */
98
- write(a) {
99
- this.arrayBuffers.push(a);
100
- }
101
- end() {
102
- this.arrayBuffers = [], this.ended = !0;
103
- }
104
- /**
105
- * Has enough bytes available in array buffers
106
- *
107
- * @param bytes Number of bytes
108
- * @return boolean
109
- */
110
- hasAvailableBytes(a) {
111
- let i = -this.offset;
112
- for (const s of this.arrayBuffers)
113
- if (i += s.byteLength, i >= a)
114
- return !0;
115
- return !1;
116
- }
117
- /**
118
- * Find offsets of byte ranges within this.arrayBuffers
119
- *
120
- * @param bytes Byte length to read
121
- * @return Arrays with byte ranges pointing to this.arrayBuffers, Output type is nested array, e.g. [ [0, [1, 2]], ...]
122
- */
123
- findBufferOffsets(a) {
124
- let i = -this.offset;
125
- const s = [];
126
- for (let e = 0; e < this.arrayBuffers.length; e++) {
127
- const r = this.arrayBuffers[e];
128
- if (i + r.byteLength <= 0) {
129
- i += r.byteLength;
130
- continue;
131
- }
132
- const n = i <= 0 ? Math.abs(i) : 0;
133
- let h;
134
- if (n + a <= r.byteLength)
135
- return h = n + a, s.push([e, [n, h]]), s;
136
- h = r.byteLength, s.push([e, [n, h]]), a -= r.byteLength - n, i += r.byteLength;
137
- }
138
- return null;
139
- }
140
- /**
141
- * Get the required number of bytes from the iterator
142
- *
143
- * @param bytes Number of bytes
144
- * @return DataView with data
145
- */
146
- getDataView(a) {
147
- const i = this.findBufferOffsets(a);
148
- if (!i && this.ended)
149
- throw new Error("binary data exhausted");
150
- if (!i)
151
- return null;
152
- if (i.length === 1) {
153
- const [e, [r, n]] = i[0], h = this.arrayBuffers[e], o = new DataView(h, r, n - r);
154
- return this.offset += a, this.disposeBuffers(), o;
155
- }
156
- const s = new DataView(this._combineArrayBuffers(i));
157
- return this.offset += a, this.disposeBuffers(), s;
158
- }
159
- /**
160
- * Dispose of old array buffers
161
- */
162
- disposeBuffers() {
163
- for (; this.arrayBuffers.length > 0 && this.offset - this.maxRewindBytes >= this.arrayBuffers[0].byteLength; )
164
- this.offset -= this.arrayBuffers[0].byteLength, this.arrayBuffers.shift();
165
- }
166
- /**
167
- * Copy multiple ArrayBuffers into one contiguous ArrayBuffer
168
- *
169
- * In contrast to concatenateArrayBuffers, this only copies the necessary
170
- * portions of the source arrays, rather than first copying the entire arrays
171
- * then taking a part of them.
172
- *
173
- * @param bufferOffsets List of internal array offsets
174
- * @return New contiguous ArrayBuffer
175
- */
176
- _combineArrayBuffers(a) {
177
- let i = 0;
178
- for (const r of a) {
179
- const [n, h] = r[1];
180
- i += h - n;
181
- }
182
- const s = new Uint8Array(i);
183
- let e = 0;
184
- for (const r of a) {
185
- const [n, [h, o]] = r, f = new Uint8Array(this.arrayBuffers[n]);
186
- s.set(f.subarray(h, o), e), e += o - h;
187
- }
188
- return s.buffer;
189
- }
190
- /**
191
- * @param bytes
192
- */
193
- skip(a) {
194
- this.offset += a;
195
- }
196
- /**
197
- * @param bytes
198
- */
199
- rewind(a) {
200
- this.offset -= a;
201
- }
202
- }
203
- const Q = !0, da = !1, Bi = 9994;
204
- function qa(t) {
205
- const a = {
206
- magic: t.getInt32(0, da),
207
- // Length is stored as # of 2-byte words; multiply by 2 to get # of bytes
208
- length: t.getInt32(24, da) * 2,
209
- version: t.getInt32(28, Q),
210
- type: t.getInt32(32, Q),
211
- bbox: {
212
- minX: t.getFloat64(36, Q),
213
- minY: t.getFloat64(44, Q),
214
- minZ: t.getFloat64(68, Q),
215
- minM: t.getFloat64(84, Q),
216
- maxX: t.getFloat64(52, Q),
217
- maxY: t.getFloat64(60, Q),
218
- maxZ: t.getFloat64(76, Q),
219
- maxM: t.getFloat64(92, Q)
220
- }
221
- };
222
- return a.magic !== Bi && console.error(`SHP file: bad magic number ${a.magic}`), a.version !== 1e3 && console.error(`SHP file: bad version ${a.version}`), a;
223
- }
224
- const Bt = !0;
225
- function Gi(t, a) {
226
- const { _maxDimensions: i = 4 } = (a == null ? void 0 : a.shp) || {};
227
- let s = 0;
228
- const e = t.getInt32(s, Bt);
229
- switch (s += Int32Array.BYTES_PER_ELEMENT, e) {
230
- case 0:
231
- return $i();
232
- case 1:
233
- return Wt(t, s, Math.min(2, i));
234
- case 3:
235
- return ht(t, s, Math.min(2, i), "LineString");
236
- case 5:
237
- return ht(t, s, Math.min(2, i), "Polygon");
238
- case 8:
239
- return Xt(t, s, Math.min(2, i));
240
- // GeometryZ can have 3 or 4 dimensions, since the M is not required to
241
- // exist
242
- case 11:
243
- return Wt(t, s, Math.min(4, i));
244
- case 13:
245
- return ht(t, s, Math.min(4, i), "LineString");
246
- case 15:
247
- return ht(t, s, Math.min(4, i), "Polygon");
248
- case 18:
249
- return Xt(t, s, Math.min(4, i));
250
- case 21:
251
- return Wt(t, s, Math.min(3, i));
252
- case 23:
253
- return ht(t, s, Math.min(3, i), "LineString");
254
- case 25:
255
- return ht(t, s, Math.min(3, i), "Polygon");
256
- case 28:
257
- return Xt(t, s, Math.min(3, i));
258
- default:
259
- throw new Error(`unsupported shape type: ${e}`);
260
- }
261
- }
262
- function $i() {
263
- return null;
264
- }
265
- function Wt(t, a, i) {
266
- let s;
267
- return [s, a] = et(t, a, 1, i), {
268
- positions: { value: s, size: i },
269
- type: "Point"
270
- };
271
- }
272
- function Xt(t, a, i) {
273
- a += 4 * Float64Array.BYTES_PER_ELEMENT;
274
- const s = t.getInt32(a, Bt);
275
- a += Int32Array.BYTES_PER_ELEMENT;
276
- let e = null, r = null, n = null;
277
- return [e, a] = et(t, a, s, 2), i === 4 && (a += 2 * Float64Array.BYTES_PER_ELEMENT, [n, a] = et(t, a, s, 1)), i >= 3 && (a += 2 * Float64Array.BYTES_PER_ELEMENT, [r, a] = et(t, a, s, 1)), {
278
- positions: { value: ka(e, r, n), size: i },
279
- type: "Point"
280
- };
281
- }
282
- function ht(t, a, i, s) {
283
- a += 4 * Float64Array.BYTES_PER_ELEMENT;
284
- const e = t.getInt32(a, Bt);
285
- a += Int32Array.BYTES_PER_ELEMENT;
286
- const r = t.getInt32(a, Bt);
287
- a += Int32Array.BYTES_PER_ELEMENT;
288
- const n = t.byteOffset + a, h = e * Int32Array.BYTES_PER_ELEMENT, o = new Int32Array(e + 1);
289
- o.set(new Int32Array(t.buffer.slice(n, n + h))), o[e] = r, a += e * Int32Array.BYTES_PER_ELEMENT;
290
- let f = null, u = null, c = null;
291
- [f, a] = et(t, a, r, 2), i === 4 && (a += 2 * Float64Array.BYTES_PER_ELEMENT, [c, a] = et(t, a, r, 1)), i >= 3 && (a += 2 * Float64Array.BYTES_PER_ELEMENT, [u, a] = et(t, a, r, 1));
292
- const l = ka(f, u, c);
293
- if (s === "LineString")
294
- return {
295
- type: s,
296
- positions: { value: l, size: i },
297
- pathIndices: { value: o, size: 1 }
298
- };
299
- const d = [];
300
- for (let M = 1; M < o.length; M++) {
301
- const m = o[M - 1], y = o[M], b = f.subarray(m * 2, y * 2);
302
- Ui(b) > 0 && d.push(m);
303
- }
304
- return d.push(r), {
305
- type: s,
306
- positions: { value: l, size: i },
307
- primitivePolygonIndices: { value: o, size: 1 },
308
- // TODO: Dynamically choose Uint32Array over Uint16Array only when
309
- // necessary. I believe the implementation requires nPoints to be the
310
- // largest value in the array, so you should be able to use Uint32Array only
311
- // when nPoints > 65535.
312
- polygonIndices: { value: new Uint32Array(d), size: 1 }
313
- };
314
- }
315
- function et(t, a, i, s) {
316
- const e = t.byteOffset + a, r = i * s * Float64Array.BYTES_PER_ELEMENT;
317
- return [
318
- new Float64Array(t.buffer.slice(e, e + r)),
319
- a + r
320
- ];
321
- }
322
- function ka(t, a, i) {
323
- if (!(a || i))
324
- return t;
325
- let s = t.length, e = 2;
326
- i && i.length && (s += i.length, e++), a && a.length && (s += a.length, e++);
327
- const r = new Float64Array(s);
328
- for (let n = 0; n < t.length / 2; n++)
329
- r[e * n] = t[n * 2], r[e * n + 1] = t[n * 2 + 1];
330
- if (i && i.length)
331
- for (let n = 0; n < i.length; n++)
332
- r[e * n + 2] = i[n];
333
- if (a && a.length)
334
- for (let n = 0; n < a.length; n++)
335
- r[e * n + (e - 1)] = a[n];
336
- return r;
337
- }
338
- function Ui(t) {
339
- return Math.sign(Fi(t));
340
- }
341
- function Fi(t) {
342
- let a = 0;
343
- const i = t.length / 2 - 1;
344
- for (let s = 0; s < i; s++)
345
- a += (t[s * 2] + t[(s + 1) * 2]) * (t[s * 2 + 1] - t[(s + 1) * 2 + 1]);
346
- return a / 2;
347
- }
348
- const qi = !0, Ma = !1, ki = 100, vt = 12, j = {
349
- EXPECTING_HEADER: 0,
350
- EXPECTING_RECORD: 1,
351
- END: 2,
352
- ERROR: 3
353
- };
354
- class za {
355
- constructor(a) {
356
- N(this, "options", {});
357
- N(this, "binaryReader", new ea({ maxRewindBytes: vt }));
358
- N(this, "state", j.EXPECTING_HEADER);
359
- N(this, "result", {
360
- geometries: [],
361
- // Initialize with number values to make TS happy
362
- // These are initialized for real in STATE.EXPECTING_HEADER
363
- progress: {
364
- bytesTotal: NaN,
365
- bytesUsed: NaN,
366
- rows: NaN
367
- },
368
- currentIndex: NaN
369
- });
370
- this.options = a;
371
- }
372
- write(a) {
373
- this.binaryReader.write(a), this.state = ma(this.state, this.result, this.binaryReader, this.options);
374
- }
375
- end() {
376
- this.binaryReader.end(), this.state = ma(this.state, this.result, this.binaryReader, this.options), this.state !== j.END && (this.state = j.ERROR, this.result.error = "SHP incomplete file");
377
- }
378
- }
379
- function va(t, a) {
380
- const i = new za(a);
381
- return i.write(t), i.end(), i.result;
382
- }
383
- async function* zi(t, a) {
384
- const i = new za(a);
385
- let s = !1;
386
- for await (const e of zt(t))
387
- i.write(e), !s && i.result.header && (s = !0, yield i.result.header), i.result.geometries.length > 0 && (yield i.result.geometries, i.result.geometries = []);
388
- i.end(), i.result.geometries.length > 0 && (yield i.result.geometries);
389
- }
390
- function ma(t, a, i, s) {
391
- var e;
392
- for (; ; )
393
- try {
394
- switch (t) {
395
- case j.ERROR:
396
- case j.END:
397
- return t;
398
- case j.EXPECTING_HEADER:
399
- const r = i.getDataView(ki);
400
- if (!r)
401
- return t;
402
- a.header = qa(r), a.progress = {
403
- bytesUsed: 0,
404
- bytesTotal: a.header.length,
405
- rows: 0
406
- }, a.currentIndex = 1, t = j.EXPECTING_RECORD;
407
- break;
408
- case j.EXPECTING_RECORD:
409
- for (; i.hasAvailableBytes(vt); ) {
410
- const n = i.getDataView(vt), h = {
411
- recordNumber: n.getInt32(0, Ma),
412
- // 2 byte words; includes the four words of record header
413
- byteLength: n.getInt32(4, Ma) * 2,
414
- // This is actually part of the record, not the header...
415
- type: n.getInt32(8, qi)
416
- };
417
- if (!i.hasAvailableBytes(h.byteLength - 4))
418
- return i.rewind(vt), t;
419
- if (h.byteLength < 4 || h.type !== ((e = a.header) == null ? void 0 : e.type) || h.recordNumber !== a.currentIndex)
420
- i.rewind(vt - 4);
421
- else {
422
- i.rewind(4);
423
- const f = i.getDataView(h.byteLength), u = Gi(f, s);
424
- a.geometries.push(u), a.currentIndex++, a.progress.rows = a.currentIndex - 1;
425
- }
426
- }
427
- return i.ended && (t = j.END), t;
428
- default:
429
- return t = j.ERROR, a.error = `illegal parser state ${t}`, t;
430
- }
431
- } catch (r) {
432
- return t = j.ERROR, a.error = `SHP parsing failed: ${r == null ? void 0 : r.message}`, t;
433
- }
434
- }
435
- const Hi = "4.4.3", Ha = [0, 0, 39, 10], ji = {
436
- dataType: null,
437
- batchType: null,
438
- name: "SHP",
439
- id: "shp",
440
- module: "shapefile",
441
- version: Hi,
442
- worker: !0,
443
- category: "geometry",
444
- extensions: ["shp"],
445
- mimeTypes: ["application/octet-stream"],
446
- // ISSUE: This also identifies SHX files, which are identical to SHP for the first 100 bytes...
447
- tests: [new Uint8Array(Ha).buffer],
448
- options: {
449
- shp: {
450
- _maxDimensions: 4
451
- }
452
- }
453
- }, ja = {
454
- ...ji,
455
- parse: async (t, a) => va(t, a),
456
- parseSync: va,
457
- parseInBatches: (t, a) => zi(t, a)
458
- };
459
- function Wi(t) {
460
- t("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"), t("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"), t("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"), t.WGS84 = t["EPSG:4326"], t["EPSG:3785"] = t["EPSG:3857"], t.GOOGLE = t["EPSG:3857"], t["EPSG:900913"] = t["EPSG:3857"], t["EPSG:102113"] = t["EPSG:3857"];
461
- }
462
- var rt = 1, nt = 2, Xi = 4, ta = 5, gt = 484813681109536e-20, v = Math.PI / 2, Qi = 0.16666666666666666, Ji = 0.04722222222222222, Vi = 0.022156084656084655, _ = 1e-10, D = 0.017453292519943295, Y = 57.29577951308232, w = Math.PI / 4, aa = Math.PI * 2, O = 3.14159265359, q = {};
463
- q.greenwich = 0;
464
- q.lisbon = -9.131906111111;
465
- q.paris = 2.337229166667;
466
- q.bogota = -74.080916666667;
467
- q.madrid = -3.687938888889;
468
- q.rome = 12.452333333333;
469
- q.bern = 7.439583333333;
470
- q.jakarta = 106.807719444444;
471
- q.ferro = -17.666666666667;
472
- q.brussels = 4.367975;
473
- q.stockholm = 18.058277777778;
474
- q.athens = 23.7163375;
475
- q.oslo = 10.722916666667;
476
- const Ki = {
477
- ft: { to_meter: 0.3048 },
478
- "us-ft": { to_meter: 1200 / 3937 }
479
- };
480
- var ya = /[\s_\-\/\(\)]/g;
481
- function tt(t, a) {
482
- if (t[a])
483
- return t[a];
484
- for (var i = Object.keys(t), s = a.toLowerCase().replace(ya, ""), e = -1, r, n; ++e < i.length; )
485
- if (r = i[e], n = r.toLowerCase().replace(ya, ""), n === s)
486
- return t[r];
487
- }
488
- function ia(t) {
489
- var a = {}, i = t.split("+").map(function(h) {
490
- return h.trim();
491
- }).filter(function(h) {
492
- return h;
493
- }).reduce(function(h, o) {
494
- var f = o.split("=");
495
- return f.push(!0), h[f[0].toLowerCase()] = f[1], h;
496
- }, {}), s, e, r, n = {
497
- proj: "projName",
498
- datum: "datumCode",
499
- rf: function(h) {
500
- a.rf = parseFloat(h);
501
- },
502
- lat_0: function(h) {
503
- a.lat0 = h * D;
504
- },
505
- lat_1: function(h) {
506
- a.lat1 = h * D;
507
- },
508
- lat_2: function(h) {
509
- a.lat2 = h * D;
510
- },
511
- lat_ts: function(h) {
512
- a.lat_ts = h * D;
513
- },
514
- lon_0: function(h) {
515
- a.long0 = h * D;
516
- },
517
- lon_1: function(h) {
518
- a.long1 = h * D;
519
- },
520
- lon_2: function(h) {
521
- a.long2 = h * D;
522
- },
523
- alpha: function(h) {
524
- a.alpha = parseFloat(h) * D;
525
- },
526
- lonc: function(h) {
527
- a.longc = h * D;
528
- },
529
- x_0: function(h) {
530
- a.x0 = parseFloat(h);
531
- },
532
- y_0: function(h) {
533
- a.y0 = parseFloat(h);
534
- },
535
- k_0: function(h) {
536
- a.k0 = parseFloat(h);
537
- },
538
- k: function(h) {
539
- a.k0 = parseFloat(h);
540
- },
541
- a: function(h) {
542
- a.a = parseFloat(h);
543
- },
544
- b: function(h) {
545
- a.b = parseFloat(h);
546
- },
547
- r_a: function() {
548
- a.R_A = !0;
549
- },
550
- zone: function(h) {
551
- a.zone = parseInt(h, 10);
552
- },
553
- south: function() {
554
- a.utmSouth = !0;
555
- },
556
- towgs84: function(h) {
557
- a.datum_params = h.split(",").map(function(o) {
558
- return parseFloat(o);
559
- });
560
- },
561
- to_meter: function(h) {
562
- a.to_meter = parseFloat(h);
563
- },
564
- units: function(h) {
565
- a.units = h;
566
- var o = tt(Ki, h);
567
- o && (a.to_meter = o.to_meter);
568
- },
569
- from_greenwich: function(h) {
570
- a.from_greenwich = h * D;
571
- },
572
- pm: function(h) {
573
- var o = tt(q, h);
574
- a.from_greenwich = (o || parseFloat(h)) * D;
575
- },
576
- nadgrids: function(h) {
577
- h === "@null" ? a.datumCode = "none" : a.nadgrids = h;
578
- },
579
- axis: function(h) {
580
- var o = "ewnsud";
581
- h.length === 3 && o.indexOf(h.substr(0, 1)) !== -1 && o.indexOf(h.substr(1, 1)) !== -1 && o.indexOf(h.substr(2, 1)) !== -1 && (a.axis = h);
582
- }
583
- };
584
- for (s in i)
585
- e = i[s], s in n ? (r = n[s], typeof r == "function" ? r(e) : a[r] = e) : a[s] = e;
586
- return typeof a.datumCode == "string" && a.datumCode !== "WGS84" && (a.datumCode = a.datumCode.toLowerCase()), a;
587
- }
588
- class Wa {
589
- static getId(a) {
590
- const i = a.find((s) => Array.isArray(s) && s[0] === "ID");
591
- return i && i.length >= 3 ? {
592
- authority: i[1],
593
- code: parseInt(i[2], 10)
594
- } : null;
595
- }
596
- static convertUnit(a, i = "unit") {
597
- if (!a || a.length < 3)
598
- return { type: i, name: "unknown", conversion_factor: null };
599
- const s = a[1], e = parseFloat(a[2]) || null, r = a.find((h) => Array.isArray(h) && h[0] === "ID"), n = r ? {
600
- authority: r[1],
601
- code: parseInt(r[2], 10)
602
- } : null;
603
- return {
604
- type: i,
605
- name: s,
606
- conversion_factor: e,
607
- id: n
608
- };
609
- }
610
- static convertAxis(a) {
611
- const i = a[1] || "Unknown";
612
- let s;
613
- const e = i.match(/^\((.)\)$/);
614
- if (e) {
615
- const f = e[1].toUpperCase();
616
- if (f === "E") s = "east";
617
- else if (f === "N") s = "north";
618
- else if (f === "U") s = "up";
619
- else if (a[2]) s = a[2];
620
- else throw new Error(`Unknown axis abbreviation: ${f}`);
621
- } else
622
- s = a[2] || "unknown";
623
- const r = a.find((f) => Array.isArray(f) && f[0] === "ORDER"), n = r ? parseInt(r[1], 10) : null, h = a.find(
624
- (f) => Array.isArray(f) && (f[0] === "LENGTHUNIT" || f[0] === "ANGLEUNIT" || f[0] === "SCALEUNIT")
625
- ), o = this.convertUnit(h);
626
- return {
627
- name: i,
628
- direction: s,
629
- // Use the valid PROJJSON direction value
630
- unit: o,
631
- order: n
632
- };
633
- }
634
- static extractAxes(a) {
635
- return a.filter((i) => Array.isArray(i) && i[0] === "AXIS").map((i) => this.convertAxis(i)).sort((i, s) => (i.order || 0) - (s.order || 0));
636
- }
637
- static convert(a, i = {}) {
638
- switch (a[0]) {
639
- case "PROJCRS":
640
- i.type = "ProjectedCRS", i.name = a[1], i.base_crs = a.find((l) => Array.isArray(l) && l[0] === "BASEGEOGCRS") ? this.convert(a.find((l) => Array.isArray(l) && l[0] === "BASEGEOGCRS")) : null, i.conversion = a.find((l) => Array.isArray(l) && l[0] === "CONVERSION") ? this.convert(a.find((l) => Array.isArray(l) && l[0] === "CONVERSION")) : null;
641
- const s = a.find((l) => Array.isArray(l) && l[0] === "CS");
642
- s && (i.coordinate_system = {
643
- type: s[1],
644
- axis: this.extractAxes(a)
645
- });
646
- const e = a.find((l) => Array.isArray(l) && l[0] === "LENGTHUNIT");
647
- if (e) {
648
- const l = this.convertUnit(e);
649
- i.coordinate_system.unit = l;
650
- }
651
- i.id = this.getId(a);
652
- break;
653
- case "BASEGEOGCRS":
654
- case "GEOGCRS":
655
- case "GEODCRS":
656
- i.type = a[0] === "GEODCRS" ? "GeodeticCRS" : "GeographicCRS", i.name = a[1];
657
- const r = a.find(
658
- (l) => Array.isArray(l) && (l[0] === "DATUM" || l[0] === "ENSEMBLE")
659
- );
660
- if (r) {
661
- const l = this.convert(r);
662
- r[0] === "ENSEMBLE" ? i.datum_ensemble = l : i.datum = l;
663
- const d = a.find((M) => Array.isArray(M) && M[0] === "PRIMEM");
664
- d && d[1] !== "Greenwich" && (l.prime_meridian = {
665
- name: d[1],
666
- longitude: parseFloat(d[2])
667
- });
668
- }
669
- i.coordinate_system = {
670
- type: "ellipsoidal",
671
- axis: this.extractAxes(a)
672
- }, i.id = this.getId(a);
673
- break;
674
- case "DATUM":
675
- i.type = "GeodeticReferenceFrame", i.name = a[1], i.ellipsoid = a.find((l) => Array.isArray(l) && l[0] === "ELLIPSOID") ? this.convert(a.find((l) => Array.isArray(l) && l[0] === "ELLIPSOID")) : null;
676
- break;
677
- case "ENSEMBLE":
678
- i.type = "DatumEnsemble", i.name = a[1], i.members = a.filter((l) => Array.isArray(l) && l[0] === "MEMBER").map((l) => ({
679
- type: "DatumEnsembleMember",
680
- name: l[1],
681
- id: this.getId(l)
682
- // Extract ID as { authority, code }
683
- }));
684
- const n = a.find((l) => Array.isArray(l) && l[0] === "ENSEMBLEACCURACY");
685
- n && (i.accuracy = parseFloat(n[1]));
686
- const h = a.find((l) => Array.isArray(l) && l[0] === "ELLIPSOID");
687
- h && (i.ellipsoid = this.convert(h)), i.id = this.getId(a);
688
- break;
689
- case "ELLIPSOID":
690
- i.type = "Ellipsoid", i.name = a[1], i.semi_major_axis = parseFloat(a[2]), i.inverse_flattening = parseFloat(a[3]), a.find((l) => Array.isArray(l) && l[0] === "LENGTHUNIT") && this.convert(a.find((l) => Array.isArray(l) && l[0] === "LENGTHUNIT"), i);
691
- break;
692
- case "CONVERSION":
693
- i.type = "Conversion", i.name = a[1], i.method = a.find((l) => Array.isArray(l) && l[0] === "METHOD") ? this.convert(a.find((l) => Array.isArray(l) && l[0] === "METHOD")) : null, i.parameters = a.filter((l) => Array.isArray(l) && l[0] === "PARAMETER").map((l) => this.convert(l));
694
- break;
695
- case "METHOD":
696
- i.type = "Method", i.name = a[1], i.id = this.getId(a);
697
- break;
698
- case "PARAMETER":
699
- i.type = "Parameter", i.name = a[1], i.value = parseFloat(a[2]), i.unit = this.convertUnit(
700
- a.find(
701
- (l) => Array.isArray(l) && (l[0] === "LENGTHUNIT" || l[0] === "ANGLEUNIT" || l[0] === "SCALEUNIT")
702
- )
703
- ), i.id = this.getId(a);
704
- break;
705
- case "BOUNDCRS":
706
- i.type = "BoundCRS";
707
- const o = a.find((l) => Array.isArray(l) && l[0] === "SOURCECRS");
708
- if (o) {
709
- const l = o.find((d) => Array.isArray(d));
710
- i.source_crs = l ? this.convert(l) : null;
711
- }
712
- const f = a.find((l) => Array.isArray(l) && l[0] === "TARGETCRS");
713
- if (f) {
714
- const l = f.find((d) => Array.isArray(d));
715
- i.target_crs = l ? this.convert(l) : null;
716
- }
717
- const u = a.find((l) => Array.isArray(l) && l[0] === "ABRIDGEDTRANSFORMATION");
718
- u ? i.transformation = this.convert(u) : i.transformation = null;
719
- break;
720
- case "ABRIDGEDTRANSFORMATION":
721
- if (i.type = "Transformation", i.name = a[1], i.method = a.find((l) => Array.isArray(l) && l[0] === "METHOD") ? this.convert(a.find((l) => Array.isArray(l) && l[0] === "METHOD")) : null, i.parameters = a.filter((l) => Array.isArray(l) && (l[0] === "PARAMETER" || l[0] === "PARAMETERFILE")).map((l) => {
722
- if (l[0] === "PARAMETER")
723
- return this.convert(l);
724
- if (l[0] === "PARAMETERFILE")
725
- return {
726
- name: l[1],
727
- value: l[2],
728
- id: {
729
- authority: "EPSG",
730
- code: 8656
731
- }
732
- };
733
- }), i.parameters.length === 7) {
734
- const l = i.parameters[6];
735
- l.name === "Scale difference" && (l.value = Math.round((l.value - 1) * 1e12) / 1e6);
736
- }
737
- i.id = this.getId(a);
738
- break;
739
- case "AXIS":
740
- i.coordinate_system || (i.coordinate_system = { type: "unspecified", axis: [] }), i.coordinate_system.axis.push(this.convertAxis(a));
741
- break;
742
- case "LENGTHUNIT":
743
- const c = this.convertUnit(a, "LinearUnit");
744
- i.coordinate_system && i.coordinate_system.axis && i.coordinate_system.axis.forEach((l) => {
745
- l.unit || (l.unit = c);
746
- }), c.conversion_factor && c.conversion_factor !== 1 && i.semi_major_axis && (i.semi_major_axis = {
747
- value: i.semi_major_axis,
748
- unit: c
749
- });
750
- break;
751
- default:
752
- i.keyword = a[0];
753
- break;
754
- }
755
- return i;
756
- }
757
- }
758
- class Yi extends Wa {
759
- static convert(a, i = {}) {
760
- return super.convert(a, i), i.coordinate_system && i.coordinate_system.subtype === "Cartesian" && delete i.coordinate_system, i.usage && delete i.usage, i;
761
- }
762
- }
763
- class Zi extends Wa {
764
- static convert(a, i = {}) {
765
- super.convert(a, i);
766
- const s = a.find((r) => Array.isArray(r) && r[0] === "CS");
767
- s && (i.coordinate_system = {
768
- subtype: s[1],
769
- axis: this.extractAxes(a)
770
- });
771
- const e = a.find((r) => Array.isArray(r) && r[0] === "USAGE");
772
- if (e) {
773
- const r = e.find((o) => Array.isArray(o) && o[0] === "SCOPE"), n = e.find((o) => Array.isArray(o) && o[0] === "AREA"), h = e.find((o) => Array.isArray(o) && o[0] === "BBOX");
774
- i.usage = {}, r && (i.usage.scope = r[1]), n && (i.usage.area = n[1]), h && (i.usage.bbox = h.slice(1));
775
- }
776
- return i;
777
- }
778
- }
779
- function ts(t) {
780
- return t.find((a) => Array.isArray(a) && a[0] === "USAGE") ? "2019" : (t.find((a) => Array.isArray(a) && a[0] === "CS") || t[0] === "BOUNDCRS" || t[0] === "PROJCRS" || t[0] === "GEOGCRS", "2015");
781
- }
782
- function as(t) {
783
- return (ts(t) === "2019" ? Zi : Yi).convert(t);
784
- }
785
- function is(t) {
786
- const a = t.toUpperCase();
787
- return a.includes("PROJCRS") || a.includes("GEOGCRS") || a.includes("BOUNDCRS") || a.includes("VERTCRS") || a.includes("LENGTHUNIT") || a.includes("ANGLEUNIT") || a.includes("SCALEUNIT") ? "WKT2" : (a.includes("PROJCS") || a.includes("GEOGCS") || a.includes("LOCAL_CS") || a.includes("VERT_CS") || a.includes("UNIT"), "WKT1");
788
- }
789
- var Et = 1, Xa = 2, Qa = 3, Gt = 4, Ja = 5, ra = -1, ss = /\s/, es = /[A-Za-z]/, rs = /[A-Za-z84_]/, Ht = /[,\]]/, Va = /[\d\.E\-\+]/;
790
- function K(t) {
791
- if (typeof t != "string")
792
- throw new Error("not a string");
793
- this.text = t.trim(), this.level = 0, this.place = 0, this.root = null, this.stack = [], this.currentObject = null, this.state = Et;
794
- }
795
- K.prototype.readCharicter = function() {
796
- var t = this.text[this.place++];
797
- if (this.state !== Gt)
798
- for (; ss.test(t); ) {
799
- if (this.place >= this.text.length)
800
- return;
801
- t = this.text[this.place++];
802
- }
803
- switch (this.state) {
804
- case Et:
805
- return this.neutral(t);
806
- case Xa:
807
- return this.keyword(t);
808
- case Gt:
809
- return this.quoted(t);
810
- case Ja:
811
- return this.afterquote(t);
812
- case Qa:
813
- return this.number(t);
814
- case ra:
815
- return;
816
- }
817
- };
818
- K.prototype.afterquote = function(t) {
819
- if (t === '"') {
820
- this.word += '"', this.state = Gt;
821
- return;
822
- }
823
- if (Ht.test(t)) {
824
- this.word = this.word.trim(), this.afterItem(t);
825
- return;
826
- }
827
- throw new Error(`havn't handled "` + t + '" in afterquote yet, index ' + this.place);
828
- };
829
- K.prototype.afterItem = function(t) {
830
- if (t === ",") {
831
- this.word !== null && this.currentObject.push(this.word), this.word = null, this.state = Et;
832
- return;
833
- }
834
- if (t === "]") {
835
- this.level--, this.word !== null && (this.currentObject.push(this.word), this.word = null), this.state = Et, this.currentObject = this.stack.pop(), this.currentObject || (this.state = ra);
836
- return;
837
- }
838
- };
839
- K.prototype.number = function(t) {
840
- if (Va.test(t)) {
841
- this.word += t;
842
- return;
843
- }
844
- if (Ht.test(t)) {
845
- this.word = parseFloat(this.word), this.afterItem(t);
846
- return;
847
- }
848
- throw new Error(`havn't handled "` + t + '" in number yet, index ' + this.place);
849
- };
850
- K.prototype.quoted = function(t) {
851
- if (t === '"') {
852
- this.state = Ja;
853
- return;
854
- }
855
- this.word += t;
856
- };
857
- K.prototype.keyword = function(t) {
858
- if (rs.test(t)) {
859
- this.word += t;
860
- return;
861
- }
862
- if (t === "[") {
863
- var a = [];
864
- a.push(this.word), this.level++, this.root === null ? this.root = a : this.currentObject.push(a), this.stack.push(this.currentObject), this.currentObject = a, this.state = Et;
865
- return;
866
- }
867
- if (Ht.test(t)) {
868
- this.afterItem(t);
869
- return;
870
- }
871
- throw new Error(`havn't handled "` + t + '" in keyword yet, index ' + this.place);
872
- };
873
- K.prototype.neutral = function(t) {
874
- if (es.test(t)) {
875
- this.word = t, this.state = Xa;
876
- return;
877
- }
878
- if (t === '"') {
879
- this.word = "", this.state = Gt;
880
- return;
881
- }
882
- if (Va.test(t)) {
883
- this.word = t, this.state = Qa;
884
- return;
885
- }
886
- if (Ht.test(t)) {
887
- this.afterItem(t);
888
- return;
889
- }
890
- throw new Error(`havn't handled "` + t + '" in neutral yet, index ' + this.place);
891
- };
892
- K.prototype.output = function() {
893
- for (; this.place < this.text.length; )
894
- this.readCharicter();
895
- if (this.state === ra)
896
- return this.root;
897
- throw new Error('unable to parse string "' + this.text + '". State is ' + this.state);
898
- };
899
- function ns(t) {
900
- var a = new K(t);
901
- return a.output();
902
- }
903
- function Qt(t, a, i) {
904
- Array.isArray(a) && (i.unshift(a), a = null);
905
- var s = a ? {} : t, e = i.reduce(function(r, n) {
906
- return ot(n, r), r;
907
- }, s);
908
- a && (t[a] = e);
909
- }
910
- function ot(t, a) {
911
- if (!Array.isArray(t)) {
912
- a[t] = !0;
913
- return;
914
- }
915
- var i = t.shift();
916
- if (i === "PARAMETER" && (i = t.shift()), t.length === 1) {
917
- if (Array.isArray(t[0])) {
918
- a[i] = {}, ot(t[0], a[i]);
919
- return;
920
- }
921
- a[i] = t[0];
922
- return;
923
- }
924
- if (!t.length) {
925
- a[i] = !0;
926
- return;
927
- }
928
- if (i === "TOWGS84") {
929
- a[i] = t;
930
- return;
931
- }
932
- if (i === "AXIS") {
933
- i in a || (a[i] = []), a[i].push(t);
934
- return;
935
- }
936
- Array.isArray(i) || (a[i] = {});
937
- var s;
938
- switch (i) {
939
- case "UNIT":
940
- case "PRIMEM":
941
- case "VERT_DATUM":
942
- a[i] = {
943
- name: t[0].toLowerCase(),
944
- convert: t[1]
945
- }, t.length === 3 && ot(t[2], a[i]);
946
- return;
947
- case "SPHEROID":
948
- case "ELLIPSOID":
949
- a[i] = {
950
- name: t[0],
951
- a: t[1],
952
- rf: t[2]
953
- }, t.length === 4 && ot(t[3], a[i]);
954
- return;
955
- case "EDATUM":
956
- case "ENGINEERINGDATUM":
957
- case "LOCAL_DATUM":
958
- case "DATUM":
959
- case "VERT_CS":
960
- case "VERTCRS":
961
- case "VERTICALCRS":
962
- t[0] = ["name", t[0]], Qt(a, i, t);
963
- return;
964
- case "COMPD_CS":
965
- case "COMPOUNDCRS":
966
- case "FITTED_CS":
967
- // the followings are the crs defined in
968
- // https://github.com/proj4js/proj4js/blob/1da4ed0b865d0fcb51c136090569210cdcc9019e/lib/parseCode.js#L11
969
- case "PROJECTEDCRS":
970
- case "PROJCRS":
971
- case "GEOGCS":
972
- case "GEOCCS":
973
- case "PROJCS":
974
- case "LOCAL_CS":
975
- case "GEODCRS":
976
- case "GEODETICCRS":
977
- case "GEODETICDATUM":
978
- case "ENGCRS":
979
- case "ENGINEERINGCRS":
980
- t[0] = ["name", t[0]], Qt(a, i, t), a[i].type = i;
981
- return;
982
- default:
983
- for (s = -1; ++s < t.length; )
984
- if (!Array.isArray(t[s]))
985
- return ot(t, a[i]);
986
- return Qt(a, i, t);
987
- }
988
- }
989
- var hs = 0.017453292519943295;
990
- function z(t) {
991
- return t * hs;
992
- }
993
- function Ka(t) {
994
- const a = (t.projName || "").toLowerCase().replace(/_/g, " ");
995
- t.long0 === void 0 && t.longc !== void 0 && (t.long0 = t.longc), !t.lat_ts && t.lat1 && (a === "stereographic south pole" || a === "polar stereographic (variant b)") ? (t.lat0 = z(t.lat1 > 0 ? 90 : -90), t.lat_ts = t.lat1, delete t.lat1) : !t.lat_ts && t.lat0 && (a === "polar stereographic" || a === "polar stereographic (variant a)") && (t.lat_ts = t.lat0, t.lat0 = z(t.lat0 > 0 ? 90 : -90), delete t.lat1);
996
- }
997
- function _a(t) {
998
- let a = { units: null, to_meter: void 0 };
999
- return typeof t == "string" ? (a.units = t.toLowerCase(), a.units === "metre" && (a.units = "meter"), a.units === "meter" && (a.to_meter = 1)) : t && t.name && (a.units = t.name.toLowerCase(), a.units === "metre" && (a.units = "meter"), a.to_meter = t.conversion_factor), a;
1000
- }
1001
- function ga(t) {
1002
- return typeof t == "object" ? t.value * t.unit.conversion_factor : t;
1003
- }
1004
- function ba(t, a) {
1005
- t.ellipsoid.radius ? (a.a = t.ellipsoid.radius, a.rf = 0) : (a.a = ga(t.ellipsoid.semi_major_axis), t.ellipsoid.inverse_flattening !== void 0 ? a.rf = t.ellipsoid.inverse_flattening : t.ellipsoid.semi_major_axis !== void 0 && t.ellipsoid.semi_minor_axis !== void 0 && (a.rf = a.a / (a.a - ga(t.ellipsoid.semi_minor_axis))));
1006
- }
1007
- function $t(t, a = {}) {
1008
- return !t || typeof t != "object" ? t : t.type === "BoundCRS" ? ($t(t.source_crs, a), t.transformation && (t.transformation.method && t.transformation.method.name === "NTv2" ? a.nadgrids = t.transformation.parameters[0].value : a.datum_params = t.transformation.parameters.map((i) => i.value)), a) : (Object.keys(t).forEach((i) => {
1009
- const s = t[i];
1010
- if (s !== null)
1011
- switch (i) {
1012
- case "name":
1013
- if (a.srsCode)
1014
- break;
1015
- a.name = s, a.srsCode = s;
1016
- break;
1017
- case "type":
1018
- s === "GeographicCRS" ? a.projName = "longlat" : s === "GeodeticCRS" ? t.coordinate_system && t.coordinate_system.subtype === "Cartesian" ? a.projName = "geocent" : a.projName = "longlat" : s === "ProjectedCRS" && t.conversion && t.conversion.method && (a.projName = t.conversion.method.name);
1019
- break;
1020
- case "datum":
1021
- case "datum_ensemble":
1022
- s.ellipsoid && (a.ellps = s.ellipsoid.name, ba(s, a)), s.prime_meridian && (a.from_greenwich = s.prime_meridian.longitude * Math.PI / 180);
1023
- break;
1024
- case "ellipsoid":
1025
- a.ellps = s.name, ba(s, a);
1026
- break;
1027
- case "prime_meridian":
1028
- a.long0 = (s.longitude || 0) * Math.PI / 180;
1029
- break;
1030
- case "coordinate_system":
1031
- if (s.axis) {
1032
- const e = {
1033
- east: "e",
1034
- north: "n",
1035
- west: "w",
1036
- south: "s",
1037
- up: "u",
1038
- down: "d",
1039
- geocentricx: "e",
1040
- geocentricy: "n",
1041
- geocentricz: "u"
1042
- }, r = s.axis.map((n) => e[n.direction.toLowerCase()]);
1043
- if (r.every(Boolean) && (a.axis = r.join(""), a.axis.length === 2 && (a.axis += "u")), s.unit) {
1044
- const { units: n, to_meter: h } = _a(s.unit);
1045
- a.units = n, a.to_meter = h;
1046
- } else if (s.axis[0] && s.axis[0].unit) {
1047
- const { units: n, to_meter: h } = _a(s.axis[0].unit);
1048
- a.units = n, a.to_meter = h;
1049
- }
1050
- }
1051
- break;
1052
- case "id":
1053
- s.authority && s.code && (a.title = s.authority + ":" + s.code);
1054
- break;
1055
- case "conversion":
1056
- s.method && s.method.name && (a.projName = s.method.name), s.parameters && s.parameters.forEach((e) => {
1057
- const r = e.name.toLowerCase().replace(/\s+/g, "_"), n = e.value;
1058
- e.unit && e.unit.conversion_factor ? a[r] = n * e.unit.conversion_factor : e.unit === "degree" ? a[r] = n * Math.PI / 180 : a[r] = n;
1059
- });
1060
- break;
1061
- case "unit":
1062
- s.name && (a.units = s.name.toLowerCase(), a.units === "metre" && (a.units = "meter")), s.conversion_factor && (a.to_meter = s.conversion_factor);
1063
- break;
1064
- case "base_crs":
1065
- $t(s, a), a.datumCode = s.id ? s.id.authority + "_" + s.id.code : s.name;
1066
- break;
1067
- }
1068
- }), a.latitude_of_false_origin !== void 0 && (a.lat0 = a.latitude_of_false_origin), a.longitude_of_false_origin !== void 0 && (a.long0 = a.longitude_of_false_origin), a.latitude_of_standard_parallel !== void 0 && (a.lat0 = a.latitude_of_standard_parallel, a.lat1 = a.latitude_of_standard_parallel), a.latitude_of_1st_standard_parallel !== void 0 && (a.lat1 = a.latitude_of_1st_standard_parallel), a.latitude_of_2nd_standard_parallel !== void 0 && (a.lat2 = a.latitude_of_2nd_standard_parallel), a.latitude_of_projection_centre !== void 0 && (a.lat0 = a.latitude_of_projection_centre), a.longitude_of_projection_centre !== void 0 && (a.longc = a.longitude_of_projection_centre), a.easting_at_false_origin !== void 0 && (a.x0 = a.easting_at_false_origin), a.northing_at_false_origin !== void 0 && (a.y0 = a.northing_at_false_origin), a.latitude_of_natural_origin !== void 0 && (a.lat0 = a.latitude_of_natural_origin), a.longitude_of_natural_origin !== void 0 && (a.long0 = a.longitude_of_natural_origin), a.longitude_of_origin !== void 0 && (a.long0 = a.longitude_of_origin), a.false_easting !== void 0 && (a.x0 = a.false_easting), a.easting_at_projection_centre && (a.x0 = a.easting_at_projection_centre), a.false_northing !== void 0 && (a.y0 = a.false_northing), a.northing_at_projection_centre && (a.y0 = a.northing_at_projection_centre), a.standard_parallel_1 !== void 0 && (a.lat1 = a.standard_parallel_1), a.standard_parallel_2 !== void 0 && (a.lat2 = a.standard_parallel_2), a.scale_factor_at_natural_origin !== void 0 && (a.k0 = a.scale_factor_at_natural_origin), a.scale_factor_at_projection_centre !== void 0 && (a.k0 = a.scale_factor_at_projection_centre), a.scale_factor_on_pseudo_standard_parallel !== void 0 && (a.k0 = a.scale_factor_on_pseudo_standard_parallel), a.azimuth !== void 0 && (a.alpha = a.azimuth), a.azimuth_at_projection_centre !== void 0 && (a.alpha = a.azimuth_at_projection_centre), a.angle_from_rectified_to_skew_grid && (a.rectified_grid_angle = a.angle_from_rectified_to_skew_grid), Ka(a), a);
1069
- }
1070
- var os = [
1071
- "PROJECTEDCRS",
1072
- "PROJCRS",
1073
- "GEOGCS",
1074
- "GEOCCS",
1075
- "PROJCS",
1076
- "LOCAL_CS",
1077
- "GEODCRS",
1078
- "GEODETICCRS",
1079
- "GEODETICDATUM",
1080
- "ENGCRS",
1081
- "ENGINEERINGCRS"
1082
- ];
1083
- function ls(t, a) {
1084
- var i = a[0], s = a[1];
1085
- !(i in t) && s in t && (t[i] = t[s], a.length === 3 && (t[i] = a[2](t[i])));
1086
- }
1087
- function Ya(t) {
1088
- for (var a = Object.keys(t), i = 0, s = a.length; i < s; ++i) {
1089
- var e = a[i];
1090
- os.indexOf(e) !== -1 && fs(t[e]), typeof t[e] == "object" && Ya(t[e]);
1091
- }
1092
- }
1093
- function fs(t) {
1094
- if (t.AUTHORITY) {
1095
- var a = Object.keys(t.AUTHORITY)[0];
1096
- a && a in t.AUTHORITY && (t.title = a + ":" + t.AUTHORITY[a]);
1097
- }
1098
- if (t.type === "GEOGCS" ? t.projName = "longlat" : t.type === "LOCAL_CS" ? (t.projName = "identity", t.local = !0) : typeof t.PROJECTION == "object" ? t.projName = Object.keys(t.PROJECTION)[0] : t.projName = t.PROJECTION, t.AXIS) {
1099
- for (var i = "", s = 0, e = t.AXIS.length; s < e; ++s) {
1100
- var r = [t.AXIS[s][0].toLowerCase(), t.AXIS[s][1].toLowerCase()];
1101
- r[0].indexOf("north") !== -1 || (r[0] === "y" || r[0] === "lat") && r[1] === "north" ? i += "n" : r[0].indexOf("south") !== -1 || (r[0] === "y" || r[0] === "lat") && r[1] === "south" ? i += "s" : r[0].indexOf("east") !== -1 || (r[0] === "x" || r[0] === "lon") && r[1] === "east" ? i += "e" : (r[0].indexOf("west") !== -1 || (r[0] === "x" || r[0] === "lon") && r[1] === "west") && (i += "w");
1102
- }
1103
- i.length === 2 && (i += "u"), i.length === 3 && (t.axis = i);
1104
- }
1105
- t.UNIT && (t.units = t.UNIT.name.toLowerCase(), t.units === "metre" && (t.units = "meter"), t.UNIT.convert && (t.type === "GEOGCS" ? t.DATUM && t.DATUM.SPHEROID && (t.to_meter = t.UNIT.convert * t.DATUM.SPHEROID.a) : t.to_meter = t.UNIT.convert));
1106
- var n = t.GEOGCS;
1107
- t.type === "GEOGCS" && (n = t), n && (n.PRIMEM && n.PRIMEM.convert && (t.from_greenwich = z(n.PRIMEM.convert)), n.DATUM ? t.datumCode = n.DATUM.name.toLowerCase() : t.datumCode = n.name.toLowerCase(), t.datumCode.slice(0, 2) === "d_" && (t.datumCode = t.datumCode.slice(2)), t.datumCode === "new_zealand_1949" && (t.datumCode = "nzgd49"), (t.datumCode === "wgs_1984" || t.datumCode === "world_geodetic_system_1984") && (t.PROJECTION === "Mercator_Auxiliary_Sphere" && (t.sphere = !0), t.datumCode = "wgs84"), t.datumCode === "belge_1972" && (t.datumCode = "rnb72"), n.DATUM && n.DATUM.SPHEROID && (t.ellps = n.DATUM.SPHEROID.name.replace("_19", "").replace(/[Cc]larke\_18/, "clrk"), t.ellps.toLowerCase().slice(0, 13) === "international" && (t.ellps = "intl"), t.a = n.DATUM.SPHEROID.a, t.rf = parseFloat(n.DATUM.SPHEROID.rf)), n.DATUM && n.DATUM.TOWGS84 && (t.datum_params = n.DATUM.TOWGS84), ~t.datumCode.indexOf("osgb_1936") && (t.datumCode = "osgb36"), ~t.datumCode.indexOf("osni_1952") && (t.datumCode = "osni52"), (~t.datumCode.indexOf("tm65") || ~t.datumCode.indexOf("geodetic_datum_of_1965")) && (t.datumCode = "ire65"), t.datumCode === "ch1903+" && (t.datumCode = "ch1903"), ~t.datumCode.indexOf("israel") && (t.datumCode = "isr93")), t.b && !isFinite(t.b) && (t.b = t.a), t.rectified_grid_angle && (t.rectified_grid_angle = z(t.rectified_grid_angle));
1108
- function h(u) {
1109
- var c = t.to_meter || 1;
1110
- return u * c;
1111
- }
1112
- var o = function(u) {
1113
- return ls(t, u);
1114
- }, f = [
1115
- ["standard_parallel_1", "Standard_Parallel_1"],
1116
- ["standard_parallel_1", "Latitude of 1st standard parallel"],
1117
- ["standard_parallel_2", "Standard_Parallel_2"],
1118
- ["standard_parallel_2", "Latitude of 2nd standard parallel"],
1119
- ["false_easting", "False_Easting"],
1120
- ["false_easting", "False easting"],
1121
- ["false-easting", "Easting at false origin"],
1122
- ["false_northing", "False_Northing"],
1123
- ["false_northing", "False northing"],
1124
- ["false_northing", "Northing at false origin"],
1125
- ["central_meridian", "Central_Meridian"],
1126
- ["central_meridian", "Longitude of natural origin"],
1127
- ["central_meridian", "Longitude of false origin"],
1128
- ["latitude_of_origin", "Latitude_Of_Origin"],
1129
- ["latitude_of_origin", "Central_Parallel"],
1130
- ["latitude_of_origin", "Latitude of natural origin"],
1131
- ["latitude_of_origin", "Latitude of false origin"],
1132
- ["scale_factor", "Scale_Factor"],
1133
- ["k0", "scale_factor"],
1134
- ["latitude_of_center", "Latitude_Of_Center"],
1135
- ["latitude_of_center", "Latitude_of_center"],
1136
- ["lat0", "latitude_of_center", z],
1137
- ["longitude_of_center", "Longitude_Of_Center"],
1138
- ["longitude_of_center", "Longitude_of_center"],
1139
- ["longc", "longitude_of_center", z],
1140
- ["x0", "false_easting", h],
1141
- ["y0", "false_northing", h],
1142
- ["long0", "central_meridian", z],
1143
- ["lat0", "latitude_of_origin", z],
1144
- ["lat0", "standard_parallel_1", z],
1145
- ["lat1", "standard_parallel_1", z],
1146
- ["lat2", "standard_parallel_2", z],
1147
- ["azimuth", "Azimuth"],
1148
- ["alpha", "azimuth", z],
1149
- ["srsCode", "name"]
1150
- ];
1151
- f.forEach(o), Ka(t);
1152
- }
1153
- function Za(t) {
1154
- if (typeof t == "object")
1155
- return $t(t);
1156
- const a = is(t);
1157
- var i = ns(t);
1158
- if (a === "WKT2") {
1159
- const r = as(i);
1160
- return $t(r);
1161
- }
1162
- var s = i[0], e = {};
1163
- return ot(i, e), Ya(e), e[s];
1164
- }
1165
- function B(t) {
1166
- var a = this;
1167
- if (arguments.length === 2) {
1168
- var i = arguments[1];
1169
- typeof i == "string" ? i.charAt(0) === "+" ? B[t] = ia(arguments[1]) : B[t] = Za(arguments[1]) : B[t] = i;
1170
- } else if (arguments.length === 1) {
1171
- if (Array.isArray(t))
1172
- return t.map(function(s) {
1173
- Array.isArray(s) ? B.apply(a, s) : B(s);
1174
- });
1175
- if (typeof t == "string") {
1176
- if (t in B)
1177
- return B[t];
1178
- } else "EPSG" in t ? B["EPSG:" + t.EPSG] = t : "ESRI" in t ? B["ESRI:" + t.ESRI] = t : "IAU2000" in t ? B["IAU2000:" + t.IAU2000] = t : console.log(t);
1179
- return;
1180
- }
1181
- }
1182
- Wi(B);
1183
- function cs(t) {
1184
- return typeof t == "string";
1185
- }
1186
- function us(t) {
1187
- return t in B;
1188
- }
1189
- var ds = ["PROJECTEDCRS", "PROJCRS", "GEOGCS", "GEOCCS", "PROJCS", "LOCAL_CS", "GEODCRS", "GEODETICCRS", "GEODETICDATUM", "ENGCRS", "ENGINEERINGCRS"];
1190
- function Ms(t) {
1191
- return ds.some(function(a) {
1192
- return t.indexOf(a) > -1;
1193
- });
1194
- }
1195
- var vs = ["3857", "900913", "3785", "102113"];
1196
- function ms(t) {
1197
- var a = tt(t, "authority");
1198
- if (a) {
1199
- var i = tt(a, "epsg");
1200
- return i && vs.indexOf(i) > -1;
1201
- }
1202
- }
1203
- function ys(t) {
1204
- var a = tt(t, "extension");
1205
- if (a)
1206
- return tt(a, "proj4");
1207
- }
1208
- function _s(t) {
1209
- return t[0] === "+";
1210
- }
1211
- function gs(t) {
1212
- if (cs(t)) {
1213
- if (us(t))
1214
- return B[t];
1215
- if (Ms(t)) {
1216
- var a = Za(t);
1217
- if (ms(a))
1218
- return B["EPSG:3857"];
1219
- var i = ys(a);
1220
- return i ? ia(i) : a;
1221
- }
1222
- if (_s(t))
1223
- return ia(t);
1224
- } else
1225
- return t;
1226
- }
1227
- function Ea(t, a) {
1228
- t = t || {};
1229
- var i, s;
1230
- if (!a)
1231
- return t;
1232
- for (s in a)
1233
- i = a[s], i !== void 0 && (t[s] = i);
1234
- return t;
1235
- }
1236
- function V(t, a, i) {
1237
- var s = t * a;
1238
- return i / Math.sqrt(1 - s * s);
1239
- }
1240
- function pt(t) {
1241
- return t < 0 ? -1 : 1;
1242
- }
1243
- function g(t) {
1244
- return Math.abs(t) <= O ? t : t - pt(t) * aa;
1245
- }
1246
- function W(t, a, i) {
1247
- var s = t * i, e = 0.5 * t;
1248
- return s = Math.pow((1 - s) / (1 + s), e), Math.tan(0.5 * (v - a)) / s;
1249
- }
1250
- function xt(t, a) {
1251
- for (var i = 0.5 * t, s, e, r = v - 2 * Math.atan(a), n = 0; n <= 15; n++)
1252
- if (s = t * Math.sin(r), e = v - 2 * Math.atan(a * Math.pow((1 - s) / (1 + s), i)) - r, r += e, Math.abs(e) <= 1e-10)
1253
- return r;
1254
- return -9999;
1255
- }
1256
- function bs() {
1257
- var t = this.b / this.a;
1258
- this.es = 1 - t * t, "x0" in this || (this.x0 = 0), "y0" in this || (this.y0 = 0), this.e = Math.sqrt(this.es), this.lat_ts ? this.sphere ? this.k0 = Math.cos(this.lat_ts) : this.k0 = V(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) : this.k0 || (this.k ? this.k0 = this.k : this.k0 = 1);
1259
- }
1260
- function Es(t) {
1261
- var a = t.x, i = t.y;
1262
- if (i * Y > 90 && i * Y < -90 && a * Y > 180 && a * Y < -180)
1263
- return null;
1264
- var s, e;
1265
- if (Math.abs(Math.abs(i) - v) <= _)
1266
- return null;
1267
- if (this.sphere)
1268
- s = this.x0 + this.a * this.k0 * g(a - this.long0), e = this.y0 + this.a * this.k0 * Math.log(Math.tan(w + 0.5 * i));
1269
- else {
1270
- var r = Math.sin(i), n = W(this.e, i, r);
1271
- s = this.x0 + this.a * this.k0 * g(a - this.long0), e = this.y0 - this.a * this.k0 * Math.log(n);
1272
- }
1273
- return t.x = s, t.y = e, t;
1274
- }
1275
- function xs(t) {
1276
- var a = t.x - this.x0, i = t.y - this.y0, s, e;
1277
- if (this.sphere)
1278
- e = v - 2 * Math.atan(Math.exp(-i / (this.a * this.k0)));
1279
- else {
1280
- var r = Math.exp(-i / (this.a * this.k0));
1281
- if (e = xt(this.e, r), e === -9999)
1282
- return null;
1283
- }
1284
- return s = g(this.long0 + a / (this.a * this.k0)), t.x = s, t.y = e, t;
1285
- }
1286
- var ps = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
1287
- const As = {
1288
- init: bs,
1289
- forward: Es,
1290
- inverse: xs,
1291
- names: ps
1292
- };
1293
- function Rs() {
1294
- }
1295
- function xa(t) {
1296
- return t;
1297
- }
1298
- var Is = ["longlat", "identity"];
1299
- const ws = {
1300
- init: Rs,
1301
- forward: xa,
1302
- inverse: xa,
1303
- names: Is
1304
- };
1305
- var Ss = [As, ws], Lt = {}, Ut = [];
1306
- function ti(t, a) {
1307
- var i = Ut.length;
1308
- return t.names ? (Ut[i] = t, t.names.forEach(function(s) {
1309
- Lt[s.toLowerCase()] = i;
1310
- }), this) : (console.log(a), !0);
1311
- }
1312
- function Ns(t) {
1313
- if (!t)
1314
- return !1;
1315
- var a = t.toLowerCase();
1316
- if (typeof Lt[a] < "u" && Ut[Lt[a]])
1317
- return Ut[Lt[a]];
1318
- }
1319
- function Cs() {
1320
- Ss.forEach(ti);
1321
- }
1322
- const Ps = {
1323
- start: Cs,
1324
- add: ti,
1325
- get: Ns
1326
- };
1327
- var E = {};
1328
- E.MERIT = {
1329
- a: 6378137,
1330
- rf: 298.257,
1331
- ellipseName: "MERIT 1983"
1332
- };
1333
- E.SGS85 = {
1334
- a: 6378136,
1335
- rf: 298.257,
1336
- ellipseName: "Soviet Geodetic System 85"
1337
- };
1338
- E.GRS80 = {
1339
- a: 6378137,
1340
- rf: 298.257222101,
1341
- ellipseName: "GRS 1980(IUGG, 1980)"
1342
- };
1343
- E.IAU76 = {
1344
- a: 6378140,
1345
- rf: 298.257,
1346
- ellipseName: "IAU 1976"
1347
- };
1348
- E.airy = {
1349
- a: 6377563396e-3,
1350
- b: 635625691e-2,
1351
- ellipseName: "Airy 1830"
1352
- };
1353
- E.APL4 = {
1354
- a: 6378137,
1355
- rf: 298.25,
1356
- ellipseName: "Appl. Physics. 1965"
1357
- };
1358
- E.NWL9D = {
1359
- a: 6378145,
1360
- rf: 298.25,
1361
- ellipseName: "Naval Weapons Lab., 1965"
1362
- };
1363
- E.mod_airy = {
1364
- a: 6377340189e-3,
1365
- b: 6356034446e-3,
1366
- ellipseName: "Modified Airy"
1367
- };
1368
- E.andrae = {
1369
- a: 637710443e-2,
1370
- rf: 300,
1371
- ellipseName: "Andrae 1876 (Den., Iclnd.)"
1372
- };
1373
- E.aust_SA = {
1374
- a: 6378160,
1375
- rf: 298.25,
1376
- ellipseName: "Australian Natl & S. Amer. 1969"
1377
- };
1378
- E.GRS67 = {
1379
- a: 6378160,
1380
- rf: 298.247167427,
1381
- ellipseName: "GRS 67(IUGG 1967)"
1382
- };
1383
- E.bessel = {
1384
- a: 6377397155e-3,
1385
- rf: 299.1528128,
1386
- ellipseName: "Bessel 1841"
1387
- };
1388
- E.bess_nam = {
1389
- a: 6377483865e-3,
1390
- rf: 299.1528128,
1391
- ellipseName: "Bessel 1841 (Namibia)"
1392
- };
1393
- E.clrk66 = {
1394
- a: 63782064e-1,
1395
- b: 63565838e-1,
1396
- ellipseName: "Clarke 1866"
1397
- };
1398
- E.clrk80 = {
1399
- a: 6378249145e-3,
1400
- rf: 293.4663,
1401
- ellipseName: "Clarke 1880 mod."
1402
- };
1403
- E.clrk58 = {
1404
- a: 6378293645208759e-9,
1405
- rf: 294.2606763692654,
1406
- ellipseName: "Clarke 1858"
1407
- };
1408
- E.CPM = {
1409
- a: 63757387e-1,
1410
- rf: 334.29,
1411
- ellipseName: "Comm. des Poids et Mesures 1799"
1412
- };
1413
- E.delmbr = {
1414
- a: 6376428,
1415
- rf: 311.5,
1416
- ellipseName: "Delambre 1810 (Belgium)"
1417
- };
1418
- E.engelis = {
1419
- a: 637813605e-2,
1420
- rf: 298.2566,
1421
- ellipseName: "Engelis 1985"
1422
- };
1423
- E.evrst30 = {
1424
- a: 6377276345e-3,
1425
- rf: 300.8017,
1426
- ellipseName: "Everest 1830"
1427
- };
1428
- E.evrst48 = {
1429
- a: 6377304063e-3,
1430
- rf: 300.8017,
1431
- ellipseName: "Everest 1948"
1432
- };
1433
- E.evrst56 = {
1434
- a: 6377301243e-3,
1435
- rf: 300.8017,
1436
- ellipseName: "Everest 1956"
1437
- };
1438
- E.evrst69 = {
1439
- a: 6377295664e-3,
1440
- rf: 300.8017,
1441
- ellipseName: "Everest 1969"
1442
- };
1443
- E.evrstSS = {
1444
- a: 6377298556e-3,
1445
- rf: 300.8017,
1446
- ellipseName: "Everest (Sabah & Sarawak)"
1447
- };
1448
- E.fschr60 = {
1449
- a: 6378166,
1450
- rf: 298.3,
1451
- ellipseName: "Fischer (Mercury Datum) 1960"
1452
- };
1453
- E.fschr60m = {
1454
- a: 6378155,
1455
- rf: 298.3,
1456
- ellipseName: "Fischer 1960"
1457
- };
1458
- E.fschr68 = {
1459
- a: 6378150,
1460
- rf: 298.3,
1461
- ellipseName: "Fischer 1968"
1462
- };
1463
- E.helmert = {
1464
- a: 6378200,
1465
- rf: 298.3,
1466
- ellipseName: "Helmert 1906"
1467
- };
1468
- E.hough = {
1469
- a: 6378270,
1470
- rf: 297,
1471
- ellipseName: "Hough"
1472
- };
1473
- E.intl = {
1474
- a: 6378388,
1475
- rf: 297,
1476
- ellipseName: "International 1909 (Hayford)"
1477
- };
1478
- E.kaula = {
1479
- a: 6378163,
1480
- rf: 298.24,
1481
- ellipseName: "Kaula 1961"
1482
- };
1483
- E.lerch = {
1484
- a: 6378139,
1485
- rf: 298.257,
1486
- ellipseName: "Lerch 1979"
1487
- };
1488
- E.mprts = {
1489
- a: 6397300,
1490
- rf: 191,
1491
- ellipseName: "Maupertius 1738"
1492
- };
1493
- E.new_intl = {
1494
- a: 63781575e-1,
1495
- b: 63567722e-1,
1496
- ellipseName: "New International 1967"
1497
- };
1498
- E.plessis = {
1499
- a: 6376523,
1500
- rf: 6355863,
1501
- ellipseName: "Plessis 1817 (France)"
1502
- };
1503
- E.krass = {
1504
- a: 6378245,
1505
- rf: 298.3,
1506
- ellipseName: "Krassovsky, 1942"
1507
- };
1508
- E.SEasia = {
1509
- a: 6378155,
1510
- b: 63567733205e-4,
1511
- ellipseName: "Southeast Asia"
1512
- };
1513
- E.walbeck = {
1514
- a: 6376896,
1515
- b: 63558348467e-4,
1516
- ellipseName: "Walbeck"
1517
- };
1518
- E.WGS60 = {
1519
- a: 6378165,
1520
- rf: 298.3,
1521
- ellipseName: "WGS 60"
1522
- };
1523
- E.WGS66 = {
1524
- a: 6378145,
1525
- rf: 298.25,
1526
- ellipseName: "WGS 66"
1527
- };
1528
- E.WGS7 = {
1529
- a: 6378135,
1530
- rf: 298.26,
1531
- ellipseName: "WGS 72"
1532
- };
1533
- var Os = E.WGS84 = {
1534
- a: 6378137,
1535
- rf: 298.257223563,
1536
- ellipseName: "WGS 84"
1537
- };
1538
- E.sphere = {
1539
- a: 6370997,
1540
- b: 6370997,
1541
- ellipseName: "Normal Sphere (r=6370997)"
1542
- };
1543
- function Ts(t, a, i, s) {
1544
- var e = t * t, r = a * a, n = (e - r) / e, h = 0;
1545
- s ? (t *= 1 - n * (Qi + n * (Ji + n * Vi)), e = t * t, n = 0) : h = Math.sqrt(n);
1546
- var o = (e - r) / r;
1547
- return {
1548
- es: n,
1549
- e: h,
1550
- ep2: o
1551
- };
1552
- }
1553
- function Ls(t, a, i, s, e) {
1554
- if (!t) {
1555
- var r = tt(E, s);
1556
- r || (r = Os), t = r.a, a = r.b, i = r.rf;
1557
- }
1558
- return i && !a && (a = (1 - 1 / i) * t), (i === 0 || Math.abs(t - a) < _) && (e = !0, a = t), {
1559
- a: t,
1560
- b: a,
1561
- rf: i,
1562
- sphere: e
1563
- };
1564
- }
1565
- var L = {};
1566
- L.wgs84 = {
1567
- towgs84: "0,0,0",
1568
- ellipse: "WGS84",
1569
- datumName: "WGS84"
1570
- };
1571
- L.ch1903 = {
1572
- towgs84: "674.374,15.056,405.346",
1573
- ellipse: "bessel",
1574
- datumName: "swiss"
1575
- };
1576
- L.ggrs87 = {
1577
- towgs84: "-199.87,74.79,246.62",
1578
- ellipse: "GRS80",
1579
- datumName: "Greek_Geodetic_Reference_System_1987"
1580
- };
1581
- L.nad83 = {
1582
- towgs84: "0,0,0",
1583
- ellipse: "GRS80",
1584
- datumName: "North_American_Datum_1983"
1585
- };
1586
- L.nad27 = {
1587
- nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
1588
- ellipse: "clrk66",
1589
- datumName: "North_American_Datum_1927"
1590
- };
1591
- L.potsdam = {
1592
- towgs84: "606.0,23.0,413.0",
1593
- ellipse: "bessel",
1594
- datumName: "Potsdam Rauenberg 1950 DHDN"
1595
- };
1596
- L.carthage = {
1597
- towgs84: "-263.0,6.0,431.0",
1598
- ellipse: "clark80",
1599
- datumName: "Carthage 1934 Tunisia"
1600
- };
1601
- L.hermannskogel = {
1602
- towgs84: "653.0,-212.0,449.0",
1603
- ellipse: "bessel",
1604
- datumName: "Hermannskogel"
1605
- };
1606
- L.osni52 = {
1607
- towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
1608
- ellipse: "airy",
1609
- datumName: "Irish National"
1610
- };
1611
- L.ire65 = {
1612
- towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
1613
- ellipse: "mod_airy",
1614
- datumName: "Ireland 1965"
1615
- };
1616
- L.rassadiran = {
1617
- towgs84: "-133.63,-157.5,-158.62",
1618
- ellipse: "intl",
1619
- datumName: "Rassadiran"
1620
- };
1621
- L.nzgd49 = {
1622
- towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
1623
- ellipse: "intl",
1624
- datumName: "New Zealand Geodetic Datum 1949"
1625
- };
1626
- L.osgb36 = {
1627
- towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
1628
- ellipse: "airy",
1629
- datumName: "Airy 1830"
1630
- };
1631
- L.s_jtsk = {
1632
- towgs84: "589,76,480",
1633
- ellipse: "bessel",
1634
- datumName: "S-JTSK (Ferro)"
1635
- };
1636
- L.beduaram = {
1637
- towgs84: "-106,-87,188",
1638
- ellipse: "clrk80",
1639
- datumName: "Beduaram"
1640
- };
1641
- L.gunung_segara = {
1642
- towgs84: "-403,684,41",
1643
- ellipse: "bessel",
1644
- datumName: "Gunung Segara Jakarta"
1645
- };
1646
- L.rnb72 = {
1647
- towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
1648
- ellipse: "intl",
1649
- datumName: "Reseau National Belge 1972"
1650
- };
1651
- function Ds(t, a, i, s, e, r) {
1652
- var n = {};
1653
- return t === void 0 || t === "none" ? n.datum_type = ta : n.datum_type = Xi, a && (n.datum_params = a.map(parseFloat), (n.datum_params[0] !== 0 || n.datum_params[1] !== 0 || n.datum_params[2] !== 0) && (n.datum_type = rt), n.datum_params.length > 3 && (n.datum_params[3] !== 0 || n.datum_params[4] !== 0 || n.datum_params[5] !== 0 || n.datum_params[6] !== 0) && (n.datum_type = nt, n.datum_params[3] *= gt, n.datum_params[4] *= gt, n.datum_params[5] *= gt, n.datum_params[6] = n.datum_params[6] / 1e6 + 1)), n.a = i, n.b = s, n.es = e, n.ep2 = r, n;
1654
- }
1655
- function J(t, a) {
1656
- if (!(this instanceof J))
1657
- return new J(t);
1658
- a = a || function(o) {
1659
- if (o)
1660
- throw o;
1661
- };
1662
- var i = gs(t);
1663
- if (typeof i != "object") {
1664
- a(t);
1665
- return;
1666
- }
1667
- var s = J.projections.get(i.projName);
1668
- if (!s) {
1669
- a(t);
1670
- return;
1671
- }
1672
- if (i.datumCode && i.datumCode !== "none") {
1673
- var e = tt(L, i.datumCode);
1674
- e && (i.datum_params = e.towgs84 ? e.towgs84.split(",") : null, i.ellps = e.ellipse, i.datumName = e.datumName ? e.datumName : i.datumCode);
1675
- }
1676
- i.k0 = i.k0 || 1, i.axis = i.axis || "enu", i.ellps = i.ellps || "wgs84";
1677
- var r = Ls(i.a, i.b, i.rf, i.ellps, i.sphere), n = Ts(r.a, r.b, r.rf, i.R_A), h = i.datum || Ds(i.datumCode, i.datum_params, r.a, r.b, n.es, n.ep2);
1678
- Ea(this, i), Ea(this, s), this.a = r.a, this.b = r.b, this.rf = r.rf, this.sphere = r.sphere, this.es = n.es, this.e = n.e, this.ep2 = n.ep2, this.datum = h, this.init(), a(null, this);
1679
- }
1680
- J.projections = Ps;
1681
- J.projections.start();
1682
- function Bs(t, a) {
1683
- return t.datum_type !== a.datum_type || t.a !== a.a || Math.abs(t.es - a.es) > 5e-11 ? !1 : t.datum_type === rt ? t.datum_params[0] === a.datum_params[0] && t.datum_params[1] === a.datum_params[1] && t.datum_params[2] === a.datum_params[2] : t.datum_type === nt ? t.datum_params[0] === a.datum_params[0] && t.datum_params[1] === a.datum_params[1] && t.datum_params[2] === a.datum_params[2] && t.datum_params[3] === a.datum_params[3] && t.datum_params[4] === a.datum_params[4] && t.datum_params[5] === a.datum_params[5] && t.datum_params[6] === a.datum_params[6] : !0;
1684
- }
1685
- function ai(t, a, i) {
1686
- var s = t.x, e = t.y, r = t.z ? t.z : 0, n, h, o, f;
1687
- if (e < -v && e > -1.001 * v)
1688
- e = -v;
1689
- else if (e > v && e < 1.001 * v)
1690
- e = v;
1691
- else {
1692
- if (e < -v)
1693
- return { x: -1 / 0, y: -1 / 0, z: t.z };
1694
- if (e > v)
1695
- return { x: 1 / 0, y: 1 / 0, z: t.z };
1696
- }
1697
- return s > Math.PI && (s -= 2 * Math.PI), h = Math.sin(e), f = Math.cos(e), o = h * h, n = i / Math.sqrt(1 - a * o), {
1698
- x: (n + r) * f * Math.cos(s),
1699
- y: (n + r) * f * Math.sin(s),
1700
- z: (n * (1 - a) + r) * h
1701
- };
1702
- }
1703
- function ii(t, a, i, s) {
1704
- var e = 1e-12, r = e * e, n = 30, h, o, f, u, c, l, d, M, m, y, b, x, p, S = t.x, A = t.y, R = t.z ? t.z : 0, T, P, X;
1705
- if (h = Math.sqrt(S * S + A * A), o = Math.sqrt(S * S + A * A + R * R), h / i < e) {
1706
- if (T = 0, o / i < e)
1707
- return P = v, X = -s, {
1708
- x: t.x,
1709
- y: t.y,
1710
- z: t.z
1711
- };
1712
- } else
1713
- T = Math.atan2(A, S);
1714
- f = R / o, u = h / o, c = 1 / Math.sqrt(1 - a * (2 - a) * u * u), M = u * (1 - a) * c, m = f * c, p = 0;
1715
- do
1716
- p++, d = i / Math.sqrt(1 - a * m * m), X = h * M + R * m - d * (1 - a * m * m), l = a * d / (d + X), c = 1 / Math.sqrt(1 - l * (2 - l) * u * u), y = u * (1 - l) * c, b = f * c, x = b * M - y * m, M = y, m = b;
1717
- while (x * x > r && p < n);
1718
- return P = Math.atan(b / Math.abs(y)), {
1719
- x: T,
1720
- y: P,
1721
- z: X
1722
- };
1723
- }
1724
- function Gs(t, a, i) {
1725
- if (a === rt)
1726
- return {
1727
- x: t.x + i[0],
1728
- y: t.y + i[1],
1729
- z: t.z + i[2]
1730
- };
1731
- if (a === nt) {
1732
- var s = i[0], e = i[1], r = i[2], n = i[3], h = i[4], o = i[5], f = i[6];
1733
- return {
1734
- x: f * (t.x - o * t.y + h * t.z) + s,
1735
- y: f * (o * t.x + t.y - n * t.z) + e,
1736
- z: f * (-h * t.x + n * t.y + t.z) + r
1737
- };
1738
- }
1739
- }
1740
- function $s(t, a, i) {
1741
- if (a === rt)
1742
- return {
1743
- x: t.x - i[0],
1744
- y: t.y - i[1],
1745
- z: t.z - i[2]
1746
- };
1747
- if (a === nt) {
1748
- var s = i[0], e = i[1], r = i[2], n = i[3], h = i[4], o = i[5], f = i[6], u = (t.x - s) / f, c = (t.y - e) / f, l = (t.z - r) / f;
1749
- return {
1750
- x: u + o * c - h * l,
1751
- y: -o * u + c + n * l,
1752
- z: h * u - n * c + l
1753
- };
1754
- }
1755
- }
1756
- function Ct(t) {
1757
- return t === rt || t === nt;
1758
- }
1759
- function Us(t, a, i) {
1760
- return Bs(t, a) || t.datum_type === ta || a.datum_type === ta || t.es === a.es && t.a === a.a && !Ct(t.datum_type) && !Ct(a.datum_type) ? i : (i = ai(i, t.es, t.a), Ct(t.datum_type) && (i = Gs(i, t.datum_type, t.datum_params)), Ct(a.datum_type) && (i = $s(i, a.datum_type, a.datum_params)), ii(i, a.es, a.a, a.b));
1761
- }
1762
- function pa(t, a, i) {
1763
- var s = i.x, e = i.y, r = i.z || 0, n, h, o, f = {};
1764
- for (o = 0; o < 3; o++)
1765
- if (!(a && o === 2 && i.z === void 0))
1766
- switch (o === 0 ? (n = s, "ew".indexOf(t.axis[o]) !== -1 ? h = "x" : h = "y") : o === 1 ? (n = e, "ns".indexOf(t.axis[o]) !== -1 ? h = "y" : h = "x") : (n = r, h = "z"), t.axis[o]) {
1767
- case "e":
1768
- case "w":
1769
- case "n":
1770
- case "s":
1771
- f[h] = n;
1772
- break;
1773
- case "u":
1774
- i[h] !== void 0 && (f.z = n);
1775
- break;
1776
- case "d":
1777
- i[h] !== void 0 && (f.z = -n);
1778
- break;
1779
- default:
1780
- return null;
1781
- }
1782
- return f;
1783
- }
1784
- function si(t) {
1785
- var a = {
1786
- x: t[0],
1787
- y: t[1]
1788
- };
1789
- return t.length > 2 && (a.z = t[2]), t.length > 3 && (a.m = t[3]), a;
1790
- }
1791
- function Fs(t) {
1792
- Aa(t.x), Aa(t.y);
1793
- }
1794
- function Aa(t) {
1795
- if (typeof Number.isFinite == "function") {
1796
- if (Number.isFinite(t))
1797
- return;
1798
- throw new TypeError("coordinates must be finite numbers");
1799
- }
1800
- if (typeof t != "number" || t !== t || !isFinite(t))
1801
- throw new TypeError("coordinates must be finite numbers");
1802
- }
1803
- function qs(t, a) {
1804
- return (t.datum.datum_type === rt || t.datum.datum_type === nt) && a.datumCode !== "WGS84" || (a.datum.datum_type === rt || a.datum.datum_type === nt) && t.datumCode !== "WGS84";
1805
- }
1806
- function Ft(t, a, i) {
1807
- var s;
1808
- if (Array.isArray(i) && (i = si(i)), Fs(i), t.datum && a.datum && qs(t, a) && (s = new J("WGS84"), i = Ft(t, s, i), t = s), t.axis !== "enu" && (i = pa(t, !1, i)), t.projName === "longlat")
1809
- i = {
1810
- x: i.x * D,
1811
- y: i.y * D,
1812
- z: i.z || 0
1813
- };
1814
- else if (t.to_meter && (i = {
1815
- x: i.x * t.to_meter,
1816
- y: i.y * t.to_meter,
1817
- z: i.z || 0
1818
- }), i = t.inverse(i), !i)
1819
- return;
1820
- return t.from_greenwich && (i.x += t.from_greenwich), i = Us(t.datum, a.datum, i), a.from_greenwich && (i = {
1821
- x: i.x - a.from_greenwich,
1822
- y: i.y,
1823
- z: i.z || 0
1824
- }), a.projName === "longlat" ? i = {
1825
- x: i.x * Y,
1826
- y: i.y * Y,
1827
- z: i.z || 0
1828
- } : (i = a.forward(i), a.to_meter && (i = {
1829
- x: i.x / a.to_meter,
1830
- y: i.y / a.to_meter,
1831
- z: i.z || 0
1832
- })), a.axis !== "enu" ? pa(a, !0, i) : i;
1833
- }
1834
- var Ra = J("WGS84");
1835
- function Jt(t, a, i) {
1836
- var s, e, r;
1837
- return Array.isArray(i) ? (s = Ft(t, a, i) || { x: NaN, y: NaN }, i.length > 2 ? typeof t.name < "u" && t.name === "geocent" || typeof a.name < "u" && a.name === "geocent" ? typeof s.z == "number" ? [s.x, s.y, s.z].concat(i.splice(3)) : [s.x, s.y, i[2]].concat(i.splice(3)) : [s.x, s.y].concat(i.splice(2)) : [s.x, s.y]) : (e = Ft(t, a, i), r = Object.keys(i), r.length === 2 || r.forEach(function(n) {
1838
- if (typeof t.name < "u" && t.name === "geocent" || typeof a.name < "u" && a.name === "geocent") {
1839
- if (n === "x" || n === "y" || n === "z")
1840
- return;
1841
- } else if (n === "x" || n === "y")
1842
- return;
1843
- e[n] = i[n];
1844
- }), e);
1845
- }
1846
- function Ia(t) {
1847
- return t instanceof J ? t : t.oProj ? t.oProj : J(t);
1848
- }
1849
- function k(t, a, i) {
1850
- t = Ia(t);
1851
- var s = !1, e;
1852
- return typeof a > "u" ? (a = t, t = Ra, s = !0) : (typeof a.x < "u" || Array.isArray(a)) && (i = a, a = t, t = Ra, s = !0), a = Ia(a), i ? Jt(t, a, i) : (e = {
1853
- forward: function(r) {
1854
- return Jt(t, a, r);
1855
- },
1856
- inverse: function(r) {
1857
- return Jt(a, t, r);
1858
- }
1859
- }, s && (e.oProj = a), e);
1860
- }
1861
- var wa = 6, ei = "AJSAJS", ri = "AFAFAF", lt = 65, F = 73, H = 79, mt = 86, yt = 90;
1862
- const ks = {
1863
- forward: ni,
1864
- inverse: zs,
1865
- toPoint: hi
1866
- };
1867
- function ni(t, a) {
1868
- return a = a || 5, Ws(Hs({
1869
- lat: t[1],
1870
- lon: t[0]
1871
- }), a);
1872
- }
1873
- function zs(t) {
1874
- var a = na(li(t.toUpperCase()));
1875
- return a.lat && a.lon ? [a.lon, a.lat, a.lon, a.lat] : [a.left, a.bottom, a.right, a.top];
1876
- }
1877
- function hi(t) {
1878
- var a = na(li(t.toUpperCase()));
1879
- return a.lat && a.lon ? [a.lon, a.lat] : [(a.left + a.right) / 2, (a.top + a.bottom) / 2];
1880
- }
1881
- function Vt(t) {
1882
- return t * (Math.PI / 180);
1883
- }
1884
- function Sa(t) {
1885
- return 180 * (t / Math.PI);
1886
- }
1887
- function Hs(t) {
1888
- var a = t.lat, i = t.lon, s = 6378137, e = 669438e-8, r = 0.9996, n, h, o, f, u, c, l, d = Vt(a), M = Vt(i), m, y;
1889
- y = Math.floor((i + 180) / 6) + 1, i === 180 && (y = 60), a >= 56 && a < 64 && i >= 3 && i < 12 && (y = 32), a >= 72 && a < 84 && (i >= 0 && i < 9 ? y = 31 : i >= 9 && i < 21 ? y = 33 : i >= 21 && i < 33 ? y = 35 : i >= 33 && i < 42 && (y = 37)), n = (y - 1) * 6 - 180 + 3, m = Vt(n), h = e / (1 - e), o = s / Math.sqrt(1 - e * Math.sin(d) * Math.sin(d)), f = Math.tan(d) * Math.tan(d), u = h * Math.cos(d) * Math.cos(d), c = Math.cos(d) * (M - m), l = s * ((1 - e / 4 - 3 * e * e / 64 - 5 * e * e * e / 256) * d - (3 * e / 8 + 3 * e * e / 32 + 45 * e * e * e / 1024) * Math.sin(2 * d) + (15 * e * e / 256 + 45 * e * e * e / 1024) * Math.sin(4 * d) - 35 * e * e * e / 3072 * Math.sin(6 * d));
1890
- var b = r * o * (c + (1 - f + u) * c * c * c / 6 + (5 - 18 * f + f * f + 72 * u - 58 * h) * c * c * c * c * c / 120) + 5e5, x = r * (l + o * Math.tan(d) * (c * c / 2 + (5 - f + 9 * u + 4 * u * u) * c * c * c * c / 24 + (61 - 58 * f + f * f + 600 * u - 330 * h) * c * c * c * c * c * c / 720));
1891
- return a < 0 && (x += 1e7), {
1892
- northing: Math.round(x),
1893
- easting: Math.round(b),
1894
- zoneNumber: y,
1895
- zoneLetter: js(a)
1896
- };
1897
- }
1898
- function na(t) {
1899
- var a = t.northing, i = t.easting, s = t.zoneLetter, e = t.zoneNumber;
1900
- if (e < 0 || e > 60)
1901
- return null;
1902
- var r = 0.9996, n = 6378137, h = 669438e-8, o, f = (1 - Math.sqrt(1 - h)) / (1 + Math.sqrt(1 - h)), u, c, l, d, M, m, y, b, x, p = i - 5e5, S = a;
1903
- s < "N" && (S -= 1e7), y = (e - 1) * 6 - 180 + 3, o = h / (1 - h), m = S / r, b = m / (n * (1 - h / 4 - 3 * h * h / 64 - 5 * h * h * h / 256)), x = b + (3 * f / 2 - 27 * f * f * f / 32) * Math.sin(2 * b) + (21 * f * f / 16 - 55 * f * f * f * f / 32) * Math.sin(4 * b) + 151 * f * f * f / 96 * Math.sin(6 * b), u = n / Math.sqrt(1 - h * Math.sin(x) * Math.sin(x)), c = Math.tan(x) * Math.tan(x), l = o * Math.cos(x) * Math.cos(x), d = n * (1 - h) / Math.pow(1 - h * Math.sin(x) * Math.sin(x), 1.5), M = p / (u * r);
1904
- var A = x - u * Math.tan(x) / d * (M * M / 2 - (5 + 3 * c + 10 * l - 4 * l * l - 9 * o) * M * M * M * M / 24 + (61 + 90 * c + 298 * l + 45 * c * c - 252 * o - 3 * l * l) * M * M * M * M * M * M / 720);
1905
- A = Sa(A);
1906
- var R = (M - (1 + 2 * c + l) * M * M * M / 6 + (5 - 2 * l + 28 * c - 3 * l * l + 8 * o + 24 * c * c) * M * M * M * M * M / 120) / Math.cos(x);
1907
- R = y + Sa(R);
1908
- var T;
1909
- if (t.accuracy) {
1910
- var P = na({
1911
- northing: t.northing + t.accuracy,
1912
- easting: t.easting + t.accuracy,
1913
- zoneLetter: t.zoneLetter,
1914
- zoneNumber: t.zoneNumber
1915
- });
1916
- T = {
1917
- top: P.lat,
1918
- right: P.lon,
1919
- bottom: A,
1920
- left: R
1921
- };
1922
- } else
1923
- T = {
1924
- lat: A,
1925
- lon: R
1926
- };
1927
- return T;
1928
- }
1929
- function js(t) {
1930
- var a = "Z";
1931
- return 84 >= t && t >= 72 ? a = "X" : 72 > t && t >= 64 ? a = "W" : 64 > t && t >= 56 ? a = "V" : 56 > t && t >= 48 ? a = "U" : 48 > t && t >= 40 ? a = "T" : 40 > t && t >= 32 ? a = "S" : 32 > t && t >= 24 ? a = "R" : 24 > t && t >= 16 ? a = "Q" : 16 > t && t >= 8 ? a = "P" : 8 > t && t >= 0 ? a = "N" : 0 > t && t >= -8 ? a = "M" : -8 > t && t >= -16 ? a = "L" : -16 > t && t >= -24 ? a = "K" : -24 > t && t >= -32 ? a = "J" : -32 > t && t >= -40 ? a = "H" : -40 > t && t >= -48 ? a = "G" : -48 > t && t >= -56 ? a = "F" : -56 > t && t >= -64 ? a = "E" : -64 > t && t >= -72 ? a = "D" : -72 > t && t >= -80 && (a = "C"), a;
1932
- }
1933
- function Ws(t, a) {
1934
- var i = "00000" + t.easting, s = "00000" + t.northing;
1935
- return t.zoneNumber + t.zoneLetter + Xs(t.easting, t.northing, t.zoneNumber) + i.substr(i.length - 5, a) + s.substr(s.length - 5, a);
1936
- }
1937
- function Xs(t, a, i) {
1938
- var s = oi(i), e = Math.floor(t / 1e5), r = Math.floor(a / 1e5) % 20;
1939
- return Qs(e, r, s);
1940
- }
1941
- function oi(t) {
1942
- var a = t % wa;
1943
- return a === 0 && (a = wa), a;
1944
- }
1945
- function Qs(t, a, i) {
1946
- var s = i - 1, e = ei.charCodeAt(s), r = ri.charCodeAt(s), n = e + t - 1, h = r + a, o = !1;
1947
- n > yt && (n = n - yt + lt - 1, o = !0), (n === F || e < F && n > F || (n > F || e < F) && o) && n++, (n === H || e < H && n > H || (n > H || e < H) && o) && (n++, n === F && n++), n > yt && (n = n - yt + lt - 1), h > mt ? (h = h - mt + lt - 1, o = !0) : o = !1, (h === F || r < F && h > F || (h > F || r < F) && o) && h++, (h === H || r < H && h > H || (h > H || r < H) && o) && (h++, h === F && h++), h > mt && (h = h - mt + lt - 1);
1948
- var f = String.fromCharCode(n) + String.fromCharCode(h);
1949
- return f;
1950
- }
1951
- function li(t) {
1952
- if (t && t.length === 0)
1953
- throw "MGRSPoint coverting from nothing";
1954
- for (var a = t.length, i = null, s = "", e, r = 0; !/[A-Z]/.test(e = t.charAt(r)); ) {
1955
- if (r >= 2)
1956
- throw "MGRSPoint bad conversion from: " + t;
1957
- s += e, r++;
1958
- }
1959
- var n = parseInt(s, 10);
1960
- if (r === 0 || r + 3 > a)
1961
- throw "MGRSPoint bad conversion from: " + t;
1962
- var h = t.charAt(r++);
1963
- if (h <= "A" || h === "B" || h === "Y" || h >= "Z" || h === "I" || h === "O")
1964
- throw "MGRSPoint zone letter " + h + " not handled: " + t;
1965
- i = t.substring(r, r += 2);
1966
- for (var o = oi(n), f = Js(i.charAt(0), o), u = Vs(i.charAt(1), o); u < Ks(h); )
1967
- u += 2e6;
1968
- var c = a - r;
1969
- if (c % 2 !== 0)
1970
- throw `MGRSPoint has to have an even number
1971
- of digits after the zone letter and two 100km letters - front
1972
- half for easting meters, second half for
1973
- northing meters` + t;
1974
- var l = c / 2, d = 0, M = 0, m, y, b, x, p;
1975
- return l > 0 && (m = 1e5 / Math.pow(10, l), y = t.substring(r, r + l), d = parseFloat(y) * m, b = t.substring(r + l), M = parseFloat(b) * m), x = d + f, p = M + u, {
1976
- easting: x,
1977
- northing: p,
1978
- zoneLetter: h,
1979
- zoneNumber: n,
1980
- accuracy: m
1981
- };
1982
- }
1983
- function Js(t, a) {
1984
- for (var i = ei.charCodeAt(a - 1), s = 1e5, e = !1; i !== t.charCodeAt(0); ) {
1985
- if (i++, i === F && i++, i === H && i++, i > yt) {
1986
- if (e)
1987
- throw "Bad character: " + t;
1988
- i = lt, e = !0;
1989
- }
1990
- s += 1e5;
1991
- }
1992
- return s;
1993
- }
1994
- function Vs(t, a) {
1995
- if (t > "V")
1996
- throw "MGRSPoint given invalid Northing " + t;
1997
- for (var i = ri.charCodeAt(a - 1), s = 0, e = !1; i !== t.charCodeAt(0); ) {
1998
- if (i++, i === F && i++, i === H && i++, i > mt) {
1999
- if (e)
2000
- throw "Bad character: " + t;
2001
- i = lt, e = !0;
2002
- }
2003
- s += 1e5;
2004
- }
2005
- return s;
2006
- }
2007
- function Ks(t) {
2008
- var a;
2009
- switch (t) {
2010
- case "C":
2011
- a = 11e5;
2012
- break;
2013
- case "D":
2014
- a = 2e6;
2015
- break;
2016
- case "E":
2017
- a = 28e5;
2018
- break;
2019
- case "F":
2020
- a = 37e5;
2021
- break;
2022
- case "G":
2023
- a = 46e5;
2024
- break;
2025
- case "H":
2026
- a = 55e5;
2027
- break;
2028
- case "J":
2029
- a = 64e5;
2030
- break;
2031
- case "K":
2032
- a = 73e5;
2033
- break;
2034
- case "L":
2035
- a = 82e5;
2036
- break;
2037
- case "M":
2038
- a = 91e5;
2039
- break;
2040
- case "N":
2041
- a = 0;
2042
- break;
2043
- case "P":
2044
- a = 8e5;
2045
- break;
2046
- case "Q":
2047
- a = 17e5;
2048
- break;
2049
- case "R":
2050
- a = 26e5;
2051
- break;
2052
- case "S":
2053
- a = 35e5;
2054
- break;
2055
- case "T":
2056
- a = 44e5;
2057
- break;
2058
- case "U":
2059
- a = 53e5;
2060
- break;
2061
- case "V":
2062
- a = 62e5;
2063
- break;
2064
- case "W":
2065
- a = 7e6;
2066
- break;
2067
- case "X":
2068
- a = 79e5;
2069
- break;
2070
- default:
2071
- a = -1;
2072
- }
2073
- if (a >= 0)
2074
- return a;
2075
- throw "Invalid zone letter: " + t;
2076
- }
2077
- function ut(t, a, i) {
2078
- if (!(this instanceof ut))
2079
- return new ut(t, a, i);
2080
- if (Array.isArray(t))
2081
- this.x = t[0], this.y = t[1], this.z = t[2] || 0;
2082
- else if (typeof t == "object")
2083
- this.x = t.x, this.y = t.y, this.z = t.z || 0;
2084
- else if (typeof t == "string" && typeof a > "u") {
2085
- var s = t.split(",");
2086
- this.x = parseFloat(s[0], 10), this.y = parseFloat(s[1], 10), this.z = parseFloat(s[2], 10) || 0;
2087
- } else
2088
- this.x = t, this.y = a, this.z = i || 0;
2089
- console.warn("proj4.Point will be removed in version 3, use proj4.toPoint");
2090
- }
2091
- ut.fromMGRS = function(t) {
2092
- return new ut(hi(t));
2093
- };
2094
- ut.prototype.toMGRS = function(t) {
2095
- return ni([this.x, this.y], t);
2096
- };
2097
- var Ys = 1, Zs = 0.25, Na = 0.046875, Ca = 0.01953125, Pa = 0.01068115234375, te = 0.75, ae = 0.46875, ie = 0.013020833333333334, se = 0.007120768229166667, ee = 0.3645833333333333, re = 0.005696614583333333, ne = 0.3076171875;
2098
- function fi(t) {
2099
- var a = [];
2100
- a[0] = Ys - t * (Zs + t * (Na + t * (Ca + t * Pa))), a[1] = t * (te - t * (Na + t * (Ca + t * Pa)));
2101
- var i = t * t;
2102
- return a[2] = i * (ae - t * (ie + t * se)), i *= t, a[3] = i * (ee - t * re), a[4] = i * t * ne, a;
2103
- }
2104
- function jt(t, a, i, s) {
2105
- return i *= a, a *= a, s[0] * t - i * (s[1] + a * (s[2] + a * (s[3] + a * s[4])));
2106
- }
2107
- var he = 20;
2108
- function ci(t, a, i) {
2109
- for (var s = 1 / (1 - a), e = t, r = he; r; --r) {
2110
- var n = Math.sin(e), h = 1 - a * n * n;
2111
- if (h = (jt(e, n, Math.cos(e), i) - t) * (h * Math.sqrt(h)) * s, e -= h, Math.abs(h) < _)
2112
- return e;
2113
- }
2114
- return e;
2115
- }
2116
- function oe() {
2117
- this.x0 = this.x0 !== void 0 ? this.x0 : 0, this.y0 = this.y0 !== void 0 ? this.y0 : 0, this.long0 = this.long0 !== void 0 ? this.long0 : 0, this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0, this.es && (this.en = fi(this.es), this.ml0 = jt(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en));
2118
- }
2119
- function le(t) {
2120
- var a = t.x, i = t.y, s = g(a - this.long0), e, r, n, h = Math.sin(i), o = Math.cos(i);
2121
- if (this.es) {
2122
- var u = o * s, c = Math.pow(u, 2), l = this.ep2 * Math.pow(o, 2), d = Math.pow(l, 2), M = Math.abs(o) > _ ? Math.tan(i) : 0, m = Math.pow(M, 2), y = Math.pow(m, 2);
2123
- e = 1 - this.es * Math.pow(h, 2), u = u / Math.sqrt(e);
2124
- var b = jt(i, h, o, this.en);
2125
- r = this.a * (this.k0 * u * (1 + c / 6 * (1 - m + l + c / 20 * (5 - 18 * m + y + 14 * l - 58 * m * l + c / 42 * (61 + 179 * y - y * m - 479 * m))))) + this.x0, n = this.a * (this.k0 * (b - this.ml0 + h * s * u / 2 * (1 + c / 12 * (5 - m + 9 * l + 4 * d + c / 30 * (61 + y - 58 * m + 270 * l - 330 * m * l + c / 56 * (1385 + 543 * y - y * m - 3111 * m)))))) + this.y0;
2126
- } else {
2127
- var f = o * Math.sin(s);
2128
- if (Math.abs(Math.abs(f) - 1) < _)
2129
- return 93;
2130
- if (r = 0.5 * this.a * this.k0 * Math.log((1 + f) / (1 - f)) + this.x0, n = o * Math.cos(s) / Math.sqrt(1 - Math.pow(f, 2)), f = Math.abs(n), f >= 1) {
2131
- if (f - 1 > _)
2132
- return 93;
2133
- n = 0;
2134
- } else
2135
- n = Math.acos(n);
2136
- i < 0 && (n = -n), n = this.a * this.k0 * (n - this.lat0) + this.y0;
2137
- }
2138
- return t.x = r, t.y = n, t;
2139
- }
2140
- function fe(t) {
2141
- var a, i, s, e, r = (t.x - this.x0) * (1 / this.a), n = (t.y - this.y0) * (1 / this.a);
2142
- if (this.es)
2143
- if (a = this.ml0 + n / this.k0, i = ci(a, this.es, this.en), Math.abs(i) < v) {
2144
- var c = Math.sin(i), l = Math.cos(i), d = Math.abs(l) > _ ? Math.tan(i) : 0, M = this.ep2 * Math.pow(l, 2), m = Math.pow(M, 2), y = Math.pow(d, 2), b = Math.pow(y, 2);
2145
- a = 1 - this.es * Math.pow(c, 2);
2146
- var x = r * Math.sqrt(a) / this.k0, p = Math.pow(x, 2);
2147
- a = a * d, s = i - a * p / (1 - this.es) * 0.5 * (1 - p / 12 * (5 + 3 * y - 9 * M * y + M - 4 * m - p / 30 * (61 + 90 * y - 252 * M * y + 45 * b + 46 * M - p / 56 * (1385 + 3633 * y + 4095 * b + 1574 * b * y)))), e = g(this.long0 + x * (1 - p / 6 * (1 + 2 * y + M - p / 20 * (5 + 28 * y + 24 * b + 8 * M * y + 6 * M - p / 42 * (61 + 662 * y + 1320 * b + 720 * b * y)))) / l);
2148
- } else
2149
- s = v * pt(n), e = 0;
2150
- else {
2151
- var h = Math.exp(r / this.k0), o = 0.5 * (h - 1 / h), f = this.lat0 + n / this.k0, u = Math.cos(f);
2152
- a = Math.sqrt((1 - Math.pow(u, 2)) / (1 + Math.pow(o, 2))), s = Math.asin(a), n < 0 && (s = -s), o === 0 && u === 0 ? e = 0 : e = g(Math.atan2(o, u) + this.long0);
2153
- }
2154
- return t.x = e, t.y = s, t;
2155
- }
2156
- var ce = ["Transverse_Mercator", "Transverse Mercator", "tmerc"];
2157
- const ue = {
2158
- init: oe,
2159
- forward: le,
2160
- inverse: fe,
2161
- names: ce
2162
- };
2163
- function ui(t) {
2164
- var a = Math.exp(t);
2165
- return a = (a - 1 / a) / 2, a;
2166
- }
2167
- function ha(t, a) {
2168
- t = Math.abs(t), a = Math.abs(a);
2169
- var i = Math.max(t, a), s = Math.min(t, a) / (i || 1);
2170
- return i * Math.sqrt(1 + Math.pow(s, 2));
2171
- }
2172
- function de(t) {
2173
- var a = 1 + t, i = a - 1;
2174
- return i === 0 ? t : t * Math.log(a) / i;
2175
- }
2176
- function Me(t) {
2177
- var a = Math.abs(t);
2178
- return a = de(a * (1 + a / (ha(1, a) + 1))), t < 0 ? -a : a;
2179
- }
2180
- function oa(t, a) {
2181
- for (var i = 2 * Math.cos(2 * a), s = t.length - 1, e = t[s], r = 0, n; --s >= 0; )
2182
- n = -r + i * e + t[s], r = e, e = n;
2183
- return a + n * Math.sin(2 * a);
2184
- }
2185
- function ve(t, a) {
2186
- for (var i = 2 * Math.cos(a), s = t.length - 1, e = t[s], r = 0, n; --s >= 0; )
2187
- n = -r + i * e + t[s], r = e, e = n;
2188
- return Math.sin(a) * n;
2189
- }
2190
- function me(t) {
2191
- var a = Math.exp(t);
2192
- return a = (a + 1 / a) / 2, a;
2193
- }
2194
- function di(t, a, i) {
2195
- for (var s = Math.sin(a), e = Math.cos(a), r = ui(i), n = me(i), h = 2 * e * n, o = -2 * s * r, f = t.length - 1, u = t[f], c = 0, l = 0, d = 0, M, m; --f >= 0; )
2196
- M = l, m = c, l = u, c = d, u = -M + h * l - o * c + t[f], d = -m + o * l + h * c;
2197
- return h = s * n, o = e * r, [h * u - o * d, h * d + o * u];
2198
- }
2199
- function ye() {
2200
- if (this.es === void 0 || this.es <= 0)
2201
- throw new Error("incorrect elliptical usage");
2202
- this.x0 = this.x0 !== void 0 ? this.x0 : 0, this.y0 = this.y0 !== void 0 ? this.y0 : 0, this.long0 = this.long0 !== void 0 ? this.long0 : 0, this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0, this.cgb = [], this.cbg = [], this.utg = [], this.gtu = [];
2203
- var t = this.es / (1 + Math.sqrt(1 - this.es)), a = t / (2 - t), i = a;
2204
- this.cgb[0] = a * (2 + a * (-2 / 3 + a * (-2 + a * (116 / 45 + a * (26 / 45 + a * (-2854 / 675)))))), this.cbg[0] = a * (-2 + a * (2 / 3 + a * (4 / 3 + a * (-82 / 45 + a * (32 / 45 + a * (4642 / 4725)))))), i = i * a, this.cgb[1] = i * (7 / 3 + a * (-8 / 5 + a * (-227 / 45 + a * (2704 / 315 + a * (2323 / 945))))), this.cbg[1] = i * (5 / 3 + a * (-16 / 15 + a * (-13 / 9 + a * (904 / 315 + a * (-1522 / 945))))), i = i * a, this.cgb[2] = i * (56 / 15 + a * (-136 / 35 + a * (-1262 / 105 + a * (73814 / 2835)))), this.cbg[2] = i * (-26 / 15 + a * (34 / 21 + a * (8 / 5 + a * (-12686 / 2835)))), i = i * a, this.cgb[3] = i * (4279 / 630 + a * (-332 / 35 + a * (-399572 / 14175))), this.cbg[3] = i * (1237 / 630 + a * (-12 / 5 + a * (-24832 / 14175))), i = i * a, this.cgb[4] = i * (4174 / 315 + a * (-144838 / 6237)), this.cbg[4] = i * (-734 / 315 + a * (109598 / 31185)), i = i * a, this.cgb[5] = i * (601676 / 22275), this.cbg[5] = i * (444337 / 155925), i = Math.pow(a, 2), this.Qn = this.k0 / (1 + a) * (1 + i * (1 / 4 + i * (1 / 64 + i / 256))), this.utg[0] = a * (-0.5 + a * (2 / 3 + a * (-37 / 96 + a * (1 / 360 + a * (81 / 512 + a * (-96199 / 604800)))))), this.gtu[0] = a * (0.5 + a * (-2 / 3 + a * (5 / 16 + a * (41 / 180 + a * (-127 / 288 + a * (7891 / 37800)))))), this.utg[1] = i * (-1 / 48 + a * (-1 / 15 + a * (437 / 1440 + a * (-46 / 105 + a * (1118711 / 3870720))))), this.gtu[1] = i * (13 / 48 + a * (-3 / 5 + a * (557 / 1440 + a * (281 / 630 + a * (-1983433 / 1935360))))), i = i * a, this.utg[2] = i * (-17 / 480 + a * (37 / 840 + a * (209 / 4480 + a * (-5569 / 90720)))), this.gtu[2] = i * (61 / 240 + a * (-103 / 140 + a * (15061 / 26880 + a * (167603 / 181440)))), i = i * a, this.utg[3] = i * (-4397 / 161280 + a * (11 / 504 + a * (830251 / 7257600))), this.gtu[3] = i * (49561 / 161280 + a * (-179 / 168 + a * (6601661 / 7257600))), i = i * a, this.utg[4] = i * (-4583 / 161280 + a * (108847 / 3991680)), this.gtu[4] = i * (34729 / 80640 + a * (-3418889 / 1995840)), i = i * a, this.utg[5] = i * (-20648693 / 638668800), this.gtu[5] = i * (212378941 / 319334400);
2205
- var s = oa(this.cbg, this.lat0);
2206
- this.Zb = -this.Qn * (s + ve(this.gtu, 2 * s));
2207
- }
2208
- function _e(t) {
2209
- var a = g(t.x - this.long0), i = t.y;
2210
- i = oa(this.cbg, i);
2211
- var s = Math.sin(i), e = Math.cos(i), r = Math.sin(a), n = Math.cos(a);
2212
- i = Math.atan2(s, n * e), a = Math.atan2(r * e, ha(s, e * n)), a = Me(Math.tan(a));
2213
- var h = di(this.gtu, 2 * i, 2 * a);
2214
- i = i + h[0], a = a + h[1];
2215
- var o, f;
2216
- return Math.abs(a) <= 2.623395162778 ? (o = this.a * (this.Qn * a) + this.x0, f = this.a * (this.Qn * i + this.Zb) + this.y0) : (o = 1 / 0, f = 1 / 0), t.x = o, t.y = f, t;
2217
- }
2218
- function ge(t) {
2219
- var a = (t.x - this.x0) * (1 / this.a), i = (t.y - this.y0) * (1 / this.a);
2220
- i = (i - this.Zb) / this.Qn, a = a / this.Qn;
2221
- var s, e;
2222
- if (Math.abs(a) <= 2.623395162778) {
2223
- var r = di(this.utg, 2 * i, 2 * a);
2224
- i = i + r[0], a = a + r[1], a = Math.atan(ui(a));
2225
- var n = Math.sin(i), h = Math.cos(i), o = Math.sin(a), f = Math.cos(a);
2226
- i = Math.atan2(n * f, ha(o, f * h)), a = Math.atan2(o, f * h), s = g(a + this.long0), e = oa(this.cgb, i);
2227
- } else
2228
- s = 1 / 0, e = 1 / 0;
2229
- return t.x = s, t.y = e, t;
2230
- }
2231
- var be = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc"];
2232
- const Dt = {
2233
- init: ye,
2234
- forward: _e,
2235
- inverse: ge,
2236
- names: be
2237
- };
2238
- function Ee(t, a) {
2239
- if (t === void 0) {
2240
- if (t = Math.floor((g(a) + Math.PI) * 30 / Math.PI) + 1, t < 0)
2241
- return 0;
2242
- if (t > 60)
2243
- return 60;
2244
- }
2245
- return t;
2246
- }
2247
- var xe = "etmerc";
2248
- function pe() {
2249
- var t = Ee(this.zone, this.long0);
2250
- if (t === void 0)
2251
- throw new Error("unknown utm zone");
2252
- this.lat0 = 0, this.long0 = (6 * Math.abs(t) - 183) * D, this.x0 = 5e5, this.y0 = this.utmSouth ? 1e7 : 0, this.k0 = 0.9996, Dt.init.apply(this), this.forward = Dt.forward, this.inverse = Dt.inverse;
2253
- }
2254
- var Ae = ["Universal Transverse Mercator System", "utm"];
2255
- const Re = {
2256
- init: pe,
2257
- names: Ae,
2258
- dependsOn: xe
2259
- };
2260
- function la(t, a) {
2261
- return Math.pow((1 - t) / (1 + t), a);
2262
- }
2263
- var Ie = 20;
2264
- function we() {
2265
- var t = Math.sin(this.lat0), a = Math.cos(this.lat0);
2266
- a *= a, this.rc = Math.sqrt(1 - this.es) / (1 - this.es * t * t), this.C = Math.sqrt(1 + this.es * a * a / (1 - this.es)), this.phic0 = Math.asin(t / this.C), this.ratexp = 0.5 * this.C * this.e, this.K = Math.tan(0.5 * this.phic0 + w) / (Math.pow(Math.tan(0.5 * this.lat0 + w), this.C) * la(this.e * t, this.ratexp));
2267
- }
2268
- function Se(t) {
2269
- var a = t.x, i = t.y;
2270
- return t.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * i + w), this.C) * la(this.e * Math.sin(i), this.ratexp)) - v, t.x = this.C * a, t;
2271
- }
2272
- function Ne(t) {
2273
- for (var a = 1e-14, i = t.x / this.C, s = t.y, e = Math.pow(Math.tan(0.5 * s + w) / this.K, 1 / this.C), r = Ie; r > 0 && (s = 2 * Math.atan(e * la(this.e * Math.sin(t.y), -0.5 * this.e)) - v, !(Math.abs(s - t.y) < a)); --r)
2274
- t.y = s;
2275
- return r ? (t.x = i, t.y = s, t) : null;
2276
- }
2277
- const fa = {
2278
- init: we,
2279
- forward: Se,
2280
- inverse: Ne
2281
- };
2282
- function Ce() {
2283
- fa.init.apply(this), this.rc && (this.sinc0 = Math.sin(this.phic0), this.cosc0 = Math.cos(this.phic0), this.R2 = 2 * this.rc, this.title || (this.title = "Oblique Stereographic Alternative"));
2284
- }
2285
- function Pe(t) {
2286
- var a, i, s, e;
2287
- return t.x = g(t.x - this.long0), fa.forward.apply(this, [t]), a = Math.sin(t.y), i = Math.cos(t.y), s = Math.cos(t.x), e = this.k0 * this.R2 / (1 + this.sinc0 * a + this.cosc0 * i * s), t.x = e * i * Math.sin(t.x), t.y = e * (this.cosc0 * a - this.sinc0 * i * s), t.x = this.a * t.x + this.x0, t.y = this.a * t.y + this.y0, t;
2288
- }
2289
- function Oe(t) {
2290
- var a, i, s, e, r;
2291
- if (t.x = (t.x - this.x0) / this.a, t.y = (t.y - this.y0) / this.a, t.x /= this.k0, t.y /= this.k0, r = Math.sqrt(t.x * t.x + t.y * t.y)) {
2292
- var n = 2 * Math.atan2(r, this.R2);
2293
- a = Math.sin(n), i = Math.cos(n), e = Math.asin(i * this.sinc0 + t.y * a * this.cosc0 / r), s = Math.atan2(t.x * a, r * this.cosc0 * i - t.y * this.sinc0 * a);
2294
- } else
2295
- e = this.phic0, s = 0;
2296
- return t.x = s, t.y = e, fa.inverse.apply(this, [t]), t.x = g(t.x + this.long0), t;
2297
- }
2298
- var Te = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea", "Oblique Stereographic Alternative", "Double_Stereographic"];
2299
- const Le = {
2300
- init: Ce,
2301
- forward: Pe,
2302
- inverse: Oe,
2303
- names: Te
2304
- };
2305
- function De(t, a, i) {
2306
- return a *= i, Math.tan(0.5 * (v + t)) * Math.pow((1 - a) / (1 + a), 0.5 * i);
2307
- }
2308
- function Be() {
2309
- this.coslat0 = Math.cos(this.lat0), this.sinlat0 = Math.sin(this.lat0), this.sphere ? this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= _ && (this.k0 = 0.5 * (1 + pt(this.lat0) * Math.sin(this.lat_ts))) : (Math.abs(this.coslat0) <= _ && (this.lat0 > 0 ? this.con = 1 : this.con = -1), this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e)), this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= _ && (this.k0 = 0.5 * this.cons * V(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / W(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts))), this.ms1 = V(this.e, this.sinlat0, this.coslat0), this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - v, this.cosX0 = Math.cos(this.X0), this.sinX0 = Math.sin(this.X0));
2310
- }
2311
- function Ge(t) {
2312
- var a = t.x, i = t.y, s = Math.sin(i), e = Math.cos(i), r, n, h, o, f, u, c = g(a - this.long0);
2313
- return Math.abs(Math.abs(a - this.long0) - Math.PI) <= _ && Math.abs(i + this.lat0) <= _ ? (t.x = NaN, t.y = NaN, t) : this.sphere ? (r = 2 * this.k0 / (1 + this.sinlat0 * s + this.coslat0 * e * Math.cos(c)), t.x = this.a * r * e * Math.sin(c) + this.x0, t.y = this.a * r * (this.coslat0 * s - this.sinlat0 * e * Math.cos(c)) + this.y0, t) : (n = 2 * Math.atan(this.ssfn_(i, s, this.e)) - v, o = Math.cos(n), h = Math.sin(n), Math.abs(this.coslat0) <= _ ? (f = W(this.e, i * this.con, this.con * s), u = 2 * this.a * this.k0 * f / this.cons, t.x = this.x0 + u * Math.sin(a - this.long0), t.y = this.y0 - this.con * u * Math.cos(a - this.long0), t) : (Math.abs(this.sinlat0) < _ ? (r = 2 * this.a * this.k0 / (1 + o * Math.cos(c)), t.y = r * h) : (r = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * h + this.cosX0 * o * Math.cos(c))), t.y = r * (this.cosX0 * h - this.sinX0 * o * Math.cos(c)) + this.y0), t.x = r * o * Math.sin(c) + this.x0, t));
2314
- }
2315
- function $e(t) {
2316
- t.x -= this.x0, t.y -= this.y0;
2317
- var a, i, s, e, r, n = Math.sqrt(t.x * t.x + t.y * t.y);
2318
- if (this.sphere) {
2319
- var h = 2 * Math.atan(n / (2 * this.a * this.k0));
2320
- return a = this.long0, i = this.lat0, n <= _ ? (t.x = a, t.y = i, t) : (i = Math.asin(Math.cos(h) * this.sinlat0 + t.y * Math.sin(h) * this.coslat0 / n), Math.abs(this.coslat0) < _ ? this.lat0 > 0 ? a = g(this.long0 + Math.atan2(t.x, -1 * t.y)) : a = g(this.long0 + Math.atan2(t.x, t.y)) : a = g(this.long0 + Math.atan2(t.x * Math.sin(h), n * this.coslat0 * Math.cos(h) - t.y * this.sinlat0 * Math.sin(h))), t.x = a, t.y = i, t);
2321
- } else if (Math.abs(this.coslat0) <= _) {
2322
- if (n <= _)
2323
- return i = this.lat0, a = this.long0, t.x = a, t.y = i, t;
2324
- t.x *= this.con, t.y *= this.con, s = n * this.cons / (2 * this.a * this.k0), i = this.con * xt(this.e, s), a = this.con * g(this.con * this.long0 + Math.atan2(t.x, -1 * t.y));
2325
- } else
2326
- e = 2 * Math.atan(n * this.cosX0 / (2 * this.a * this.k0 * this.ms1)), a = this.long0, n <= _ ? r = this.X0 : (r = Math.asin(Math.cos(e) * this.sinX0 + t.y * Math.sin(e) * this.cosX0 / n), a = g(this.long0 + Math.atan2(t.x * Math.sin(e), n * this.cosX0 * Math.cos(e) - t.y * this.sinX0 * Math.sin(e)))), i = -1 * xt(this.e, Math.tan(0.5 * (v + r)));
2327
- return t.x = a, t.y = i, t;
2328
- }
2329
- var Ue = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
2330
- const Fe = {
2331
- init: Be,
2332
- forward: Ge,
2333
- inverse: $e,
2334
- names: Ue,
2335
- ssfn_: De
2336
- };
2337
- function qe() {
2338
- var t = this.lat0;
2339
- this.lambda0 = this.long0;
2340
- var a = Math.sin(t), i = this.a, s = this.rf, e = 1 / s, r = 2 * e - Math.pow(e, 2), n = this.e = Math.sqrt(r);
2341
- this.R = this.k0 * i * Math.sqrt(1 - r) / (1 - r * Math.pow(a, 2)), this.alpha = Math.sqrt(1 + r / (1 - r) * Math.pow(Math.cos(t), 4)), this.b0 = Math.asin(a / this.alpha);
2342
- var h = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2)), o = Math.log(Math.tan(Math.PI / 4 + t / 2)), f = Math.log((1 + n * a) / (1 - n * a));
2343
- this.K = h - this.alpha * o + this.alpha * n / 2 * f;
2344
- }
2345
- function ke(t) {
2346
- var a = Math.log(Math.tan(Math.PI / 4 - t.y / 2)), i = this.e / 2 * Math.log((1 + this.e * Math.sin(t.y)) / (1 - this.e * Math.sin(t.y))), s = -this.alpha * (a + i) + this.K, e = 2 * (Math.atan(Math.exp(s)) - Math.PI / 4), r = this.alpha * (t.x - this.lambda0), n = Math.atan(Math.sin(r) / (Math.sin(this.b0) * Math.tan(e) + Math.cos(this.b0) * Math.cos(r))), h = Math.asin(Math.cos(this.b0) * Math.sin(e) - Math.sin(this.b0) * Math.cos(e) * Math.cos(r));
2347
- return t.y = this.R / 2 * Math.log((1 + Math.sin(h)) / (1 - Math.sin(h))) + this.y0, t.x = this.R * n + this.x0, t;
2348
- }
2349
- function ze(t) {
2350
- for (var a = t.x - this.x0, i = t.y - this.y0, s = a / this.R, e = 2 * (Math.atan(Math.exp(i / this.R)) - Math.PI / 4), r = Math.asin(Math.cos(this.b0) * Math.sin(e) + Math.sin(this.b0) * Math.cos(e) * Math.cos(s)), n = Math.atan(Math.sin(s) / (Math.cos(this.b0) * Math.cos(s) - Math.sin(this.b0) * Math.tan(e))), h = this.lambda0 + n / this.alpha, o = 0, f = r, u = -1e3, c = 0; Math.abs(f - u) > 1e-7; ) {
2351
- if (++c > 20)
2352
- return;
2353
- o = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + r / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(f)) / 2)), u = f, f = 2 * Math.atan(Math.exp(o)) - Math.PI / 2;
2354
- }
2355
- return t.x = h, t.y = f, t;
2356
- }
2357
- var He = ["somerc"];
2358
- const je = {
2359
- init: qe,
2360
- forward: ke,
2361
- inverse: ze,
2362
- names: He
2363
- };
2364
- function We() {
2365
- this.no_off = this.no_off || !1, this.no_rot = this.no_rot || !1, isNaN(this.k0) && (this.k0 = 1);
2366
- var t = Math.sin(this.lat0), a = Math.cos(this.lat0), i = this.e * t;
2367
- this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(a, 4)), this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - i * i);
2368
- var s = W(this.e, this.lat0, t), e = this.bl / a * Math.sqrt((1 - this.es) / (1 - i * i));
2369
- e * e < 1 && (e = 1);
2370
- var r, n;
2371
- if (!isNaN(this.longc))
2372
- this.lat0 >= 0 ? r = e + Math.sqrt(e * e - 1) : r = e - Math.sqrt(e * e - 1), this.el = r * Math.pow(s, this.bl), n = 0.5 * (r - 1 / r), this.gamma0 = Math.asin(Math.sin(this.alpha) / e), this.long0 = this.longc - Math.asin(n * Math.tan(this.gamma0)) / this.bl;
2373
- else {
2374
- var h = W(this.e, this.lat1, Math.sin(this.lat1)), o = W(this.e, this.lat2, Math.sin(this.lat2));
2375
- this.lat0 >= 0 ? this.el = (e + Math.sqrt(e * e - 1)) * Math.pow(s, this.bl) : this.el = (e - Math.sqrt(e * e - 1)) * Math.pow(s, this.bl);
2376
- var f = Math.pow(h, this.bl), u = Math.pow(o, this.bl);
2377
- r = this.el / f, n = 0.5 * (r - 1 / r);
2378
- var c = (this.el * this.el - u * f) / (this.el * this.el + u * f), l = (u - f) / (u + f), d = g(this.long1 - this.long2);
2379
- this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(c * Math.tan(0.5 * this.bl * d) / l) / this.bl, this.long0 = g(this.long0);
2380
- var M = g(this.long1 - this.long0);
2381
- this.gamma0 = Math.atan(Math.sin(this.bl * M) / n), this.alpha = Math.asin(e * Math.sin(this.gamma0));
2382
- }
2383
- this.no_off ? this.uc = 0 : this.lat0 >= 0 ? this.uc = this.al / this.bl * Math.atan2(Math.sqrt(e * e - 1), Math.cos(this.alpha)) : this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(e * e - 1), Math.cos(this.alpha));
2384
- }
2385
- function Xe(t) {
2386
- var a = t.x, i = t.y, s = g(a - this.long0), e, r, n;
2387
- if (Math.abs(Math.abs(i) - v) <= _)
2388
- i > 0 ? n = -1 : n = 1, r = this.al / this.bl * Math.log(Math.tan(w + n * this.gamma0 * 0.5)), e = -1 * n * v * this.al / this.bl;
2389
- else {
2390
- var h = W(this.e, i, Math.sin(i)), o = this.el / Math.pow(h, this.bl), f = 0.5 * (o - 1 / o), u = 0.5 * (o + 1 / o), c = Math.sin(this.bl * s), l = (f * Math.sin(this.gamma0) - c * Math.cos(this.gamma0)) / u;
2391
- Math.abs(Math.abs(l) - 1) <= _ ? r = Number.POSITIVE_INFINITY : r = 0.5 * this.al * Math.log((1 - l) / (1 + l)) / this.bl, Math.abs(Math.cos(this.bl * s)) <= _ ? e = this.al * this.bl * s : e = this.al * Math.atan2(f * Math.cos(this.gamma0) + c * Math.sin(this.gamma0), Math.cos(this.bl * s)) / this.bl;
2392
- }
2393
- return this.no_rot ? (t.x = this.x0 + e, t.y = this.y0 + r) : (e -= this.uc, t.x = this.x0 + r * Math.cos(this.alpha) + e * Math.sin(this.alpha), t.y = this.y0 + e * Math.cos(this.alpha) - r * Math.sin(this.alpha)), t;
2394
- }
2395
- function Qe(t) {
2396
- var a, i;
2397
- this.no_rot ? (i = t.y - this.y0, a = t.x - this.x0) : (i = (t.x - this.x0) * Math.cos(this.alpha) - (t.y - this.y0) * Math.sin(this.alpha), a = (t.y - this.y0) * Math.cos(this.alpha) + (t.x - this.x0) * Math.sin(this.alpha), a += this.uc);
2398
- var s = Math.exp(-1 * this.bl * i / this.al), e = 0.5 * (s - 1 / s), r = 0.5 * (s + 1 / s), n = Math.sin(this.bl * a / this.al), h = (n * Math.cos(this.gamma0) + e * Math.sin(this.gamma0)) / r, o = Math.pow(this.el / Math.sqrt((1 + h) / (1 - h)), 1 / this.bl);
2399
- return Math.abs(h - 1) < _ ? (t.x = this.long0, t.y = v) : Math.abs(h + 1) < _ ? (t.x = this.long0, t.y = -1 * v) : (t.y = xt(this.e, o), t.x = g(this.long0 - Math.atan2(e * Math.cos(this.gamma0) - n * Math.sin(this.gamma0), Math.cos(this.bl * a / this.al)) / this.bl)), t;
2400
- }
2401
- var Je = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"];
2402
- const Ve = {
2403
- init: We,
2404
- forward: Xe,
2405
- inverse: Qe,
2406
- names: Je
2407
- };
2408
- function Ke() {
2409
- if (this.lat2 || (this.lat2 = this.lat1), this.k0 || (this.k0 = 1), this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, !(Math.abs(this.lat1 + this.lat2) < _)) {
2410
- var t = this.b / this.a;
2411
- this.e = Math.sqrt(1 - t * t);
2412
- var a = Math.sin(this.lat1), i = Math.cos(this.lat1), s = V(this.e, a, i), e = W(this.e, this.lat1, a), r = Math.sin(this.lat2), n = Math.cos(this.lat2), h = V(this.e, r, n), o = W(this.e, this.lat2, r), f = W(this.e, this.lat0, Math.sin(this.lat0));
2413
- Math.abs(this.lat1 - this.lat2) > _ ? this.ns = Math.log(s / h) / Math.log(e / o) : this.ns = a, isNaN(this.ns) && (this.ns = a), this.f0 = s / (this.ns * Math.pow(e, this.ns)), this.rh = this.a * this.f0 * Math.pow(f, this.ns), this.title || (this.title = "Lambert Conformal Conic");
2414
- }
2415
- }
2416
- function Ye(t) {
2417
- var a = t.x, i = t.y;
2418
- Math.abs(2 * Math.abs(i) - Math.PI) <= _ && (i = pt(i) * (v - 2 * _));
2419
- var s = Math.abs(Math.abs(i) - v), e, r;
2420
- if (s > _)
2421
- e = W(this.e, i, Math.sin(i)), r = this.a * this.f0 * Math.pow(e, this.ns);
2422
- else {
2423
- if (s = i * this.ns, s <= 0)
2424
- return null;
2425
- r = 0;
2426
- }
2427
- var n = this.ns * g(a - this.long0);
2428
- return t.x = this.k0 * (r * Math.sin(n)) + this.x0, t.y = this.k0 * (this.rh - r * Math.cos(n)) + this.y0, t;
2429
- }
2430
- function Ze(t) {
2431
- var a, i, s, e, r, n = (t.x - this.x0) / this.k0, h = this.rh - (t.y - this.y0) / this.k0;
2432
- this.ns > 0 ? (a = Math.sqrt(n * n + h * h), i = 1) : (a = -Math.sqrt(n * n + h * h), i = -1);
2433
- var o = 0;
2434
- if (a !== 0 && (o = Math.atan2(i * n, i * h)), a !== 0 || this.ns > 0) {
2435
- if (i = 1 / this.ns, s = Math.pow(a / (this.a * this.f0), i), e = xt(this.e, s), e === -9999)
2436
- return null;
2437
- } else
2438
- e = -v;
2439
- return r = g(o / this.ns + this.long0), t.x = r, t.y = e, t;
2440
- }
2441
- var tr = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"];
2442
- const ar = {
2443
- init: Ke,
2444
- forward: Ye,
2445
- inverse: Ze,
2446
- names: tr
2447
- };
2448
- function ir() {
2449
- this.a = 6377397155e-3, this.es = 0.006674372230614, this.e = Math.sqrt(this.es), this.lat0 || (this.lat0 = 0.863937979737193), this.long0 || (this.long0 = 0.7417649320975901 - 0.308341501185665), this.k0 || (this.k0 = 0.9999), this.s45 = 0.785398163397448, this.s90 = 2 * this.s45, this.fi0 = this.lat0, this.e2 = this.es, this.e = Math.sqrt(this.e2), this.alfa = Math.sqrt(1 + this.e2 * Math.pow(Math.cos(this.fi0), 4) / (1 - this.e2)), this.uq = 1.04216856380474, this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa), this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2), this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g, this.k1 = this.k0, this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2)), this.s0 = 1.37008346281555, this.n = Math.sin(this.s0), this.ro0 = this.k1 * this.n0 / Math.tan(this.s0), this.ad = this.s90 - this.uq;
2450
- }
2451
- function sr(t) {
2452
- var a, i, s, e, r, n, h, o = t.x, f = t.y, u = g(o - this.long0);
2453
- return a = Math.pow((1 + this.e * Math.sin(f)) / (1 - this.e * Math.sin(f)), this.alfa * this.e / 2), i = 2 * (Math.atan(this.k * Math.pow(Math.tan(f / 2 + this.s45), this.alfa) / a) - this.s45), s = -u * this.alfa, e = Math.asin(Math.cos(this.ad) * Math.sin(i) + Math.sin(this.ad) * Math.cos(i) * Math.cos(s)), r = Math.asin(Math.cos(i) * Math.sin(s) / Math.cos(e)), n = this.n * r, h = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(e / 2 + this.s45), this.n), t.y = h * Math.cos(n) / 1, t.x = h * Math.sin(n) / 1, this.czech || (t.y *= -1, t.x *= -1), t;
2454
- }
2455
- function er(t) {
2456
- var a, i, s, e, r, n, h, o, f = t.x;
2457
- t.x = t.y, t.y = f, this.czech || (t.y *= -1, t.x *= -1), n = Math.sqrt(t.x * t.x + t.y * t.y), r = Math.atan2(t.y, t.x), e = r / Math.sin(this.s0), s = 2 * (Math.atan(Math.pow(this.ro0 / n, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45), a = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(e)), i = Math.asin(Math.cos(s) * Math.sin(e) / Math.cos(a)), t.x = this.long0 - i / this.alfa, h = a, o = 0;
2458
- var u = 0;
2459
- do
2460
- t.y = 2 * (Math.atan(Math.pow(this.k, -1 / this.alfa) * Math.pow(Math.tan(a / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(h)) / (1 - this.e * Math.sin(h)), this.e / 2)) - this.s45), Math.abs(h - t.y) < 1e-10 && (o = 1), h = t.y, u += 1;
2461
- while (o === 0 && u < 15);
2462
- return u >= 15 ? null : t;
2463
- }
2464
- var rr = ["Krovak", "krovak"];
2465
- const nr = {
2466
- init: ir,
2467
- forward: sr,
2468
- inverse: er,
2469
- names: rr
2470
- };
2471
- function U(t, a, i, s, e) {
2472
- return t * e - a * Math.sin(2 * e) + i * Math.sin(4 * e) - s * Math.sin(6 * e);
2473
- }
2474
- function At(t) {
2475
- return 1 - 0.25 * t * (1 + t / 16 * (3 + 1.25 * t));
2476
- }
2477
- function Rt(t) {
2478
- return 0.375 * t * (1 + 0.25 * t * (1 + 0.46875 * t));
2479
- }
2480
- function It(t) {
2481
- return 0.05859375 * t * t * (1 + 0.75 * t);
2482
- }
2483
- function wt(t) {
2484
- return t * t * t * (35 / 3072);
2485
- }
2486
- function dt(t, a, i) {
2487
- var s = a * i;
2488
- return t / Math.sqrt(1 - s * s);
2489
- }
2490
- function Mt(t) {
2491
- return Math.abs(t) < v ? t : t - pt(t) * Math.PI;
2492
- }
2493
- function qt(t, a, i, s, e) {
2494
- var r, n;
2495
- r = t / a;
2496
- for (var h = 0; h < 15; h++)
2497
- if (n = (t - (a * r - i * Math.sin(2 * r) + s * Math.sin(4 * r) - e * Math.sin(6 * r))) / (a - 2 * i * Math.cos(2 * r) + 4 * s * Math.cos(4 * r) - 6 * e * Math.cos(6 * r)), r += n, Math.abs(n) <= 1e-10)
2498
- return r;
2499
- return NaN;
2500
- }
2501
- function hr() {
2502
- this.sphere || (this.e0 = At(this.es), this.e1 = Rt(this.es), this.e2 = It(this.es), this.e3 = wt(this.es), this.ml0 = this.a * U(this.e0, this.e1, this.e2, this.e3, this.lat0));
2503
- }
2504
- function or(t) {
2505
- var a, i, s = t.x, e = t.y;
2506
- if (s = g(s - this.long0), this.sphere)
2507
- a = this.a * Math.asin(Math.cos(e) * Math.sin(s)), i = this.a * (Math.atan2(Math.tan(e), Math.cos(s)) - this.lat0);
2508
- else {
2509
- var r = Math.sin(e), n = Math.cos(e), h = dt(this.a, this.e, r), o = Math.tan(e) * Math.tan(e), f = s * Math.cos(e), u = f * f, c = this.es * n * n / (1 - this.es), l = this.a * U(this.e0, this.e1, this.e2, this.e3, e);
2510
- a = h * f * (1 - u * o * (1 / 6 - (8 - o + 8 * c) * u / 120)), i = l - this.ml0 + h * r / n * u * (0.5 + (5 - o + 6 * c) * u / 24);
2511
- }
2512
- return t.x = a + this.x0, t.y = i + this.y0, t;
2513
- }
2514
- function lr(t) {
2515
- t.x -= this.x0, t.y -= this.y0;
2516
- var a = t.x / this.a, i = t.y / this.a, s, e;
2517
- if (this.sphere) {
2518
- var r = i + this.lat0;
2519
- s = Math.asin(Math.sin(r) * Math.cos(a)), e = Math.atan2(Math.tan(a), Math.cos(r));
2520
- } else {
2521
- var n = this.ml0 / this.a + i, h = qt(n, this.e0, this.e1, this.e2, this.e3);
2522
- if (Math.abs(Math.abs(h) - v) <= _)
2523
- return t.x = this.long0, t.y = v, i < 0 && (t.y *= -1), t;
2524
- var o = dt(this.a, this.e, Math.sin(h)), f = o * o * o / this.a / this.a * (1 - this.es), u = Math.pow(Math.tan(h), 2), c = a * this.a / o, l = c * c;
2525
- s = h - o * Math.tan(h) / f * c * c * (0.5 - (1 + 3 * u) * c * c / 24), e = c * (1 - l * (u / 3 + (1 + 3 * u) * u * l / 15)) / Math.cos(h);
2526
- }
2527
- return t.x = g(e + this.long0), t.y = Mt(s), t;
2528
- }
2529
- var fr = ["Cassini", "Cassini_Soldner", "cass"];
2530
- const cr = {
2531
- init: hr,
2532
- forward: or,
2533
- inverse: lr,
2534
- names: fr
2535
- };
2536
- function Z(t, a) {
2537
- var i;
2538
- return t > 1e-7 ? (i = t * a, (1 - t * t) * (a / (1 - i * i) - 0.5 / t * Math.log((1 - i) / (1 + i)))) : 2 * a;
2539
- }
2540
- var ur = 1, dr = 2, Mr = 3, vr = 4;
2541
- function mr() {
2542
- var t = Math.abs(this.lat0);
2543
- if (Math.abs(t - v) < _ ? this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE : Math.abs(t) < _ ? this.mode = this.EQUIT : this.mode = this.OBLIQ, this.es > 0) {
2544
- var a;
2545
- switch (this.qp = Z(this.e, 1), this.mmf = 0.5 / (1 - this.es), this.apa = Rr(this.es), this.mode) {
2546
- case this.N_POLE:
2547
- this.dd = 1;
2548
- break;
2549
- case this.S_POLE:
2550
- this.dd = 1;
2551
- break;
2552
- case this.EQUIT:
2553
- this.rq = Math.sqrt(0.5 * this.qp), this.dd = 1 / this.rq, this.xmf = 1, this.ymf = 0.5 * this.qp;
2554
- break;
2555
- case this.OBLIQ:
2556
- this.rq = Math.sqrt(0.5 * this.qp), a = Math.sin(this.lat0), this.sinb1 = Z(this.e, a) / this.qp, this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1), this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * a * a) * this.rq * this.cosb1), this.ymf = (this.xmf = this.rq) / this.dd, this.xmf *= this.dd;
2557
- break;
2558
- }
2559
- } else
2560
- this.mode === this.OBLIQ && (this.sinph0 = Math.sin(this.lat0), this.cosph0 = Math.cos(this.lat0));
2561
- }
2562
- function yr(t) {
2563
- var a, i, s, e, r, n, h, o, f, u, c = t.x, l = t.y;
2564
- if (c = g(c - this.long0), this.sphere) {
2565
- if (r = Math.sin(l), u = Math.cos(l), s = Math.cos(c), this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2566
- if (i = this.mode === this.EQUIT ? 1 + u * s : 1 + this.sinph0 * r + this.cosph0 * u * s, i <= _)
2567
- return null;
2568
- i = Math.sqrt(2 / i), a = i * u * Math.sin(c), i *= this.mode === this.EQUIT ? r : this.cosph0 * r - this.sinph0 * u * s;
2569
- } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
2570
- if (this.mode === this.N_POLE && (s = -s), Math.abs(l + this.lat0) < _)
2571
- return null;
2572
- i = w - l * 0.5, i = 2 * (this.mode === this.S_POLE ? Math.cos(i) : Math.sin(i)), a = i * Math.sin(c), i *= s;
2573
- }
2574
- } else {
2575
- switch (h = 0, o = 0, f = 0, s = Math.cos(c), e = Math.sin(c), r = Math.sin(l), n = Z(this.e, r), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (h = n / this.qp, o = Math.sqrt(1 - h * h)), this.mode) {
2576
- case this.OBLIQ:
2577
- f = 1 + this.sinb1 * h + this.cosb1 * o * s;
2578
- break;
2579
- case this.EQUIT:
2580
- f = 1 + o * s;
2581
- break;
2582
- case this.N_POLE:
2583
- f = v + l, n = this.qp - n;
2584
- break;
2585
- case this.S_POLE:
2586
- f = l - v, n = this.qp + n;
2587
- break;
2588
- }
2589
- if (Math.abs(f) < _)
2590
- return null;
2591
- switch (this.mode) {
2592
- case this.OBLIQ:
2593
- case this.EQUIT:
2594
- f = Math.sqrt(2 / f), this.mode === this.OBLIQ ? i = this.ymf * f * (this.cosb1 * h - this.sinb1 * o * s) : i = (f = Math.sqrt(2 / (1 + o * s))) * h * this.ymf, a = this.xmf * f * o * e;
2595
- break;
2596
- case this.N_POLE:
2597
- case this.S_POLE:
2598
- n >= 0 ? (a = (f = Math.sqrt(n)) * e, i = s * (this.mode === this.S_POLE ? f : -f)) : a = i = 0;
2599
- break;
2600
- }
2601
- }
2602
- return t.x = this.a * a + this.x0, t.y = this.a * i + this.y0, t;
2603
- }
2604
- function _r(t) {
2605
- t.x -= this.x0, t.y -= this.y0;
2606
- var a = t.x / this.a, i = t.y / this.a, s, e, r, n, h, o, f;
2607
- if (this.sphere) {
2608
- var u = 0, c, l = 0;
2609
- if (c = Math.sqrt(a * a + i * i), e = c * 0.5, e > 1)
2610
- return null;
2611
- switch (e = 2 * Math.asin(e), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (l = Math.sin(e), u = Math.cos(e)), this.mode) {
2612
- case this.EQUIT:
2613
- e = Math.abs(c) <= _ ? 0 : Math.asin(i * l / c), a *= l, i = u * c;
2614
- break;
2615
- case this.OBLIQ:
2616
- e = Math.abs(c) <= _ ? this.lat0 : Math.asin(u * this.sinph0 + i * l * this.cosph0 / c), a *= l * this.cosph0, i = (u - Math.sin(e) * this.sinph0) * c;
2617
- break;
2618
- case this.N_POLE:
2619
- i = -i, e = v - e;
2620
- break;
2621
- case this.S_POLE:
2622
- e -= v;
2623
- break;
2624
- }
2625
- s = i === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ) ? 0 : Math.atan2(a, i);
2626
- } else {
2627
- if (f = 0, this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2628
- if (a /= this.dd, i *= this.dd, o = Math.sqrt(a * a + i * i), o < _)
2629
- return t.x = this.long0, t.y = this.lat0, t;
2630
- n = 2 * Math.asin(0.5 * o / this.rq), r = Math.cos(n), a *= n = Math.sin(n), this.mode === this.OBLIQ ? (f = r * this.sinb1 + i * n * this.cosb1 / o, h = this.qp * f, i = o * this.cosb1 * r - i * this.sinb1 * n) : (f = i * n / o, h = this.qp * f, i = o * r);
2631
- } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
2632
- if (this.mode === this.N_POLE && (i = -i), h = a * a + i * i, !h)
2633
- return t.x = this.long0, t.y = this.lat0, t;
2634
- f = 1 - h / this.qp, this.mode === this.S_POLE && (f = -f);
2635
- }
2636
- s = Math.atan2(a, i), e = Ir(Math.asin(f), this.apa);
2637
- }
2638
- return t.x = g(this.long0 + s), t.y = e, t;
2639
- }
2640
- var gr = 0.3333333333333333, br = 0.17222222222222222, Er = 0.10257936507936508, xr = 0.06388888888888888, pr = 0.0664021164021164, Ar = 0.016415012942191543;
2641
- function Rr(t) {
2642
- var a, i = [];
2643
- return i[0] = t * gr, a = t * t, i[0] += a * br, i[1] = a * xr, a *= t, i[0] += a * Er, i[1] += a * pr, i[2] = a * Ar, i;
2644
- }
2645
- function Ir(t, a) {
2646
- var i = t + t;
2647
- return t + a[0] * Math.sin(i) + a[1] * Math.sin(i + i) + a[2] * Math.sin(i + i + i);
2648
- }
2649
- var wr = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
2650
- const Sr = {
2651
- init: mr,
2652
- forward: yr,
2653
- inverse: _r,
2654
- names: wr,
2655
- S_POLE: ur,
2656
- N_POLE: dr,
2657
- EQUIT: Mr,
2658
- OBLIQ: vr
2659
- };
2660
- function at(t) {
2661
- return Math.abs(t) > 1 && (t = t > 1 ? 1 : -1), Math.asin(t);
2662
- }
2663
- function Nr() {
2664
- Math.abs(this.lat1 + this.lat2) < _ || (this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e3 = Math.sqrt(this.es), this.sin_po = Math.sin(this.lat1), this.cos_po = Math.cos(this.lat1), this.t1 = this.sin_po, this.con = this.sin_po, this.ms1 = V(this.e3, this.sin_po, this.cos_po), this.qs1 = Z(this.e3, this.sin_po, this.cos_po), this.sin_po = Math.sin(this.lat2), this.cos_po = Math.cos(this.lat2), this.t2 = this.sin_po, this.ms2 = V(this.e3, this.sin_po, this.cos_po), this.qs2 = Z(this.e3, this.sin_po, this.cos_po), this.sin_po = Math.sin(this.lat0), this.cos_po = Math.cos(this.lat0), this.t3 = this.sin_po, this.qs0 = Z(this.e3, this.sin_po, this.cos_po), Math.abs(this.lat1 - this.lat2) > _ ? this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1) : this.ns0 = this.con, this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1, this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0);
2665
- }
2666
- function Cr(t) {
2667
- var a = t.x, i = t.y;
2668
- this.sin_phi = Math.sin(i), this.cos_phi = Math.cos(i);
2669
- var s = Z(this.e3, this.sin_phi, this.cos_phi), e = this.a * Math.sqrt(this.c - this.ns0 * s) / this.ns0, r = this.ns0 * g(a - this.long0), n = e * Math.sin(r) + this.x0, h = this.rh - e * Math.cos(r) + this.y0;
2670
- return t.x = n, t.y = h, t;
2671
- }
2672
- function Pr(t) {
2673
- var a, i, s, e, r, n;
2674
- return t.x -= this.x0, t.y = this.rh - t.y + this.y0, this.ns0 >= 0 ? (a = Math.sqrt(t.x * t.x + t.y * t.y), s = 1) : (a = -Math.sqrt(t.x * t.x + t.y * t.y), s = -1), e = 0, a !== 0 && (e = Math.atan2(s * t.x, s * t.y)), s = a * this.ns0 / this.a, this.sphere ? n = Math.asin((this.c - s * s) / (2 * this.ns0)) : (i = (this.c - s * s) / this.ns0, n = this.phi1z(this.e3, i)), r = g(e / this.ns0 + this.long0), t.x = r, t.y = n, t;
2675
- }
2676
- function Or(t, a) {
2677
- var i, s, e, r, n, h = at(0.5 * a);
2678
- if (t < _)
2679
- return h;
2680
- for (var o = t * t, f = 1; f <= 25; f++)
2681
- if (i = Math.sin(h), s = Math.cos(h), e = t * i, r = 1 - e * e, n = 0.5 * r * r / s * (a / (1 - o) - i / r + 0.5 / t * Math.log((1 - e) / (1 + e))), h = h + n, Math.abs(n) <= 1e-7)
2682
- return h;
2683
- return null;
2684
- }
2685
- var Tr = ["Albers_Conic_Equal_Area", "Albers", "aea"];
2686
- const Lr = {
2687
- init: Nr,
2688
- forward: Cr,
2689
- inverse: Pr,
2690
- names: Tr,
2691
- phi1z: Or
2692
- };
2693
- function Dr() {
2694
- this.sin_p14 = Math.sin(this.lat0), this.cos_p14 = Math.cos(this.lat0), this.infinity_dist = 1e3 * this.a, this.rc = 1;
2695
- }
2696
- function Br(t) {
2697
- var a, i, s, e, r, n, h, o, f = t.x, u = t.y;
2698
- return s = g(f - this.long0), a = Math.sin(u), i = Math.cos(u), e = Math.cos(s), n = this.sin_p14 * a + this.cos_p14 * i * e, r = 1, n > 0 || Math.abs(n) <= _ ? (h = this.x0 + this.a * r * i * Math.sin(s) / n, o = this.y0 + this.a * r * (this.cos_p14 * a - this.sin_p14 * i * e) / n) : (h = this.x0 + this.infinity_dist * i * Math.sin(s), o = this.y0 + this.infinity_dist * (this.cos_p14 * a - this.sin_p14 * i * e)), t.x = h, t.y = o, t;
2699
- }
2700
- function Gr(t) {
2701
- var a, i, s, e, r, n;
2702
- return t.x = (t.x - this.x0) / this.a, t.y = (t.y - this.y0) / this.a, t.x /= this.k0, t.y /= this.k0, (a = Math.sqrt(t.x * t.x + t.y * t.y)) ? (e = Math.atan2(a, this.rc), i = Math.sin(e), s = Math.cos(e), n = at(s * this.sin_p14 + t.y * i * this.cos_p14 / a), r = Math.atan2(t.x * i, a * this.cos_p14 * s - t.y * this.sin_p14 * i), r = g(this.long0 + r)) : (n = this.phic0, r = 0), t.x = r, t.y = n, t;
2703
- }
2704
- var $r = ["gnom"];
2705
- const Ur = {
2706
- init: Dr,
2707
- forward: Br,
2708
- inverse: Gr,
2709
- names: $r
2710
- };
2711
- function Fr(t, a) {
2712
- var i = 1 - (1 - t * t) / (2 * t) * Math.log((1 - t) / (1 + t));
2713
- if (Math.abs(Math.abs(a) - i) < 1e-6)
2714
- return a < 0 ? -1 * v : v;
2715
- for (var s = Math.asin(0.5 * a), e, r, n, h, o = 0; o < 30; o++)
2716
- if (r = Math.sin(s), n = Math.cos(s), h = t * r, e = Math.pow(1 - h * h, 2) / (2 * n) * (a / (1 - t * t) - r / (1 - h * h) + 0.5 / t * Math.log((1 - h) / (1 + h))), s += e, Math.abs(e) <= 1e-10)
2717
- return s;
2718
- return NaN;
2719
- }
2720
- function qr() {
2721
- this.sphere || (this.k0 = V(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)));
2722
- }
2723
- function kr(t) {
2724
- var a = t.x, i = t.y, s, e, r = g(a - this.long0);
2725
- if (this.sphere)
2726
- s = this.x0 + this.a * r * Math.cos(this.lat_ts), e = this.y0 + this.a * Math.sin(i) / Math.cos(this.lat_ts);
2727
- else {
2728
- var n = Z(this.e, Math.sin(i));
2729
- s = this.x0 + this.a * this.k0 * r, e = this.y0 + this.a * n * 0.5 / this.k0;
2730
- }
2731
- return t.x = s, t.y = e, t;
2732
- }
2733
- function zr(t) {
2734
- t.x -= this.x0, t.y -= this.y0;
2735
- var a, i;
2736
- return this.sphere ? (a = g(this.long0 + t.x / this.a / Math.cos(this.lat_ts)), i = Math.asin(t.y / this.a * Math.cos(this.lat_ts))) : (i = Fr(this.e, 2 * t.y * this.k0 / this.a), a = g(this.long0 + t.x / (this.a * this.k0))), t.x = a, t.y = i, t;
2737
- }
2738
- var Hr = ["cea"];
2739
- const jr = {
2740
- init: qr,
2741
- forward: kr,
2742
- inverse: zr,
2743
- names: Hr
2744
- };
2745
- function Wr() {
2746
- this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Equidistant Cylindrical (Plate Carre)", this.rc = Math.cos(this.lat_ts);
2747
- }
2748
- function Xr(t) {
2749
- var a = t.x, i = t.y, s = g(a - this.long0), e = Mt(i - this.lat0);
2750
- return t.x = this.x0 + this.a * s * this.rc, t.y = this.y0 + this.a * e, t;
2751
- }
2752
- function Qr(t) {
2753
- var a = t.x, i = t.y;
2754
- return t.x = g(this.long0 + (a - this.x0) / (this.a * this.rc)), t.y = Mt(this.lat0 + (i - this.y0) / this.a), t;
2755
- }
2756
- var Jr = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
2757
- const Vr = {
2758
- init: Wr,
2759
- forward: Xr,
2760
- inverse: Qr,
2761
- names: Jr
2762
- };
2763
- var Oa = 20;
2764
- function Kr() {
2765
- this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e = Math.sqrt(this.es), this.e0 = At(this.es), this.e1 = Rt(this.es), this.e2 = It(this.es), this.e3 = wt(this.es), this.ml0 = this.a * U(this.e0, this.e1, this.e2, this.e3, this.lat0);
2766
- }
2767
- function Yr(t) {
2768
- var a = t.x, i = t.y, s, e, r, n = g(a - this.long0);
2769
- if (r = n * Math.sin(i), this.sphere)
2770
- Math.abs(i) <= _ ? (s = this.a * n, e = -1 * this.a * this.lat0) : (s = this.a * Math.sin(r) / Math.tan(i), e = this.a * (Mt(i - this.lat0) + (1 - Math.cos(r)) / Math.tan(i)));
2771
- else if (Math.abs(i) <= _)
2772
- s = this.a * n, e = -1 * this.ml0;
2773
- else {
2774
- var h = dt(this.a, this.e, Math.sin(i)) / Math.tan(i);
2775
- s = h * Math.sin(r), e = this.a * U(this.e0, this.e1, this.e2, this.e3, i) - this.ml0 + h * (1 - Math.cos(r));
2776
- }
2777
- return t.x = s + this.x0, t.y = e + this.y0, t;
2778
- }
2779
- function Zr(t) {
2780
- var a, i, s, e, r, n, h, o, f;
2781
- if (s = t.x - this.x0, e = t.y - this.y0, this.sphere)
2782
- if (Math.abs(e + this.a * this.lat0) <= _)
2783
- a = g(s / this.a + this.long0), i = 0;
2784
- else {
2785
- n = this.lat0 + e / this.a, h = s * s / this.a / this.a + n * n, o = n;
2786
- var u;
2787
- for (r = Oa; r; --r)
2788
- if (u = Math.tan(o), f = -1 * (n * (o * u + 1) - o - 0.5 * (o * o + h) * u) / ((o - n) / u - 1), o += f, Math.abs(f) <= _) {
2789
- i = o;
2790
- break;
2791
- }
2792
- a = g(this.long0 + Math.asin(s * Math.tan(o) / this.a) / Math.sin(i));
2793
- }
2794
- else if (Math.abs(e + this.ml0) <= _)
2795
- i = 0, a = g(this.long0 + s / this.a);
2796
- else {
2797
- n = (this.ml0 + e) / this.a, h = s * s / this.a / this.a + n * n, o = n;
2798
- var c, l, d, M, m;
2799
- for (r = Oa; r; --r)
2800
- if (m = this.e * Math.sin(o), c = Math.sqrt(1 - m * m) * Math.tan(o), l = this.a * U(this.e0, this.e1, this.e2, this.e3, o), d = this.e0 - 2 * this.e1 * Math.cos(2 * o) + 4 * this.e2 * Math.cos(4 * o) - 6 * this.e3 * Math.cos(6 * o), M = l / this.a, f = (n * (c * M + 1) - M - 0.5 * c * (M * M + h)) / (this.es * Math.sin(2 * o) * (M * M + h - 2 * n * M) / (4 * c) + (n - M) * (c * d - 2 / Math.sin(2 * o)) - d), o -= f, Math.abs(f) <= _) {
2801
- i = o;
2802
- break;
2803
- }
2804
- c = Math.sqrt(1 - this.es * Math.pow(Math.sin(i), 2)) * Math.tan(i), a = g(this.long0 + Math.asin(s * c / this.a) / Math.sin(i));
2805
- }
2806
- return t.x = a, t.y = i, t;
2807
- }
2808
- var tn = ["Polyconic", "poly"];
2809
- const an = {
2810
- init: Kr,
2811
- forward: Yr,
2812
- inverse: Zr,
2813
- names: tn
2814
- };
2815
- function sn() {
2816
- this.A = [], this.A[1] = 0.6399175073, this.A[2] = -0.1358797613, this.A[3] = 0.063294409, this.A[4] = -0.02526853, this.A[5] = 0.0117879, this.A[6] = -55161e-7, this.A[7] = 26906e-7, this.A[8] = -1333e-6, this.A[9] = 67e-5, this.A[10] = -34e-5, this.B_re = [], this.B_im = [], this.B_re[1] = 0.7557853228, this.B_im[1] = 0, this.B_re[2] = 0.249204646, this.B_im[2] = 3371507e-9, this.B_re[3] = -1541739e-9, this.B_im[3] = 0.04105856, this.B_re[4] = -0.10162907, this.B_im[4] = 0.01727609, this.B_re[5] = -0.26623489, this.B_im[5] = -0.36249218, this.B_re[6] = -0.6870983, this.B_im[6] = -1.1651967, this.C_re = [], this.C_im = [], this.C_re[1] = 1.3231270439, this.C_im[1] = 0, this.C_re[2] = -0.577245789, this.C_im[2] = -7809598e-9, this.C_re[3] = 0.508307513, this.C_im[3] = -0.112208952, this.C_re[4] = -0.15094762, this.C_im[4] = 0.18200602, this.C_re[5] = 1.01418179, this.C_im[5] = 1.64497696, this.C_re[6] = 1.9660549, this.C_im[6] = 2.5127645, this.D = [], this.D[1] = 1.5627014243, this.D[2] = 0.5185406398, this.D[3] = -0.03333098, this.D[4] = -0.1052906, this.D[5] = -0.0368594, this.D[6] = 7317e-6, this.D[7] = 0.0122, this.D[8] = 394e-5, this.D[9] = -13e-4;
2817
- }
2818
- function en(t) {
2819
- var a, i = t.x, s = t.y, e = s - this.lat0, r = i - this.long0, n = e / gt * 1e-5, h = r, o = 1, f = 0;
2820
- for (a = 1; a <= 10; a++)
2821
- o = o * n, f = f + this.A[a] * o;
2822
- var u = f, c = h, l = 1, d = 0, M, m, y = 0, b = 0;
2823
- for (a = 1; a <= 6; a++)
2824
- M = l * u - d * c, m = d * u + l * c, l = M, d = m, y = y + this.B_re[a] * l - this.B_im[a] * d, b = b + this.B_im[a] * l + this.B_re[a] * d;
2825
- return t.x = b * this.a + this.x0, t.y = y * this.a + this.y0, t;
2826
- }
2827
- function rn(t) {
2828
- var a, i = t.x, s = t.y, e = i - this.x0, r = s - this.y0, n = r / this.a, h = e / this.a, o = 1, f = 0, u, c, l = 0, d = 0;
2829
- for (a = 1; a <= 6; a++)
2830
- u = o * n - f * h, c = f * n + o * h, o = u, f = c, l = l + this.C_re[a] * o - this.C_im[a] * f, d = d + this.C_im[a] * o + this.C_re[a] * f;
2831
- for (var M = 0; M < this.iterations; M++) {
2832
- var m = l, y = d, b, x, p = n, S = h;
2833
- for (a = 2; a <= 6; a++)
2834
- b = m * l - y * d, x = y * l + m * d, m = b, y = x, p = p + (a - 1) * (this.B_re[a] * m - this.B_im[a] * y), S = S + (a - 1) * (this.B_im[a] * m + this.B_re[a] * y);
2835
- m = 1, y = 0;
2836
- var A = this.B_re[1], R = this.B_im[1];
2837
- for (a = 2; a <= 6; a++)
2838
- b = m * l - y * d, x = y * l + m * d, m = b, y = x, A = A + a * (this.B_re[a] * m - this.B_im[a] * y), R = R + a * (this.B_im[a] * m + this.B_re[a] * y);
2839
- var T = A * A + R * R;
2840
- l = (p * A + S * R) / T, d = (S * A - p * R) / T;
2841
- }
2842
- var P = l, X = d, it = 1, st = 0;
2843
- for (a = 1; a <= 9; a++)
2844
- it = it * P, st = st + this.D[a] * it;
2845
- var St = this.lat0 + st * gt * 1e5, Ai = this.long0 + X;
2846
- return t.x = Ai, t.y = St, t;
2847
- }
2848
- var nn = ["New_Zealand_Map_Grid", "nzmg"];
2849
- const hn = {
2850
- init: sn,
2851
- forward: en,
2852
- inverse: rn,
2853
- names: nn
2854
- };
2855
- function on() {
2856
- }
2857
- function ln(t) {
2858
- var a = t.x, i = t.y, s = g(a - this.long0), e = this.x0 + this.a * s, r = this.y0 + this.a * Math.log(Math.tan(Math.PI / 4 + i / 2.5)) * 1.25;
2859
- return t.x = e, t.y = r, t;
2860
- }
2861
- function fn(t) {
2862
- t.x -= this.x0, t.y -= this.y0;
2863
- var a = g(this.long0 + t.x / this.a), i = 2.5 * (Math.atan(Math.exp(0.8 * t.y / this.a)) - Math.PI / 4);
2864
- return t.x = a, t.y = i, t;
2865
- }
2866
- var cn = ["Miller_Cylindrical", "mill"];
2867
- const un = {
2868
- init: on,
2869
- forward: ln,
2870
- inverse: fn,
2871
- names: cn
2872
- };
2873
- var dn = 20;
2874
- function Mn() {
2875
- this.sphere ? (this.n = 1, this.m = 0, this.es = 0, this.C_y = Math.sqrt((this.m + 1) / this.n), this.C_x = this.C_y / (this.m + 1)) : this.en = fi(this.es);
2876
- }
2877
- function vn(t) {
2878
- var a, i, s = t.x, e = t.y;
2879
- if (s = g(s - this.long0), this.sphere) {
2880
- if (!this.m)
2881
- e = this.n !== 1 ? Math.asin(this.n * Math.sin(e)) : e;
2882
- else
2883
- for (var r = this.n * Math.sin(e), n = dn; n; --n) {
2884
- var h = (this.m * e + Math.sin(e) - r) / (this.m + Math.cos(e));
2885
- if (e -= h, Math.abs(h) < _)
2886
- break;
2887
- }
2888
- a = this.a * this.C_x * s * (this.m + Math.cos(e)), i = this.a * this.C_y * e;
2889
- } else {
2890
- var o = Math.sin(e), f = Math.cos(e);
2891
- i = this.a * jt(e, o, f, this.en), a = this.a * s * f / Math.sqrt(1 - this.es * o * o);
2892
- }
2893
- return t.x = a, t.y = i, t;
2894
- }
2895
- function mn(t) {
2896
- var a, i, s, e;
2897
- return t.x -= this.x0, s = t.x / this.a, t.y -= this.y0, a = t.y / this.a, this.sphere ? (a /= this.C_y, s = s / (this.C_x * (this.m + Math.cos(a))), this.m ? a = at((this.m * a + Math.sin(a)) / this.n) : this.n !== 1 && (a = at(Math.sin(a) / this.n)), s = g(s + this.long0), a = Mt(a)) : (a = ci(t.y / this.a, this.es, this.en), e = Math.abs(a), e < v ? (e = Math.sin(a), i = this.long0 + t.x * Math.sqrt(1 - this.es * e * e) / (this.a * Math.cos(a)), s = g(i)) : e - _ < v && (s = this.long0)), t.x = s, t.y = a, t;
2898
- }
2899
- var yn = ["Sinusoidal", "sinu"];
2900
- const _n = {
2901
- init: Mn,
2902
- forward: vn,
2903
- inverse: mn,
2904
- names: yn
2905
- };
2906
- function gn() {
2907
- }
2908
- function bn(t) {
2909
- for (var a = t.x, i = t.y, s = g(a - this.long0), e = i, r = Math.PI * Math.sin(i); ; ) {
2910
- var n = -(e + Math.sin(e) - r) / (1 + Math.cos(e));
2911
- if (e += n, Math.abs(n) < _)
2912
- break;
2913
- }
2914
- e /= 2, Math.PI / 2 - Math.abs(i) < _ && (s = 0);
2915
- var h = 0.900316316158 * this.a * s * Math.cos(e) + this.x0, o = 1.4142135623731 * this.a * Math.sin(e) + this.y0;
2916
- return t.x = h, t.y = o, t;
2917
- }
2918
- function En(t) {
2919
- var a, i;
2920
- t.x -= this.x0, t.y -= this.y0, i = t.y / (1.4142135623731 * this.a), Math.abs(i) > 0.999999999999 && (i = 0.999999999999), a = Math.asin(i);
2921
- var s = g(this.long0 + t.x / (0.900316316158 * this.a * Math.cos(a)));
2922
- s < -Math.PI && (s = -Math.PI), s > Math.PI && (s = Math.PI), i = (2 * a + Math.sin(2 * a)) / Math.PI, Math.abs(i) > 1 && (i = 1);
2923
- var e = Math.asin(i);
2924
- return t.x = s, t.y = e, t;
2925
- }
2926
- var xn = ["Mollweide", "moll"];
2927
- const pn = {
2928
- init: gn,
2929
- forward: bn,
2930
- inverse: En,
2931
- names: xn
2932
- };
2933
- function An() {
2934
- Math.abs(this.lat1 + this.lat2) < _ || (this.lat2 = this.lat2 || this.lat1, this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e = Math.sqrt(this.es), this.e0 = At(this.es), this.e1 = Rt(this.es), this.e2 = It(this.es), this.e3 = wt(this.es), this.sinphi = Math.sin(this.lat1), this.cosphi = Math.cos(this.lat1), this.ms1 = V(this.e, this.sinphi, this.cosphi), this.ml1 = U(this.e0, this.e1, this.e2, this.e3, this.lat1), Math.abs(this.lat1 - this.lat2) < _ ? this.ns = this.sinphi : (this.sinphi = Math.sin(this.lat2), this.cosphi = Math.cos(this.lat2), this.ms2 = V(this.e, this.sinphi, this.cosphi), this.ml2 = U(this.e0, this.e1, this.e2, this.e3, this.lat2), this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1)), this.g = this.ml1 + this.ms1 / this.ns, this.ml0 = U(this.e0, this.e1, this.e2, this.e3, this.lat0), this.rh = this.a * (this.g - this.ml0));
2935
- }
2936
- function Rn(t) {
2937
- var a = t.x, i = t.y, s;
2938
- if (this.sphere)
2939
- s = this.a * (this.g - i);
2940
- else {
2941
- var e = U(this.e0, this.e1, this.e2, this.e3, i);
2942
- s = this.a * (this.g - e);
2943
- }
2944
- var r = this.ns * g(a - this.long0), n = this.x0 + s * Math.sin(r), h = this.y0 + this.rh - s * Math.cos(r);
2945
- return t.x = n, t.y = h, t;
2946
- }
2947
- function In(t) {
2948
- t.x -= this.x0, t.y = this.rh - t.y + this.y0;
2949
- var a, i, s, e;
2950
- this.ns >= 0 ? (i = Math.sqrt(t.x * t.x + t.y * t.y), a = 1) : (i = -Math.sqrt(t.x * t.x + t.y * t.y), a = -1);
2951
- var r = 0;
2952
- if (i !== 0 && (r = Math.atan2(a * t.x, a * t.y)), this.sphere)
2953
- return e = g(this.long0 + r / this.ns), s = Mt(this.g - i / this.a), t.x = e, t.y = s, t;
2954
- var n = this.g - i / this.a;
2955
- return s = qt(n, this.e0, this.e1, this.e2, this.e3), e = g(this.long0 + r / this.ns), t.x = e, t.y = s, t;
2956
- }
2957
- var wn = ["Equidistant_Conic", "eqdc"];
2958
- const Sn = {
2959
- init: An,
2960
- forward: Rn,
2961
- inverse: In,
2962
- names: wn
2963
- };
2964
- function Nn() {
2965
- this.R = this.a;
2966
- }
2967
- function Cn(t) {
2968
- var a = t.x, i = t.y, s = g(a - this.long0), e, r;
2969
- Math.abs(i) <= _ && (e = this.x0 + this.R * s, r = this.y0);
2970
- var n = at(2 * Math.abs(i / Math.PI));
2971
- (Math.abs(s) <= _ || Math.abs(Math.abs(i) - v) <= _) && (e = this.x0, i >= 0 ? r = this.y0 + Math.PI * this.R * Math.tan(0.5 * n) : r = this.y0 + Math.PI * this.R * -Math.tan(0.5 * n));
2972
- var h = 0.5 * Math.abs(Math.PI / s - s / Math.PI), o = h * h, f = Math.sin(n), u = Math.cos(n), c = u / (f + u - 1), l = c * c, d = c * (2 / f - 1), M = d * d, m = Math.PI * this.R * (h * (c - M) + Math.sqrt(o * (c - M) * (c - M) - (M + o) * (l - M))) / (M + o);
2973
- s < 0 && (m = -m), e = this.x0 + m;
2974
- var y = o + c;
2975
- return m = Math.PI * this.R * (d * y - h * Math.sqrt((M + o) * (o + 1) - y * y)) / (M + o), i >= 0 ? r = this.y0 + m : r = this.y0 - m, t.x = e, t.y = r, t;
2976
- }
2977
- function Pn(t) {
2978
- var a, i, s, e, r, n, h, o, f, u, c, l, d;
2979
- return t.x -= this.x0, t.y -= this.y0, c = Math.PI * this.R, s = t.x / c, e = t.y / c, r = s * s + e * e, n = -Math.abs(e) * (1 + r), h = n - 2 * e * e + s * s, o = -2 * n + 1 + 2 * e * e + r * r, d = e * e / o + (2 * h * h * h / o / o / o - 9 * n * h / o / o) / 27, f = (n - h * h / 3 / o) / o, u = 2 * Math.sqrt(-f / 3), c = 3 * d / f / u, Math.abs(c) > 1 && (c >= 0 ? c = 1 : c = -1), l = Math.acos(c) / 3, t.y >= 0 ? i = (-u * Math.cos(l + Math.PI / 3) - h / 3 / o) * Math.PI : i = -(-u * Math.cos(l + Math.PI / 3) - h / 3 / o) * Math.PI, Math.abs(s) < _ ? a = this.long0 : a = g(this.long0 + Math.PI * (r - 1 + Math.sqrt(1 + 2 * (s * s - e * e) + r * r)) / 2 / s), t.x = a, t.y = i, t;
2980
- }
2981
- var On = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
2982
- const Tn = {
2983
- init: Nn,
2984
- forward: Cn,
2985
- inverse: Pn,
2986
- names: On
2987
- };
2988
- function Ln() {
2989
- this.sin_p12 = Math.sin(this.lat0), this.cos_p12 = Math.cos(this.lat0);
2990
- }
2991
- function Dn(t) {
2992
- var a = t.x, i = t.y, s = Math.sin(t.y), e = Math.cos(t.y), r = g(a - this.long0), n, h, o, f, u, c, l, d, M, m, y, b, x, p, S, A, R, T, P, X, it, st, St;
2993
- return this.sphere ? Math.abs(this.sin_p12 - 1) <= _ ? (t.x = this.x0 + this.a * (v - i) * Math.sin(r), t.y = this.y0 - this.a * (v - i) * Math.cos(r), t) : Math.abs(this.sin_p12 + 1) <= _ ? (t.x = this.x0 + this.a * (v + i) * Math.sin(r), t.y = this.y0 + this.a * (v + i) * Math.cos(r), t) : (T = this.sin_p12 * s + this.cos_p12 * e * Math.cos(r), A = Math.acos(T), R = A ? A / Math.sin(A) : 1, t.x = this.x0 + this.a * R * e * Math.sin(r), t.y = this.y0 + this.a * R * (this.cos_p12 * s - this.sin_p12 * e * Math.cos(r)), t) : (n = At(this.es), h = Rt(this.es), o = It(this.es), f = wt(this.es), Math.abs(this.sin_p12 - 1) <= _ ? (u = this.a * U(n, h, o, f, v), c = this.a * U(n, h, o, f, i), t.x = this.x0 + (u - c) * Math.sin(r), t.y = this.y0 - (u - c) * Math.cos(r), t) : Math.abs(this.sin_p12 + 1) <= _ ? (u = this.a * U(n, h, o, f, v), c = this.a * U(n, h, o, f, i), t.x = this.x0 + (u + c) * Math.sin(r), t.y = this.y0 + (u + c) * Math.cos(r), t) : (l = s / e, d = dt(this.a, this.e, this.sin_p12), M = dt(this.a, this.e, s), m = Math.atan((1 - this.es) * l + this.es * d * this.sin_p12 / (M * e)), y = Math.atan2(Math.sin(r), this.cos_p12 * Math.tan(m) - this.sin_p12 * Math.cos(r)), y === 0 ? P = Math.asin(this.cos_p12 * Math.sin(m) - this.sin_p12 * Math.cos(m)) : Math.abs(Math.abs(y) - Math.PI) <= _ ? P = -Math.asin(this.cos_p12 * Math.sin(m) - this.sin_p12 * Math.cos(m)) : P = Math.asin(Math.sin(r) * Math.cos(m) / Math.sin(y)), b = this.e * this.sin_p12 / Math.sqrt(1 - this.es), x = this.e * this.cos_p12 * Math.cos(y) / Math.sqrt(1 - this.es), p = b * x, S = x * x, X = P * P, it = X * P, st = it * P, St = st * P, A = d * P * (1 - X * S * (1 - S) / 6 + it / 8 * p * (1 - 2 * S) + st / 120 * (S * (4 - 7 * S) - 3 * b * b * (1 - 7 * S)) - St / 48 * p), t.x = this.x0 + A * Math.sin(y), t.y = this.y0 + A * Math.cos(y), t));
2994
- }
2995
- function Bn(t) {
2996
- t.x -= this.x0, t.y -= this.y0;
2997
- var a, i, s, e, r, n, h, o, f, u, c, l, d, M, m, y, b, x, p, S, A, R, T, P;
2998
- return this.sphere ? (a = Math.sqrt(t.x * t.x + t.y * t.y), a > 2 * v * this.a ? void 0 : (i = a / this.a, s = Math.sin(i), e = Math.cos(i), r = this.long0, Math.abs(a) <= _ ? n = this.lat0 : (n = at(e * this.sin_p12 + t.y * s * this.cos_p12 / a), h = Math.abs(this.lat0) - v, Math.abs(h) <= _ ? this.lat0 >= 0 ? r = g(this.long0 + Math.atan2(t.x, -t.y)) : r = g(this.long0 - Math.atan2(-t.x, t.y)) : r = g(this.long0 + Math.atan2(t.x * s, a * this.cos_p12 * e - t.y * this.sin_p12 * s))), t.x = r, t.y = n, t)) : (o = At(this.es), f = Rt(this.es), u = It(this.es), c = wt(this.es), Math.abs(this.sin_p12 - 1) <= _ ? (l = this.a * U(o, f, u, c, v), a = Math.sqrt(t.x * t.x + t.y * t.y), d = l - a, n = qt(d / this.a, o, f, u, c), r = g(this.long0 + Math.atan2(t.x, -1 * t.y)), t.x = r, t.y = n, t) : Math.abs(this.sin_p12 + 1) <= _ ? (l = this.a * U(o, f, u, c, v), a = Math.sqrt(t.x * t.x + t.y * t.y), d = a - l, n = qt(d / this.a, o, f, u, c), r = g(this.long0 + Math.atan2(t.x, t.y)), t.x = r, t.y = n, t) : (a = Math.sqrt(t.x * t.x + t.y * t.y), y = Math.atan2(t.x, t.y), M = dt(this.a, this.e, this.sin_p12), b = Math.cos(y), x = this.e * this.cos_p12 * b, p = -x * x / (1 - this.es), S = 3 * this.es * (1 - p) * this.sin_p12 * this.cos_p12 * b / (1 - this.es), A = a / M, R = A - p * (1 + p) * Math.pow(A, 3) / 6 - S * (1 + 3 * p) * Math.pow(A, 4) / 24, T = 1 - p * R * R / 2 - A * R * R * R / 6, m = Math.asin(this.sin_p12 * Math.cos(R) + this.cos_p12 * Math.sin(R) * b), r = g(this.long0 + Math.asin(Math.sin(y) * Math.sin(R) / Math.cos(m))), P = Math.sin(m), n = Math.atan2((P - this.es * T * this.sin_p12) * Math.tan(m), P * (1 - this.es)), t.x = r, t.y = n, t));
2999
- }
3000
- var Gn = ["Azimuthal_Equidistant", "aeqd"];
3001
- const $n = {
3002
- init: Ln,
3003
- forward: Dn,
3004
- inverse: Bn,
3005
- names: Gn
3006
- };
3007
- function Un() {
3008
- this.sin_p14 = Math.sin(this.lat0), this.cos_p14 = Math.cos(this.lat0);
3009
- }
3010
- function Fn(t) {
3011
- var a, i, s, e, r, n, h, o, f = t.x, u = t.y;
3012
- return s = g(f - this.long0), a = Math.sin(u), i = Math.cos(u), e = Math.cos(s), n = this.sin_p14 * a + this.cos_p14 * i * e, r = 1, (n > 0 || Math.abs(n) <= _) && (h = this.a * r * i * Math.sin(s), o = this.y0 + this.a * r * (this.cos_p14 * a - this.sin_p14 * i * e)), t.x = h, t.y = o, t;
3013
- }
3014
- function qn(t) {
3015
- var a, i, s, e, r, n, h;
3016
- return t.x -= this.x0, t.y -= this.y0, a = Math.sqrt(t.x * t.x + t.y * t.y), i = at(a / this.a), s = Math.sin(i), e = Math.cos(i), n = this.long0, Math.abs(a) <= _ ? (h = this.lat0, t.x = n, t.y = h, t) : (h = at(e * this.sin_p14 + t.y * s * this.cos_p14 / a), r = Math.abs(this.lat0) - v, Math.abs(r) <= _ ? (this.lat0 >= 0 ? n = g(this.long0 + Math.atan2(t.x, -t.y)) : n = g(this.long0 - Math.atan2(-t.x, t.y)), t.x = n, t.y = h, t) : (n = g(this.long0 + Math.atan2(t.x * s, a * this.cos_p14 * e - t.y * this.sin_p14 * s)), t.x = n, t.y = h, t));
3017
- }
3018
- var kn = ["ortho"];
3019
- const zn = {
3020
- init: Un,
3021
- forward: Fn,
3022
- inverse: qn,
3023
- names: kn
3024
- };
3025
- var C = {
3026
- FRONT: 1,
3027
- RIGHT: 2,
3028
- BACK: 3,
3029
- LEFT: 4,
3030
- TOP: 5,
3031
- BOTTOM: 6
3032
- }, I = {
3033
- AREA_0: 1,
3034
- AREA_1: 2,
3035
- AREA_2: 3,
3036
- AREA_3: 4
3037
- };
3038
- function Hn() {
3039
- this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Quadrilateralized Spherical Cube", this.lat0 >= v - w / 2 ? this.face = C.TOP : this.lat0 <= -(v - w / 2) ? this.face = C.BOTTOM : Math.abs(this.long0) <= w ? this.face = C.FRONT : Math.abs(this.long0) <= v + w ? this.face = this.long0 > 0 ? C.RIGHT : C.LEFT : this.face = C.BACK, this.es !== 0 && (this.one_minus_f = 1 - (this.a - this.b) / this.a, this.one_minus_f_squared = this.one_minus_f * this.one_minus_f);
3040
- }
3041
- function jn(t) {
3042
- var a = { x: 0, y: 0 }, i, s, e, r, n, h, o = { value: 0 };
3043
- if (t.x -= this.long0, this.es !== 0 ? i = Math.atan(this.one_minus_f_squared * Math.tan(t.y)) : i = t.y, s = t.x, this.face === C.TOP)
3044
- r = v - i, s >= w && s <= v + w ? (o.value = I.AREA_0, e = s - v) : s > v + w || s <= -(v + w) ? (o.value = I.AREA_1, e = s > 0 ? s - O : s + O) : s > -(v + w) && s <= -w ? (o.value = I.AREA_2, e = s + v) : (o.value = I.AREA_3, e = s);
3045
- else if (this.face === C.BOTTOM)
3046
- r = v + i, s >= w && s <= v + w ? (o.value = I.AREA_0, e = -s + v) : s < w && s >= -w ? (o.value = I.AREA_1, e = -s) : s < -w && s >= -(v + w) ? (o.value = I.AREA_2, e = -s - v) : (o.value = I.AREA_3, e = s > 0 ? -s + O : -s - O);
3047
- else {
3048
- var f, u, c, l, d, M, m;
3049
- this.face === C.RIGHT ? s = ct(s, +v) : this.face === C.BACK ? s = ct(s, +O) : this.face === C.LEFT && (s = ct(s, -v)), l = Math.sin(i), d = Math.cos(i), M = Math.sin(s), m = Math.cos(s), f = d * m, u = d * M, c = l, this.face === C.FRONT ? (r = Math.acos(f), e = Pt(r, c, u, o)) : this.face === C.RIGHT ? (r = Math.acos(u), e = Pt(r, c, -f, o)) : this.face === C.BACK ? (r = Math.acos(-f), e = Pt(r, c, -u, o)) : this.face === C.LEFT ? (r = Math.acos(-u), e = Pt(r, c, f, o)) : (r = e = 0, o.value = I.AREA_0);
3050
- }
3051
- return h = Math.atan(12 / O * (e + Math.acos(Math.sin(e) * Math.cos(w)) - v)), n = Math.sqrt((1 - Math.cos(r)) / (Math.cos(h) * Math.cos(h)) / (1 - Math.cos(Math.atan(1 / Math.cos(e))))), o.value === I.AREA_1 ? h += v : o.value === I.AREA_2 ? h += O : o.value === I.AREA_3 && (h += 1.5 * O), a.x = n * Math.cos(h), a.y = n * Math.sin(h), a.x = a.x * this.a + this.x0, a.y = a.y * this.a + this.y0, t.x = a.x, t.y = a.y, t;
3052
- }
3053
- function Wn(t) {
3054
- var a = { lam: 0, phi: 0 }, i, s, e, r, n, h, o, f, u, c = { value: 0 };
3055
- if (t.x = (t.x - this.x0) / this.a, t.y = (t.y - this.y0) / this.a, s = Math.atan(Math.sqrt(t.x * t.x + t.y * t.y)), i = Math.atan2(t.y, t.x), t.x >= 0 && t.x >= Math.abs(t.y) ? c.value = I.AREA_0 : t.y >= 0 && t.y >= Math.abs(t.x) ? (c.value = I.AREA_1, i -= v) : t.x < 0 && -t.x >= Math.abs(t.y) ? (c.value = I.AREA_2, i = i < 0 ? i + O : i - O) : (c.value = I.AREA_3, i += v), u = O / 12 * Math.tan(i), n = Math.sin(u) / (Math.cos(u) - 1 / Math.sqrt(2)), h = Math.atan(n), e = Math.cos(i), r = Math.tan(s), o = 1 - e * e * r * r * (1 - Math.cos(Math.atan(1 / Math.cos(h)))), o < -1 ? o = -1 : o > 1 && (o = 1), this.face === C.TOP)
3056
- f = Math.acos(o), a.phi = v - f, c.value === I.AREA_0 ? a.lam = h + v : c.value === I.AREA_1 ? a.lam = h < 0 ? h + O : h - O : c.value === I.AREA_2 ? a.lam = h - v : a.lam = h;
3057
- else if (this.face === C.BOTTOM)
3058
- f = Math.acos(o), a.phi = f - v, c.value === I.AREA_0 ? a.lam = -h + v : c.value === I.AREA_1 ? a.lam = -h : c.value === I.AREA_2 ? a.lam = -h - v : a.lam = h < 0 ? -h - O : -h + O;
3059
- else {
3060
- var l, d, M;
3061
- l = o, u = l * l, u >= 1 ? M = 0 : M = Math.sqrt(1 - u) * Math.sin(h), u += M * M, u >= 1 ? d = 0 : d = Math.sqrt(1 - u), c.value === I.AREA_1 ? (u = d, d = -M, M = u) : c.value === I.AREA_2 ? (d = -d, M = -M) : c.value === I.AREA_3 && (u = d, d = M, M = -u), this.face === C.RIGHT ? (u = l, l = -d, d = u) : this.face === C.BACK ? (l = -l, d = -d) : this.face === C.LEFT && (u = l, l = d, d = -u), a.phi = Math.acos(-M) - v, a.lam = Math.atan2(d, l), this.face === C.RIGHT ? a.lam = ct(a.lam, -v) : this.face === C.BACK ? a.lam = ct(a.lam, -O) : this.face === C.LEFT && (a.lam = ct(a.lam, +v));
3062
- }
3063
- if (this.es !== 0) {
3064
- var m, y, b;
3065
- m = a.phi < 0 ? 1 : 0, y = Math.tan(a.phi), b = this.b / Math.sqrt(y * y + this.one_minus_f_squared), a.phi = Math.atan(Math.sqrt(this.a * this.a - b * b) / (this.one_minus_f * b)), m && (a.phi = -a.phi);
3066
- }
3067
- return a.lam += this.long0, t.x = a.lam, t.y = a.phi, t;
3068
- }
3069
- function Pt(t, a, i, s) {
3070
- var e;
3071
- return t < _ ? (s.value = I.AREA_0, e = 0) : (e = Math.atan2(a, i), Math.abs(e) <= w ? s.value = I.AREA_0 : e > w && e <= v + w ? (s.value = I.AREA_1, e -= v) : e > v + w || e <= -(v + w) ? (s.value = I.AREA_2, e = e >= 0 ? e - O : e + O) : (s.value = I.AREA_3, e += v)), e;
3072
- }
3073
- function ct(t, a) {
3074
- var i = t + a;
3075
- return i < -O ? i += aa : i > +O && (i -= aa), i;
3076
- }
3077
- var Xn = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
3078
- const Qn = {
3079
- init: Hn,
3080
- forward: jn,
3081
- inverse: Wn,
3082
- names: Xn
3083
- };
3084
- var sa = [
3085
- [1, 22199e-21, -715515e-10, 31103e-10],
3086
- [0.9986, -482243e-9, -24897e-9, -13309e-10],
3087
- [0.9954, -83103e-8, -448605e-10, -986701e-12],
3088
- [0.99, -135364e-8, -59661e-9, 36777e-10],
3089
- [0.9822, -167442e-8, -449547e-11, -572411e-11],
3090
- [0.973, -214868e-8, -903571e-10, 18736e-12],
3091
- [0.96, -305085e-8, -900761e-10, 164917e-11],
3092
- [0.9427, -382792e-8, -653386e-10, -26154e-10],
3093
- [0.9216, -467746e-8, -10457e-8, 481243e-11],
3094
- [0.8962, -536223e-8, -323831e-10, -543432e-11],
3095
- [0.8679, -609363e-8, -113898e-9, 332484e-11],
3096
- [0.835, -698325e-8, -640253e-10, 934959e-12],
3097
- [0.7986, -755338e-8, -500009e-10, 935324e-12],
3098
- [0.7597, -798324e-8, -35971e-9, -227626e-11],
3099
- [0.7186, -851367e-8, -701149e-10, -86303e-10],
3100
- [0.6732, -986209e-8, -199569e-9, 191974e-10],
3101
- [0.6213, -0.010418, 883923e-10, 624051e-11],
3102
- [0.5722, -906601e-8, 182e-6, 624051e-11],
3103
- [0.5322, -677797e-8, 275608e-9, 624051e-11]
3104
- ], _t = [
3105
- [-520417e-23, 0.0124, 121431e-23, -845284e-16],
3106
- [0.062, 0.0124, -126793e-14, 422642e-15],
3107
- [0.124, 0.0124, 507171e-14, -160604e-14],
3108
- [0.186, 0.0123999, -190189e-13, 600152e-14],
3109
- [0.248, 0.0124002, 710039e-13, -224e-10],
3110
- [0.31, 0.0123992, -264997e-12, 835986e-13],
3111
- [0.372, 0.0124029, 988983e-12, -311994e-12],
3112
- [0.434, 0.0123893, -369093e-11, -435621e-12],
3113
- [0.4958, 0.0123198, -102252e-10, -345523e-12],
3114
- [0.5571, 0.0121916, -154081e-10, -582288e-12],
3115
- [0.6176, 0.0119938, -241424e-10, -525327e-12],
3116
- [0.6769, 0.011713, -320223e-10, -516405e-12],
3117
- [0.7346, 0.0113541, -397684e-10, -609052e-12],
3118
- [0.7903, 0.0109107, -489042e-10, -104739e-11],
3119
- [0.8435, 0.0103431, -64615e-9, -140374e-14],
3120
- [0.8936, 969686e-8, -64636e-9, -8547e-9],
3121
- [0.9394, 840947e-8, -192841e-9, -42106e-10],
3122
- [0.9761, 616527e-8, -256e-6, -42106e-10],
3123
- [1, 328947e-8, -319159e-9, -42106e-10]
3124
- ], Mi = 0.8487, vi = 1.3523, mi = Y / 5, Jn = 1 / mi, ft = 18, kt = function(t, a) {
3125
- return t[0] + a * (t[1] + a * (t[2] + a * t[3]));
3126
- }, Vn = function(t, a) {
3127
- return t[1] + a * (2 * t[2] + a * 3 * t[3]);
3128
- };
3129
- function Kn(t, a, i, s) {
3130
- for (var e = a; s; --s) {
3131
- var r = t(e);
3132
- if (e -= r, Math.abs(r) < i)
3133
- break;
3134
- }
3135
- return e;
3136
- }
3137
- function Yn() {
3138
- this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.long0 = this.long0 || 0, this.es = 0, this.title = this.title || "Robinson";
3139
- }
3140
- function Zn(t) {
3141
- var a = g(t.x - this.long0), i = Math.abs(t.y), s = Math.floor(i * mi);
3142
- s < 0 ? s = 0 : s >= ft && (s = ft - 1), i = Y * (i - Jn * s);
3143
- var e = {
3144
- x: kt(sa[s], i) * a,
3145
- y: kt(_t[s], i)
3146
- };
3147
- return t.y < 0 && (e.y = -e.y), e.x = e.x * this.a * Mi + this.x0, e.y = e.y * this.a * vi + this.y0, e;
3148
- }
3149
- function th(t) {
3150
- var a = {
3151
- x: (t.x - this.x0) / (this.a * Mi),
3152
- y: Math.abs(t.y - this.y0) / (this.a * vi)
3153
- };
3154
- if (a.y >= 1)
3155
- a.x /= sa[ft][0], a.y = t.y < 0 ? -v : v;
3156
- else {
3157
- var i = Math.floor(a.y * ft);
3158
- for (i < 0 ? i = 0 : i >= ft && (i = ft - 1); ; )
3159
- if (_t[i][0] > a.y)
3160
- --i;
3161
- else if (_t[i + 1][0] <= a.y)
3162
- ++i;
3163
- else
3164
- break;
3165
- var s = _t[i], e = 5 * (a.y - s[0]) / (_t[i + 1][0] - s[0]);
3166
- e = Kn(function(r) {
3167
- return (kt(s, r) - a.y) / Vn(s, r);
3168
- }, e, _, 100), a.x /= kt(sa[i], e), a.y = (5 * i + e) * D, t.y < 0 && (a.y = -a.y);
3169
- }
3170
- return a.x = g(a.x + this.long0), a;
3171
- }
3172
- var ah = ["Robinson", "robin"];
3173
- const ih = {
3174
- init: Yn,
3175
- forward: Zn,
3176
- inverse: th,
3177
- names: ah
3178
- };
3179
- function sh() {
3180
- this.name = "geocent";
3181
- }
3182
- function eh(t) {
3183
- var a = ai(t, this.es, this.a);
3184
- return a;
3185
- }
3186
- function rh(t) {
3187
- var a = ii(t, this.es, this.a, this.b);
3188
- return a;
3189
- }
3190
- var nh = ["Geocentric", "geocentric", "geocent", "Geocent"];
3191
- const hh = {
3192
- init: sh,
3193
- forward: eh,
3194
- inverse: rh,
3195
- names: nh
3196
- };
3197
- function oh(t) {
3198
- t.Proj.projections.add(ue), t.Proj.projections.add(Dt), t.Proj.projections.add(Re), t.Proj.projections.add(Le), t.Proj.projections.add(Fe), t.Proj.projections.add(je), t.Proj.projections.add(Ve), t.Proj.projections.add(ar), t.Proj.projections.add(nr), t.Proj.projections.add(cr), t.Proj.projections.add(Sr), t.Proj.projections.add(Lr), t.Proj.projections.add(Ur), t.Proj.projections.add(jr), t.Proj.projections.add(Vr), t.Proj.projections.add(an), t.Proj.projections.add(hn), t.Proj.projections.add(un), t.Proj.projections.add(_n), t.Proj.projections.add(pn), t.Proj.projections.add(Sn), t.Proj.projections.add(Tn), t.Proj.projections.add($n), t.Proj.projections.add(zn), t.Proj.projections.add(Qn), t.Proj.projections.add(ih), t.Proj.projections.add(hh);
3199
- }
3200
- k.defaultDatum = "WGS84";
3201
- k.Proj = J;
3202
- k.WGS84 = new k.Proj("WGS84");
3203
- k.Point = ut;
3204
- k.toPoint = si;
3205
- k.defs = B;
3206
- k.transform = Ft;
3207
- k.mgrs = ks;
3208
- k.version = "__VERSION__";
3209
- oh(k);
3210
- class lh {
3211
- /** Define aliases for one or more projections */
3212
- static defineProjectionAliases(a) {
3213
- const i = [];
3214
- for (const s in a)
3215
- i.push([s, a[s]]);
3216
- k.defs(i);
3217
- }
3218
- constructor({ from: a = "WGS84", to: i = "WGS84" }) {
3219
- if (this._projection = k(a, i), !this._projection)
3220
- throw new Error("Invalid projection");
3221
- this.project = this.project.bind(this), this.unproject = this.unproject.bind(this);
3222
- }
3223
- /** Project a coordinate project from first to second coordinate system */
3224
- project(a) {
3225
- return this._projection.forward(a);
3226
- }
3227
- /** Project a coordinate project from second to first coordinate system */
3228
- unproject(a) {
3229
- return this._projection.inverse(a);
3230
- }
3231
- }
3232
- const Kt = 100, Ta = !1;
3233
- function fh(t) {
3234
- const a = new DataView(t, 0, Kt), s = qa(a).length - Kt, e = new DataView(t, Kt, s), r = new Int32Array(s), n = new Int32Array(s);
3235
- for (let h = 0; h < s / 8; h++)
3236
- r[h] = e.getInt32(h * 8, Ta), n[h] = e.getInt32(h * 8 + 4, Ta);
3237
- return {
3238
- offsets: r,
3239
- lengths: n
3240
- };
3241
- }
3242
- async function* ch(t, a, i) {
3243
- const s = [], e = [];
3244
- let r = !1, n = !1;
3245
- for (; !r && !n; ) {
3246
- if (s.length === 0 && !r) {
3247
- const { value: o, done: f } = await t.next();
3248
- f ? r = !0 : s.push(...o);
3249
- }
3250
- if (e.length === 0 && !n) {
3251
- const { value: o, done: f } = await a.next();
3252
- f ? n = !0 : e.push(...o);
3253
- }
3254
- const h = uh(s, e);
3255
- h && (yield {
3256
- batchType: "data",
3257
- shape: i,
3258
- length: h.length,
3259
- data: h
3260
- });
3261
- }
3262
- }
3263
- function uh(t, a) {
3264
- const i = Math.min(t.length, a.length);
3265
- if (i === 0)
3266
- return null;
3267
- const s = [t.slice(0, i), a.slice(0, i)];
3268
- return t.splice(0, i), a.splice(0, i), s;
3269
- }
3270
- const Yt = !0, La = 32;
3271
- var G;
3272
- (function(t) {
3273
- t[t.START = 0] = "START", t[t.FIELD_DESCRIPTORS = 1] = "FIELD_DESCRIPTORS", t[t.FIELD_PROPERTIES = 2] = "FIELD_PROPERTIES", t[t.END = 3] = "END", t[t.ERROR = 4] = "ERROR";
3274
- })(G || (G = {}));
3275
- let yi = class {
3276
- constructor(a) {
3277
- N(this, "binaryReader", new ea());
3278
- N(this, "textDecoder");
3279
- N(this, "state", G.START);
3280
- N(this, "result", {
3281
- data: []
3282
- });
3283
- this.textDecoder = new TextDecoder(a.encoding);
3284
- }
3285
- /**
3286
- * @param arrayBuffer
3287
- */
3288
- write(a) {
3289
- this.binaryReader.write(a), this.state = Ba(this.state, this.result, this.binaryReader, this.textDecoder);
3290
- }
3291
- end() {
3292
- this.binaryReader.end(), this.state = Ba(this.state, this.result, this.binaryReader, this.textDecoder), this.state !== G.END && (this.state = G.ERROR, this.result.error = "DBF incomplete file");
3293
- }
3294
- };
3295
- function Da(t, a = {}) {
3296
- var h;
3297
- const { encoding: i = "latin1" } = a.dbf || {}, s = new yi({ encoding: i });
3298
- s.write(t), s.end();
3299
- const { data: e, schema: r } = s.result;
3300
- switch ((h = a == null ? void 0 : a.dbf) == null ? void 0 : h.shape) {
3301
- case "object-row-table":
3302
- return {
3303
- shape: "object-row-table",
3304
- schema: r,
3305
- data: e
3306
- };
3307
- case "table":
3308
- return { schema: r, rows: e };
3309
- case "rows":
3310
- default:
3311
- return e;
3312
- }
3313
- }
3314
- async function* dh(t, a = {}) {
3315
- const { encoding: i = "latin1" } = a.dbf || {}, s = new yi({ encoding: i });
3316
- let e = !1;
3317
- for await (const r of zt(t))
3318
- s.write(r), !e && s.result.dbfHeader && (e = !0, yield s.result.dbfHeader), s.result.data.length > 0 && (yield s.result.data, s.result.data = []);
3319
- s.end(), s.result.data.length > 0 && (yield s.result.data);
3320
- }
3321
- function Ba(t, a, i, s) {
3322
- for (; ; )
3323
- try {
3324
- switch (t) {
3325
- case G.ERROR:
3326
- case G.END:
3327
- return t;
3328
- case G.START:
3329
- const e = i.getDataView(La);
3330
- if (!e)
3331
- return t;
3332
- a.dbfHeader = Mh(e), a.progress = {
3333
- bytesUsed: 0,
3334
- rowsTotal: a.dbfHeader.nRecords,
3335
- rows: 0
3336
- }, t = G.FIELD_DESCRIPTORS;
3337
- break;
3338
- case G.FIELD_DESCRIPTORS:
3339
- const r = i.getDataView(
3340
- // @ts-ignore
3341
- a.dbfHeader.headerLength - La
3342
- );
3343
- if (!r)
3344
- return t;
3345
- a.dbfFields = vh(r, s), a.schema = {
3346
- fields: a.dbfFields.map((o) => Eh(o)),
3347
- metadata: {}
3348
- }, t = G.FIELD_PROPERTIES, i.skip(1);
3349
- break;
3350
- case G.FIELD_PROPERTIES:
3351
- const { recordLength: n = 0, nRecords: h = 0 } = (a == null ? void 0 : a.dbfHeader) || {};
3352
- for (; a.data.length < h; ) {
3353
- const o = i.getDataView(n - 1);
3354
- if (!o)
3355
- return t;
3356
- i.skip(1);
3357
- const f = mh(o, a.dbfFields, s);
3358
- a.data.push(f), a.progress.rows = a.data.length;
3359
- }
3360
- t = G.END;
3361
- break;
3362
- default:
3363
- return t = G.ERROR, a.error = `illegal parser state ${t}`, t;
3364
- }
3365
- } catch (e) {
3366
- return t = G.ERROR, a.error = `DBF parsing failed: ${e.message}`, t;
3367
- }
3368
- }
3369
- function Mh(t) {
3370
- return {
3371
- // Last updated date
3372
- year: t.getUint8(1) + 1900,
3373
- month: t.getUint8(2),
3374
- day: t.getUint8(3),
3375
- // Number of records in data file
3376
- nRecords: t.getUint32(4, Yt),
3377
- // Length of header in bytes
3378
- headerLength: t.getUint16(8, Yt),
3379
- // Length of each record
3380
- recordLength: t.getUint16(10, Yt),
3381
- // Not sure if this is usually set
3382
- languageDriver: t.getUint8(29)
3383
- };
3384
- }
3385
- function vh(t, a) {
3386
- const i = (t.byteLength - 1) / 32, s = [];
3387
- let e = 0;
3388
- for (let r = 0; r < i; r++) {
3389
- const n = a.decode(new Uint8Array(t.buffer, t.byteOffset + e, 11)).replace(/\u0000/g, "");
3390
- s.push({
3391
- name: n,
3392
- dataType: String.fromCharCode(t.getUint8(e + 11)),
3393
- fieldLength: t.getUint8(e + 16),
3394
- decimal: t.getUint8(e + 17)
3395
- }), e += 32;
3396
- }
3397
- return s;
3398
- }
3399
- function mh(t, a, i) {
3400
- const s = {};
3401
- let e = 0;
3402
- for (const r of a) {
3403
- const n = i.decode(new Uint8Array(t.buffer, t.byteOffset + e, r.fieldLength));
3404
- s[r.name] = yh(n, r.dataType), e += r.fieldLength;
3405
- }
3406
- return s;
3407
- }
3408
- function yh(t, a) {
3409
- switch (a) {
3410
- case "B":
3411
- return Ot(t);
3412
- case "C":
3413
- return bh(t);
3414
- case "F":
3415
- return Ot(t);
3416
- case "N":
3417
- return Ot(t);
3418
- case "O":
3419
- return Ot(t);
3420
- case "D":
3421
- return _h(t);
3422
- case "L":
3423
- return gh(t);
3424
- default:
3425
- throw new Error("Unsupported data type");
3426
- }
3427
- }
3428
- function _h(t) {
3429
- return Date.UTC(t.slice(0, 4), parseInt(t.slice(4, 6), 10) - 1, t.slice(6, 8));
3430
- }
3431
- function gh(t) {
3432
- return /^[nf]$/i.test(t) ? !1 : /^[yt]$/i.test(t) ? !0 : null;
3433
- }
3434
- function Ot(t) {
3435
- const a = parseFloat(t);
3436
- return isNaN(a) ? null : a;
3437
- }
3438
- function bh(t) {
3439
- return t.trim() || null;
3440
- }
3441
- function Eh({ name: t, dataType: a, fieldLength: i, decimal: s }) {
3442
- switch (a) {
3443
- case "B":
3444
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3445
- case "C":
3446
- return { name: t, type: "utf8", nullable: !0, metadata: {} };
3447
- case "F":
3448
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3449
- case "N":
3450
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3451
- case "O":
3452
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3453
- case "D":
3454
- return { name: t, type: "timestamp-millisecond", nullable: !0, metadata: {} };
3455
- case "L":
3456
- return { name: t, type: "bool", nullable: !0, metadata: {} };
3457
- default:
3458
- throw new Error("Unsupported data type");
3459
- }
3460
- }
3461
- const xh = "4.4.3", ph = {
3462
- name: "DBF",
3463
- dataType: null,
3464
- batchType: null,
3465
- id: "dbf",
3466
- module: "shapefile",
3467
- version: xh,
3468
- worker: !0,
3469
- category: "table",
3470
- extensions: ["dbf"],
3471
- mimeTypes: ["application/x-dbf"],
3472
- options: {
3473
- dbf: {
3474
- encoding: "latin1"
3475
- }
3476
- }
3477
- }, _i = {
3478
- ...ph,
3479
- parse: async (t, a) => Da(t, a),
3480
- parseSync: Da,
3481
- parseInBatches(t, a) {
3482
- return dh(t, a);
3483
- }
3484
- };
3485
- async function* Ah(t, a, i) {
3486
- var y, b, x;
3487
- const { reproject: s = !1, _targetCrs: e = "WGS84" } = (a == null ? void 0 : a.gis) || {}, { shx: r, cpg: n, prj: h } = await xi(a, i), o = await ca(zt(t), ja, a, i), f = ((y = o[Symbol.asyncIterator]) == null ? void 0 : y.call(o)) || ((b = o[Symbol.iterator]) == null ? void 0 : b.call(o));
3488
- let u = null;
3489
- const c = await (i == null ? void 0 : i.fetch(bt((i == null ? void 0 : i.url) || "", "dbf")));
3490
- if (c != null && c.ok) {
3491
- const p = await ca(c, _i, {
3492
- ...a,
3493
- dbf: {
3494
- ...a == null ? void 0 : a.dbf,
3495
- encoding: n || "latin1"
3496
- }
3497
- }, i);
3498
- u = ((x = p[Symbol.asyncIterator]) == null ? void 0 : x.call(p)) || p[Symbol.iterator]();
3499
- }
3500
- let l = (await f.next()).value;
3501
- l && l.batchType === "metadata" && (l = (await f.next()).value);
3502
- let d = {};
3503
- u && (d = (await u.next()).value, d && d.batchType === "metadata" && (d = (await u.next()).value));
3504
- const M = u ? ch(f, u, "object-row-table") : f, m = {
3505
- [Symbol.asyncIterator]() {
3506
- return M;
3507
- }
3508
- };
3509
- for await (const p of m) {
3510
- let S, A;
3511
- u ? [S, A] = p.data : S = p;
3512
- const R = gi(S);
3513
- let T = bi(R, A);
3514
- s && (T = Ei(T, h, e)), yield {
3515
- encoding: n,
3516
- prj: h,
3517
- shx: r,
3518
- header: l,
3519
- data: T
3520
- };
3521
- }
3522
- }
3523
- async function Rh(t, a, i) {
3524
- var M;
3525
- const { reproject: s = !1, _targetCrs: e = "WGS84" } = (a == null ? void 0 : a.gis) || {}, { shx: r, cpg: n, prj: h } = await xi(a, i), { header: o, geometries: f } = await ua(t, ja, a, i), u = gi(f);
3526
- let c;
3527
- const l = await (i == null ? void 0 : i.fetch(bt(i == null ? void 0 : i.url, "dbf")));
3528
- if (l != null && l.ok) {
3529
- const m = {
3530
- ...a,
3531
- dbf: {
3532
- ...a == null ? void 0 : a.dbf,
3533
- shape: "object-row-table",
3534
- encoding: n || "latin1"
3535
- }
3536
- };
3537
- c = await ua(l, _i, m, i);
3538
- }
3539
- let d = bi(u, (c == null ? void 0 : c.data) || []);
3540
- switch (s && (d = Ei(d, h, e)), (M = a == null ? void 0 : a.shapefile) == null ? void 0 : M.shape) {
3541
- case "geojson-table":
3542
- return {
3543
- // @ts-expect-error
3544
- shape: "geojson-table",
3545
- type: "FeatureCollection",
3546
- encoding: n,
3547
- schema: (c == null ? void 0 : c.schema) || { metadata: {}, fields: [] },
3548
- prj: h,
3549
- shx: r,
3550
- header: o,
3551
- features: d
3552
- };
3553
- default:
3554
- return {
3555
- encoding: n,
3556
- prj: h,
3557
- shx: r,
3558
- header: o,
3559
- data: d
3560
- };
3561
- }
3562
- }
3563
- function gi(t) {
3564
- const a = [];
3565
- for (const i of t)
3566
- a.push(wi(i));
3567
- return a;
3568
- }
3569
- function bi(t, a) {
3570
- const i = [];
3571
- for (let s = 0; s < t.length; s++) {
3572
- const r = {
3573
- type: "Feature",
3574
- geometry: t[s],
3575
- // properties can be undefined if dbfResponse above was empty
3576
- properties: a && a[s] || {}
3577
- };
3578
- i.push(r);
3579
- }
3580
- return i;
3581
- }
3582
- function Ei(t, a, i) {
3583
- if (!a && !i)
3584
- return t;
3585
- const s = new lh({ from: a || "WGS84", to: i || "WGS84" });
3586
- return Li(t, (e) => s.project(e));
3587
- }
3588
- async function xi(t, a) {
3589
- const { url: i, fetch: s } = a, e = s(bt(i, "shx")), r = s(bt(i, "cpg")), n = s(bt(i, "prj"));
3590
- await Promise.all([e, r, n]);
3591
- let h, o, f;
3592
- const u = await e;
3593
- if (u.ok) {
3594
- const d = await u.arrayBuffer();
3595
- h = fh(d);
3596
- }
3597
- const c = await r;
3598
- c.ok && (o = await c.text());
3599
- const l = await n;
3600
- return l.ok && (f = await l.text()), {
3601
- shx: h,
3602
- cpg: o,
3603
- prj: f
3604
- };
3605
- }
3606
- function bt(t, a) {
3607
- const i = Ih(t), s = wh(t);
3608
- return s === s.toUpperCase() && (a = a.toUpperCase()), `${i}.${a}`;
3609
- }
3610
- function Ih(t) {
3611
- const a = t && t.lastIndexOf(".");
3612
- return typeof a == "number" ? a >= 0 ? t.substr(0, a) : "" : a;
3613
- }
3614
- function wh(t) {
3615
- const a = t && t.lastIndexOf(".");
3616
- return typeof a == "number" ? a >= 0 ? t.substr(a + 1) : "" : a;
3617
- }
3618
- const Sh = "4.4.3", Wh = {
3619
- name: "Shapefile",
3620
- id: "shapefile",
3621
- module: "shapefile",
3622
- version: Sh,
3623
- category: "geometry",
3624
- extensions: ["shp"],
3625
- mimeTypes: ["application/octet-stream"],
3626
- tests: [new Uint8Array(Ha).buffer],
3627
- options: {
3628
- shapefile: {
3629
- shape: "v3"
3630
- },
3631
- shp: {
3632
- _maxDimensions: 4
3633
- }
3634
- },
3635
- // @ts-expect-error
3636
- parse: Rh,
3637
- // @ts-expect-error
3638
- parseInBatches: Ah
3639
- }, Zt = !0, Ga = 32;
3640
- var $;
3641
- (function(t) {
3642
- t[t.START = 0] = "START", t[t.FIELD_DESCRIPTORS = 1] = "FIELD_DESCRIPTORS", t[t.FIELD_PROPERTIES = 2] = "FIELD_PROPERTIES", t[t.END = 3] = "END", t[t.ERROR = 4] = "ERROR";
3643
- })($ || ($ = {}));
3644
- class pi {
3645
- constructor(a) {
3646
- N(this, "binaryReader", new ea());
3647
- N(this, "textDecoder");
3648
- N(this, "state", $.START);
3649
- N(this, "result", {});
3650
- this.textDecoder = new TextDecoder(a.encoding);
3651
- }
3652
- /**
3653
- * @param arrayBuffer
3654
- */
3655
- write(a) {
3656
- this.binaryReader.write(a), this.state = Ua(this.state, this.result, this.binaryReader, this.textDecoder);
3657
- }
3658
- end() {
3659
- this.binaryReader.end(), this.state = Ua(this.state, this.result, this.binaryReader, this.textDecoder), this.state !== $.END && (this.state = $.ERROR, this.result.error = "DBF incomplete file");
3660
- }
3661
- }
3662
- function $a(t, a = {}) {
3663
- const { encoding: i = "latin1" } = a.dbf || {}, s = new pi({ encoding: i });
3664
- return s.write(t), s.end(), s.result.tableBuilder.finishTable();
3665
- }
3666
- async function* Nh(t, a = {}) {
3667
- const { encoding: i = "latin1" } = a.dbf || {}, s = new pi({ encoding: i });
3668
- let e = !1;
3669
- for await (const h of zt(t)) {
3670
- if (s.write(h), !e && s.result.dbfHeader) {
3671
- e = !0;
3672
- const c = s.result.tableBuilder.firstBatch();
3673
- c && (yield c);
3674
- }
3675
- const f = s.result.tableBuilder.flushBatch();
3676
- f && (yield f);
3677
- }
3678
- s.end();
3679
- const n = s.result.tableBuilder.finishBatch();
3680
- n && (yield n);
3681
- }
3682
- function Ua(t, a, i, s) {
3683
- for (; ; )
3684
- try {
3685
- switch (t) {
3686
- case $.ERROR:
3687
- case $.END:
3688
- return t;
3689
- case $.START:
3690
- const e = i.getDataView(Ga);
3691
- if (!e)
3692
- return t;
3693
- a.dbfHeader = Ch(e), a.progress = {
3694
- bytesUsed: 0,
3695
- rowsTotal: a.dbfHeader.nRecords,
3696
- rows: 0
3697
- }, t = $.FIELD_DESCRIPTORS;
3698
- break;
3699
- case $.FIELD_DESCRIPTORS:
3700
- const r = i.getDataView(
3701
- // @ts-ignore
3702
- a.dbfHeader.headerLength - Ga
3703
- );
3704
- if (!r)
3705
- return t;
3706
- a.dbfFields = Ph(r, s);
3707
- const n = {
3708
- fields: a.dbfFields.map((u) => Gh(u)),
3709
- metadata: {}
3710
- };
3711
- a.tableBuilder = new Ti(n), t = $.FIELD_PROPERTIES, i.skip(1);
3712
- break;
3713
- case $.FIELD_PROPERTIES:
3714
- const { recordLength: h = 0, nRecords: o = 0 } = (a == null ? void 0 : a.dbfHeader) || {};
3715
- let f = 0;
3716
- for (; f < o; ) {
3717
- f++;
3718
- const u = i.getDataView(h - 1);
3719
- if (!u)
3720
- return t;
3721
- i.skip(1);
3722
- const c = Oh(u, a.dbfFields, s);
3723
- a.tableBuilder.addObjectRow(c);
3724
- }
3725
- t = $.END;
3726
- break;
3727
- default:
3728
- return t = $.ERROR, a.error = `illegal parser state ${t}`, t;
3729
- }
3730
- } catch (e) {
3731
- return t = $.ERROR, a.error = `DBF parsing failed: ${e.message}`, t;
3732
- }
3733
- }
3734
- function Ch(t) {
3735
- return {
3736
- // Last updated date
3737
- year: t.getUint8(1) + 1900,
3738
- month: t.getUint8(2),
3739
- day: t.getUint8(3),
3740
- // Number of records in data file
3741
- nRecords: t.getUint32(4, Zt),
3742
- // Length of header in bytes
3743
- headerLength: t.getUint16(8, Zt),
3744
- // Length of each record
3745
- recordLength: t.getUint16(10, Zt),
3746
- // Not sure if this is usually set
3747
- languageDriver: t.getUint8(29)
3748
- };
3749
- }
3750
- function Ph(t, a) {
3751
- const i = (t.byteLength - 1) / 32, s = [];
3752
- let e = 0;
3753
- for (let r = 0; r < i; r++) {
3754
- const n = a.decode(new Uint8Array(t.buffer, t.byteOffset + e, 11)).replace(/\u0000/g, "");
3755
- s.push({
3756
- name: n,
3757
- dataType: String.fromCharCode(t.getUint8(e + 11)),
3758
- fieldLength: t.getUint8(e + 16),
3759
- decimal: t.getUint8(e + 17)
3760
- }), e += 32;
3761
- }
3762
- return s;
3763
- }
3764
- function Oh(t, a, i) {
3765
- const s = {};
3766
- let e = 0;
3767
- for (const r of a) {
3768
- const n = i.decode(new Uint8Array(t.buffer, t.byteOffset + e, r.fieldLength));
3769
- s[r.name] = Th(n, r.dataType), e += r.fieldLength;
3770
- }
3771
- return s;
3772
- }
3773
- function Th(t, a) {
3774
- switch (a) {
3775
- case "B":
3776
- return Tt(t);
3777
- case "C":
3778
- return Bh(t);
3779
- case "F":
3780
- return Tt(t);
3781
- case "N":
3782
- return Tt(t);
3783
- case "O":
3784
- return Tt(t);
3785
- case "D":
3786
- return Lh(t);
3787
- case "L":
3788
- return Dh(t);
3789
- default:
3790
- throw new Error("Unsupported data type");
3791
- }
3792
- }
3793
- function Lh(t) {
3794
- return Date.UTC(t.slice(0, 4), parseInt(t.slice(4, 6), 10) - 1, t.slice(6, 8));
3795
- }
3796
- function Dh(t) {
3797
- return /^[nf]$/i.test(t) ? !1 : /^[yt]$/i.test(t) ? !0 : null;
3798
- }
3799
- function Tt(t) {
3800
- const a = parseFloat(t);
3801
- return isNaN(a) ? null : a;
3802
- }
3803
- function Bh(t) {
3804
- return t.trim() || null;
3805
- }
3806
- function Gh({ name: t, dataType: a, fieldLength: i, decimal: s }) {
3807
- switch (a) {
3808
- case "B":
3809
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3810
- case "C":
3811
- return { name: t, type: "utf8", nullable: !0, metadata: {} };
3812
- case "F":
3813
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3814
- case "N":
3815
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3816
- case "O":
3817
- return { name: t, type: "float64", nullable: !0, metadata: {} };
3818
- case "D":
3819
- return { name: t, type: "timestamp-millisecond", nullable: !0, metadata: {} };
3820
- case "L":
3821
- return { name: t, type: "bool", nullable: !0, metadata: {} };
3822
- default:
3823
- throw new Error("Unsupported data type");
3824
- }
3825
- }
3826
- const $h = {
3827
- name: "DBF",
3828
- id: "dbf",
3829
- module: "shapefile",
3830
- category: "table",
3831
- extensions: ["dbf"],
3832
- mimeTypes: ["application/x-dbf"]
3833
- }, Uh = "4.4.3", Fh = {
3834
- ...$h,
3835
- dataType: null,
3836
- batchType: null,
3837
- version: Uh,
3838
- worker: !0,
3839
- options: {
3840
- dbf: {
3841
- encoding: "latin1"
3842
- }
3843
- }
3844
- }, Xh = {
3845
- ...Fh,
3846
- parse: async (t, a) => $a(t, a),
3847
- parseSync: $a,
3848
- parseInBatches(t, a) {
3849
- return Nh(t, a);
3850
- }
3851
- };
3852
- class Qh {
3853
- constructor(a) {
3854
- N(this, "offset");
3855
- N(this, "arrayBuffer");
3856
- this.offset = 0, this.arrayBuffer = a;
3857
- }
3858
- /**
3859
- * Checks if there are available bytes in data
3860
- *
3861
- * @param bytes
3862
- * @returns boolean
3863
- */
3864
- hasAvailableBytes(a) {
3865
- return this.arrayBuffer.byteLength - this.offset >= a;
3866
- }
3867
- /**
3868
- * Get the required number of bytes from the iterator
3869
- *
3870
- * @param bytes
3871
- * @returns Dataview
3872
- */
3873
- getDataView(a) {
3874
- if (a && !this.hasAvailableBytes(a))
3875
- throw new Error("binary data exhausted");
3876
- const i = a ? new DataView(this.arrayBuffer, this.offset, a) : new DataView(this.arrayBuffer, this.offset);
3877
- return this.offset += a, i;
3878
- }
3879
- /**
3880
- * Skipping
3881
- *
3882
- * @param bytes
3883
- */
3884
- skip(a) {
3885
- this.offset += a;
3886
- }
3887
- /**
3888
- * Rewinding
3889
- *
3890
- * @param bytes
3891
- */
3892
- rewind(a) {
3893
- this.offset -= a;
3894
- }
3895
- }
3896
- export {
3897
- Xh as DBFArrowLoader,
3898
- Fh as DBFArrowWorkerLoader,
3899
- _i as DBFLoader,
3900
- ph as DBFWorkerLoader,
3901
- ja as SHPLoader,
3902
- ji as SHPWorkerLoader,
3903
- Wh as ShapefileLoader,
3904
- ea as _BinaryChunkReader,
3905
- Qh as _BinaryReader,
3906
- ch as _zipBatchIterators
3907
- };