@loaders.gl/flatgeobuf 4.4.0-alpha.2 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/dist.dev.js +659 -40
  2. package/dist/dist.min.js +2 -2
  3. package/dist/flatgeobuf/3.27.2/column-meta.js +1 -0
  4. package/dist/flatgeobuf/3.27.2/column-meta.js.map +1 -0
  5. package/dist/flatgeobuf/3.27.2/config.js +1 -0
  6. package/dist/flatgeobuf/3.27.2/config.js.map +1 -0
  7. package/dist/flatgeobuf/3.27.2/constants.js +1 -0
  8. package/dist/flatgeobuf/3.27.2/constants.js.map +1 -0
  9. package/dist/flatgeobuf/3.27.2/crs-meta.js +1 -0
  10. package/dist/flatgeobuf/3.27.2/crs-meta.js.map +1 -0
  11. package/dist/flatgeobuf/3.27.2/dumptree.js +1 -0
  12. package/dist/flatgeobuf/3.27.2/dumptree.js.map +1 -0
  13. package/dist/flatgeobuf/3.27.2/feature.js +1 -0
  14. package/dist/flatgeobuf/3.27.2/feature.js.map +1 -0
  15. package/dist/flatgeobuf/3.27.2/flat-geobuf/column-type.js +1 -0
  16. package/dist/flatgeobuf/3.27.2/flat-geobuf/column-type.js.map +1 -0
  17. package/dist/flatgeobuf/3.27.2/flat-geobuf/column.js +1 -0
  18. package/dist/flatgeobuf/3.27.2/flat-geobuf/column.js.map +1 -0
  19. package/dist/flatgeobuf/3.27.2/flat-geobuf/crs.js +1 -0
  20. package/dist/flatgeobuf/3.27.2/flat-geobuf/crs.js.map +1 -0
  21. package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.js +1 -0
  22. package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.js.map +1 -0
  23. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry-type.js +1 -0
  24. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry-type.js.map +1 -0
  25. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.js +1 -0
  26. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.js.map +1 -0
  27. package/dist/flatgeobuf/3.27.2/flat-geobuf/header.js +1 -0
  28. package/dist/flatgeobuf/3.27.2/flat-geobuf/header.js.map +1 -0
  29. package/dist/flatgeobuf/3.27.2/flat-geobuf.js +1 -0
  30. package/dist/flatgeobuf/3.27.2/flat-geobuf.js.map +1 -0
  31. package/dist/flatgeobuf/3.27.2/generic/feature.js +1 -0
  32. package/dist/flatgeobuf/3.27.2/generic/feature.js.map +1 -0
  33. package/dist/flatgeobuf/3.27.2/generic/featurecollection.d.ts.map +1 -1
  34. package/dist/flatgeobuf/3.27.2/generic/featurecollection.js +2 -0
  35. package/dist/flatgeobuf/3.27.2/generic/featurecollection.js.map +1 -0
  36. package/dist/flatgeobuf/3.27.2/generic/geometry.js +1 -0
  37. package/dist/flatgeobuf/3.27.2/generic/geometry.js.map +1 -0
  38. package/dist/flatgeobuf/3.27.2/generic/header.js +1 -0
  39. package/dist/flatgeobuf/3.27.2/generic/header.js.map +1 -0
  40. package/dist/flatgeobuf/3.27.2/generic/index.js +1 -0
  41. package/dist/flatgeobuf/3.27.2/generic/index.js.map +1 -0
  42. package/dist/flatgeobuf/3.27.2/generic.js +1 -0
  43. package/dist/flatgeobuf/3.27.2/generic.js.map +1 -0
  44. package/dist/flatgeobuf/3.27.2/geojson/feature.js +1 -0
  45. package/dist/flatgeobuf/3.27.2/geojson/feature.js.map +1 -0
  46. package/dist/flatgeobuf/3.27.2/geojson/featurecollection.js +1 -0
  47. package/dist/flatgeobuf/3.27.2/geojson/featurecollection.js.map +1 -0
  48. package/dist/flatgeobuf/3.27.2/geojson/geometry.js +1 -0
  49. package/dist/flatgeobuf/3.27.2/geojson/geometry.js.map +1 -0
  50. package/dist/flatgeobuf/3.27.2/geojson/index.js +1 -0
  51. package/dist/flatgeobuf/3.27.2/geojson/index.js.map +1 -0
  52. package/dist/flatgeobuf/3.27.2/geojson.js +1 -0
  53. package/dist/flatgeobuf/3.27.2/geojson.js.map +1 -0
  54. package/dist/flatgeobuf/3.27.2/header-meta.js +1 -0
  55. package/dist/flatgeobuf/3.27.2/header-meta.js.map +1 -0
  56. package/dist/flatgeobuf/3.27.2/header.js +1 -0
  57. package/dist/flatgeobuf/3.27.2/header.js.map +1 -0
  58. package/dist/flatgeobuf/3.27.2/http-reader.js +1 -0
  59. package/dist/flatgeobuf/3.27.2/http-reader.js.map +1 -0
  60. package/dist/flatgeobuf/3.27.2/index.js +1 -0
  61. package/dist/flatgeobuf/3.27.2/index.js.map +1 -0
  62. package/dist/flatgeobuf/3.27.2/logger.js +1 -0
  63. package/dist/flatgeobuf/3.27.2/logger.js.map +1 -0
  64. package/dist/flatgeobuf/3.27.2/packedrtree.js +1 -0
  65. package/dist/flatgeobuf/3.27.2/packedrtree.js.map +1 -0
  66. package/dist/flatgeobuf/3.27.2/streams/utils.js +1 -0
  67. package/dist/flatgeobuf/3.27.2/streams/utils.js.map +1 -0
  68. package/dist/flatgeobuf-format.js +1 -0
  69. package/dist/flatgeobuf-format.js.map +1 -0
  70. package/dist/flatgeobuf-loader.d.ts +2 -2
  71. package/dist/flatgeobuf-loader.js +2 -1
  72. package/dist/flatgeobuf-loader.js.map +1 -0
  73. package/dist/flatgeobuf-source.js +1 -0
  74. package/dist/flatgeobuf-source.js.map +1 -0
  75. package/dist/flatgeobuf-worker.js +645 -40
  76. package/dist/index.cjs +1 -1
  77. package/dist/index.cjs.map +3 -3
  78. package/dist/index.js +1 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/lib/binary-geometries.d.ts +6 -6
  81. package/dist/lib/binary-geometries.js +1 -0
  82. package/dist/lib/binary-geometries.js.map +1 -0
  83. package/dist/lib/get-schema-from-fgb-header.js +1 -0
  84. package/dist/lib/get-schema-from-fgb-header.js.map +1 -0
  85. package/dist/lib/parse-flatgeobuf.js +1 -0
  86. package/dist/lib/parse-flatgeobuf.js.map +1 -0
  87. package/dist/workers/flatgeobuf-worker.js +1 -0
  88. package/dist/workers/flatgeobuf-worker.js.map +1 -0
  89. package/package.json +8 -5
  90. package/src/flatgeobuf/3.27.2/generic/featurecollection.ts +1 -0
@@ -201,7 +201,10 @@
201
201
  options = {
202
202
  ...options,
203
203
  modules: loader && loader.options && loader.options.modules || {},
204
- worker: false
204
+ core: {
205
+ ...options.core,
206
+ worker: false
207
+ }
205
208
  };
206
209
  return await parser(data, { ...options }, context, loader);
207
210
  }
@@ -415,6 +418,328 @@
415
418
  return self2;
416
419
  }
417
420
 
421
+ // ../../node_modules/wkt-parser/PROJJSONBuilderBase.js
422
+ var PROJJSONBuilderBase = class {
423
+ static getId(node) {
424
+ const idNode = node.find((child) => Array.isArray(child) && child[0] === "ID");
425
+ if (idNode && idNode.length >= 3) {
426
+ return {
427
+ authority: idNode[1],
428
+ code: parseInt(idNode[2], 10)
429
+ };
430
+ }
431
+ return null;
432
+ }
433
+ static convertUnit(node, type = "unit") {
434
+ if (!node || node.length < 3) {
435
+ return { type, name: "unknown", conversion_factor: null };
436
+ }
437
+ const name = node[1];
438
+ const conversionFactor = parseFloat(node[2]) || null;
439
+ const idNode = node.find((child) => Array.isArray(child) && child[0] === "ID");
440
+ const id = idNode ? {
441
+ authority: idNode[1],
442
+ code: parseInt(idNode[2], 10)
443
+ } : null;
444
+ return {
445
+ type,
446
+ name,
447
+ conversion_factor: conversionFactor,
448
+ id
449
+ };
450
+ }
451
+ static convertAxis(node) {
452
+ const name = node[1] || "Unknown";
453
+ let direction;
454
+ const abbreviationMatch = name.match(/^\((.)\)$/);
455
+ if (abbreviationMatch) {
456
+ const abbreviation = abbreviationMatch[1].toUpperCase();
457
+ if (abbreviation === "E")
458
+ direction = "east";
459
+ else if (abbreviation === "N")
460
+ direction = "north";
461
+ else if (abbreviation === "U")
462
+ direction = "up";
463
+ else
464
+ throw new Error(`Unknown axis abbreviation: ${abbreviation}`);
465
+ } else {
466
+ direction = node[2] ? node[2].toLowerCase() : "unknown";
467
+ }
468
+ const orderNode = node.find((child) => Array.isArray(child) && child[0] === "ORDER");
469
+ const order = orderNode ? parseInt(orderNode[1], 10) : null;
470
+ const unitNode = node.find(
471
+ (child) => Array.isArray(child) && (child[0] === "LENGTHUNIT" || child[0] === "ANGLEUNIT" || child[0] === "SCALEUNIT")
472
+ );
473
+ const unit = this.convertUnit(unitNode);
474
+ return {
475
+ name,
476
+ direction,
477
+ // Use the valid PROJJSON direction value
478
+ unit,
479
+ order
480
+ };
481
+ }
482
+ static extractAxes(node) {
483
+ return node.filter((child) => Array.isArray(child) && child[0] === "AXIS").map((axis) => this.convertAxis(axis)).sort((a, b) => (a.order || 0) - (b.order || 0));
484
+ }
485
+ static convert(node, result = {}) {
486
+ switch (node[0]) {
487
+ case "PROJCRS":
488
+ result.type = "ProjectedCRS";
489
+ result.name = node[1];
490
+ result.base_crs = node.find((child) => Array.isArray(child) && child[0] === "BASEGEOGCRS") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "BASEGEOGCRS")) : null;
491
+ result.conversion = node.find((child) => Array.isArray(child) && child[0] === "CONVERSION") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "CONVERSION")) : null;
492
+ const csNode = node.find((child) => Array.isArray(child) && child[0] === "CS");
493
+ if (csNode) {
494
+ result.coordinate_system = {
495
+ type: csNode[1],
496
+ axis: this.extractAxes(node)
497
+ };
498
+ }
499
+ const lengthUnitNode = node.find((child) => Array.isArray(child) && child[0] === "LENGTHUNIT");
500
+ if (lengthUnitNode) {
501
+ const unit2 = this.convertUnit(lengthUnitNode);
502
+ result.coordinate_system.unit = unit2;
503
+ }
504
+ result.id = this.getId(node);
505
+ break;
506
+ case "BASEGEOGCRS":
507
+ case "GEOGCRS":
508
+ result.type = "GeographicCRS";
509
+ result.name = node[1];
510
+ const datumOrEnsembleNode = node.find(
511
+ (child) => Array.isArray(child) && (child[0] === "DATUM" || child[0] === "ENSEMBLE")
512
+ );
513
+ if (datumOrEnsembleNode) {
514
+ const datumOrEnsemble = this.convert(datumOrEnsembleNode);
515
+ if (datumOrEnsembleNode[0] === "ENSEMBLE") {
516
+ result.datum_ensemble = datumOrEnsemble;
517
+ } else {
518
+ result.datum = datumOrEnsemble;
519
+ }
520
+ const primem = node.find((child) => Array.isArray(child) && child[0] === "PRIMEM");
521
+ if (primem && primem[1] !== "Greenwich") {
522
+ datumOrEnsemble.prime_meridian = {
523
+ name: primem[1],
524
+ longitude: parseFloat(primem[2])
525
+ };
526
+ }
527
+ }
528
+ result.coordinate_system = {
529
+ type: "ellipsoidal",
530
+ axis: this.extractAxes(node)
531
+ };
532
+ result.id = this.getId(node);
533
+ break;
534
+ case "DATUM":
535
+ result.type = "GeodeticReferenceFrame";
536
+ result.name = node[1];
537
+ result.ellipsoid = node.find((child) => Array.isArray(child) && child[0] === "ELLIPSOID") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "ELLIPSOID")) : null;
538
+ break;
539
+ case "ENSEMBLE":
540
+ result.type = "DatumEnsemble";
541
+ result.name = node[1];
542
+ result.members = node.filter((child) => Array.isArray(child) && child[0] === "MEMBER").map((member) => ({
543
+ type: "DatumEnsembleMember",
544
+ name: member[1],
545
+ id: this.getId(member)
546
+ // Extract ID as { authority, code }
547
+ }));
548
+ const accuracyNode = node.find((child) => Array.isArray(child) && child[0] === "ENSEMBLEACCURACY");
549
+ if (accuracyNode) {
550
+ result.accuracy = parseFloat(accuracyNode[1]);
551
+ }
552
+ const ellipsoidNode = node.find((child) => Array.isArray(child) && child[0] === "ELLIPSOID");
553
+ if (ellipsoidNode) {
554
+ result.ellipsoid = this.convert(ellipsoidNode);
555
+ }
556
+ result.id = this.getId(node);
557
+ break;
558
+ case "ELLIPSOID":
559
+ result.type = "Ellipsoid";
560
+ result.name = node[1];
561
+ result.semi_major_axis = parseFloat(node[2]);
562
+ result.inverse_flattening = parseFloat(node[3]);
563
+ const units = node.find((child) => Array.isArray(child) && child[0] === "LENGTHUNIT") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "LENGTHUNIT"), result) : null;
564
+ break;
565
+ case "CONVERSION":
566
+ result.type = "Conversion";
567
+ result.name = node[1];
568
+ result.method = node.find((child) => Array.isArray(child) && child[0] === "METHOD") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "METHOD")) : null;
569
+ result.parameters = node.filter((child) => Array.isArray(child) && child[0] === "PARAMETER").map((param) => this.convert(param));
570
+ break;
571
+ case "METHOD":
572
+ result.type = "Method";
573
+ result.name = node[1];
574
+ result.id = this.getId(node);
575
+ break;
576
+ case "PARAMETER":
577
+ result.type = "Parameter";
578
+ result.name = node[1];
579
+ result.value = parseFloat(node[2]);
580
+ result.unit = this.convertUnit(
581
+ node.find(
582
+ (child) => Array.isArray(child) && (child[0] === "LENGTHUNIT" || child[0] === "ANGLEUNIT" || child[0] === "SCALEUNIT")
583
+ )
584
+ );
585
+ result.id = this.getId(node);
586
+ break;
587
+ case "BOUNDCRS":
588
+ result.type = "BoundCRS";
589
+ const sourceCrsNode = node.find((child) => Array.isArray(child) && child[0] === "SOURCECRS");
590
+ if (sourceCrsNode) {
591
+ const sourceCrsContent = sourceCrsNode.find((child) => Array.isArray(child));
592
+ result.source_crs = sourceCrsContent ? this.convert(sourceCrsContent) : null;
593
+ }
594
+ const targetCrsNode = node.find((child) => Array.isArray(child) && child[0] === "TARGETCRS");
595
+ if (targetCrsNode) {
596
+ const targetCrsContent = targetCrsNode.find((child) => Array.isArray(child));
597
+ result.target_crs = targetCrsContent ? this.convert(targetCrsContent) : null;
598
+ }
599
+ const transformationNode = node.find((child) => Array.isArray(child) && child[0] === "ABRIDGEDTRANSFORMATION");
600
+ if (transformationNode) {
601
+ result.transformation = this.convert(transformationNode);
602
+ } else {
603
+ result.transformation = null;
604
+ }
605
+ break;
606
+ case "ABRIDGEDTRANSFORMATION":
607
+ result.type = "Transformation";
608
+ result.name = node[1];
609
+ result.method = node.find((child) => Array.isArray(child) && child[0] === "METHOD") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "METHOD")) : null;
610
+ result.parameters = node.filter((child) => Array.isArray(child) && (child[0] === "PARAMETER" || child[0] === "PARAMETERFILE")).map((param) => {
611
+ if (param[0] === "PARAMETER") {
612
+ return this.convert(param);
613
+ } else if (param[0] === "PARAMETERFILE") {
614
+ return {
615
+ name: param[1],
616
+ value: param[2],
617
+ id: {
618
+ "authority": "EPSG",
619
+ "code": 8656
620
+ }
621
+ };
622
+ }
623
+ });
624
+ if (result.parameters.length === 7) {
625
+ const scaleDifference = result.parameters[6];
626
+ if (scaleDifference.name === "Scale difference") {
627
+ scaleDifference.value = Math.round((scaleDifference.value - 1) * 1e12) / 1e6;
628
+ }
629
+ }
630
+ result.id = this.getId(node);
631
+ break;
632
+ case "AXIS":
633
+ if (!result.coordinate_system) {
634
+ result.coordinate_system = { type: "unspecified", axis: [] };
635
+ }
636
+ result.coordinate_system.axis.push(this.convertAxis(node));
637
+ break;
638
+ case "LENGTHUNIT":
639
+ const unit = this.convertUnit(node, "LinearUnit");
640
+ if (result.coordinate_system && result.coordinate_system.axis) {
641
+ result.coordinate_system.axis.forEach((axis) => {
642
+ if (!axis.unit) {
643
+ axis.unit = unit;
644
+ }
645
+ });
646
+ }
647
+ if (unit.conversion_factor && unit.conversion_factor !== 1) {
648
+ if (result.semi_major_axis) {
649
+ result.semi_major_axis = {
650
+ value: result.semi_major_axis,
651
+ unit
652
+ };
653
+ }
654
+ }
655
+ break;
656
+ default:
657
+ result.keyword = node[0];
658
+ break;
659
+ }
660
+ return result;
661
+ }
662
+ };
663
+ var PROJJSONBuilderBase_default = PROJJSONBuilderBase;
664
+
665
+ // ../../node_modules/wkt-parser/PROJJSONBuilder2015.js
666
+ var PROJJSONBuilder2015 = class extends PROJJSONBuilderBase_default {
667
+ static convert(node, result = {}) {
668
+ super.convert(node, result);
669
+ if (result.coordinate_system && result.coordinate_system.subtype === "Cartesian") {
670
+ delete result.coordinate_system;
671
+ }
672
+ if (result.usage) {
673
+ delete result.usage;
674
+ }
675
+ return result;
676
+ }
677
+ };
678
+ var PROJJSONBuilder2015_default = PROJJSONBuilder2015;
679
+
680
+ // ../../node_modules/wkt-parser/PROJJSONBuilder2019.js
681
+ var PROJJSONBuilder2019 = class extends PROJJSONBuilderBase_default {
682
+ static convert(node, result = {}) {
683
+ super.convert(node, result);
684
+ const csNode = node.find((child) => Array.isArray(child) && child[0] === "CS");
685
+ if (csNode) {
686
+ result.coordinate_system = {
687
+ subtype: csNode[1],
688
+ axis: this.extractAxes(node)
689
+ };
690
+ }
691
+ const usageNode = node.find((child) => Array.isArray(child) && child[0] === "USAGE");
692
+ if (usageNode) {
693
+ const scope = usageNode.find((child) => Array.isArray(child) && child[0] === "SCOPE");
694
+ const area = usageNode.find((child) => Array.isArray(child) && child[0] === "AREA");
695
+ const bbox = usageNode.find((child) => Array.isArray(child) && child[0] === "BBOX");
696
+ result.usage = {};
697
+ if (scope) {
698
+ result.usage.scope = scope[1];
699
+ }
700
+ if (area) {
701
+ result.usage.area = area[1];
702
+ }
703
+ if (bbox) {
704
+ result.usage.bbox = bbox.slice(1);
705
+ }
706
+ }
707
+ return result;
708
+ }
709
+ };
710
+ var PROJJSONBuilder2019_default = PROJJSONBuilder2019;
711
+
712
+ // ../../node_modules/wkt-parser/buildPROJJSON.js
713
+ function detectWKT2Version(root) {
714
+ if (root.find((child) => Array.isArray(child) && child[0] === "USAGE")) {
715
+ return "2019";
716
+ }
717
+ if (root.find((child) => Array.isArray(child) && child[0] === "CS")) {
718
+ return "2015";
719
+ }
720
+ if (root[0] === "BOUNDCRS" || root[0] === "PROJCRS" || root[0] === "GEOGCRS") {
721
+ return "2015";
722
+ }
723
+ return "2015";
724
+ }
725
+ function buildPROJJSON(root) {
726
+ const version = detectWKT2Version(root);
727
+ const builder = version === "2019" ? PROJJSONBuilder2019_default : PROJJSONBuilder2015_default;
728
+ return builder.convert(root);
729
+ }
730
+
731
+ // ../../node_modules/wkt-parser/detectWKTVersion.js
732
+ function detectWKTVersion(wkt) {
733
+ const normalizedWKT = wkt.toUpperCase();
734
+ if (normalizedWKT.includes("PROJCRS") || normalizedWKT.includes("GEOGCRS") || normalizedWKT.includes("BOUNDCRS") || normalizedWKT.includes("VERTCRS") || normalizedWKT.includes("LENGTHUNIT") || normalizedWKT.includes("ANGLEUNIT") || normalizedWKT.includes("SCALEUNIT")) {
735
+ return "WKT2";
736
+ }
737
+ if (normalizedWKT.includes("PROJCS") || normalizedWKT.includes("GEOGCS") || normalizedWKT.includes("LOCAL_CS") || normalizedWKT.includes("VERT_CS") || normalizedWKT.includes("UNIT")) {
738
+ return "WKT1";
739
+ }
740
+ return "WKT1";
741
+ }
742
+
418
743
  // ../../node_modules/wkt-parser/parser.js
419
744
  var parser_default = parseString;
420
745
  var NEUTRAL = 1;
@@ -657,6 +982,19 @@
657
982
  sExpr(v[3], obj[key]);
658
983
  }
659
984
  return;
985
+ case "EDATUM":
986
+ case "ENGINEERINGDATUM":
987
+ case "LOCAL_DATUM":
988
+ case "DATUM":
989
+ case "VERT_CS":
990
+ case "VERTCRS":
991
+ case "VERTICALCRS":
992
+ v[0] = ["name", v[0]];
993
+ mapit(obj, key, v);
994
+ return;
995
+ case "COMPD_CS":
996
+ case "COMPOUNDCRS":
997
+ case "FITTED_CS":
660
998
  case "PROJECTEDCRS":
661
999
  case "PROJCRS":
662
1000
  case "GEOGCS":
@@ -666,20 +1004,11 @@
666
1004
  case "GEODCRS":
667
1005
  case "GEODETICCRS":
668
1006
  case "GEODETICDATUM":
669
- case "EDATUM":
670
- case "ENGINEERINGDATUM":
671
- case "VERT_CS":
672
- case "VERTCRS":
673
- case "VERTICALCRS":
674
- case "COMPD_CS":
675
- case "COMPOUNDCRS":
676
- case "ENGINEERINGCRS":
677
1007
  case "ENGCRS":
678
- case "FITTED_CS":
679
- case "LOCAL_DATUM":
680
- case "DATUM":
1008
+ case "ENGINEERINGCRS":
681
1009
  v[0] = ["name", v[0]];
682
1010
  mapit(obj, key, v);
1011
+ obj[key].type = key;
683
1012
  return;
684
1013
  default:
685
1014
  i = -1;
@@ -692,8 +1021,276 @@
692
1021
  }
693
1022
  }
694
1023
 
695
- // ../../node_modules/wkt-parser/index.js
1024
+ // ../../node_modules/wkt-parser/util.js
696
1025
  var D2R2 = 0.017453292519943295;
1026
+ function d2r(input) {
1027
+ return input * D2R2;
1028
+ }
1029
+ function applyProjectionDefaults(wkt) {
1030
+ const normalizedProjName = (wkt.projName || "").toLowerCase().replace(/_/g, " ");
1031
+ if (!wkt.long0 && wkt.longc && (normalizedProjName === "albers conic equal area" || normalizedProjName === "lambert azimuthal equal area")) {
1032
+ wkt.long0 = wkt.longc;
1033
+ }
1034
+ if (!wkt.lat_ts && wkt.lat1 && (normalizedProjName === "stereographic south pole" || normalizedProjName === "polar stereographic (variant b)")) {
1035
+ wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
1036
+ wkt.lat_ts = wkt.lat1;
1037
+ delete wkt.lat1;
1038
+ } else if (!wkt.lat_ts && wkt.lat0 && (normalizedProjName === "polar stereographic" || normalizedProjName === "polar stereographic (variant a)")) {
1039
+ wkt.lat_ts = wkt.lat0;
1040
+ wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);
1041
+ delete wkt.lat1;
1042
+ }
1043
+ }
1044
+
1045
+ // ../../node_modules/wkt-parser/transformPROJJSON.js
1046
+ function processUnit(unit) {
1047
+ let result = { units: null, to_meter: void 0 };
1048
+ if (typeof unit === "string") {
1049
+ result.units = unit.toLowerCase();
1050
+ if (result.units === "metre") {
1051
+ result.units = "meter";
1052
+ }
1053
+ if (result.units === "meter") {
1054
+ result.to_meter = 1;
1055
+ }
1056
+ } else if (unit && unit.name) {
1057
+ result.units = unit.name.toLowerCase();
1058
+ if (result.units === "metre") {
1059
+ result.units = "meter";
1060
+ }
1061
+ result.to_meter = unit.conversion_factor;
1062
+ }
1063
+ return result;
1064
+ }
1065
+ function toValue(valueOrObject) {
1066
+ if (typeof valueOrObject === "object") {
1067
+ return valueOrObject.value * valueOrObject.unit.conversion_factor;
1068
+ }
1069
+ return valueOrObject;
1070
+ }
1071
+ function calculateEllipsoid(value, result) {
1072
+ if (value.ellipsoid.radius) {
1073
+ result.a = value.ellipsoid.radius;
1074
+ result.rf = 0;
1075
+ } else {
1076
+ result.a = toValue(value.ellipsoid.semi_major_axis);
1077
+ if (value.ellipsoid.inverse_flattening !== void 0) {
1078
+ result.rf = value.ellipsoid.inverse_flattening;
1079
+ } else if (value.ellipsoid.semi_major_axis !== void 0 && value.ellipsoid.semi_minor_axis !== void 0) {
1080
+ result.rf = result.a / (result.a - toValue(value.ellipsoid.semi_minor_axis));
1081
+ }
1082
+ }
1083
+ }
1084
+ function transformPROJJSON(projjson, result = {}) {
1085
+ if (!projjson || typeof projjson !== "object") {
1086
+ return projjson;
1087
+ }
1088
+ if (projjson.type === "BoundCRS") {
1089
+ transformPROJJSON(projjson.source_crs, result);
1090
+ if (projjson.transformation) {
1091
+ if (projjson.transformation.method && projjson.transformation.method.name === "NTv2") {
1092
+ result.nadgrids = projjson.transformation.parameters[0].value;
1093
+ } else {
1094
+ result.datum_params = projjson.transformation.parameters.map((param) => param.value);
1095
+ }
1096
+ }
1097
+ return result;
1098
+ }
1099
+ Object.keys(projjson).forEach((key) => {
1100
+ const value = projjson[key];
1101
+ if (value === null) {
1102
+ return;
1103
+ }
1104
+ switch (key) {
1105
+ case "name":
1106
+ if (result.srsCode) {
1107
+ break;
1108
+ }
1109
+ result.name = value;
1110
+ result.srsCode = value;
1111
+ break;
1112
+ case "type":
1113
+ if (value === "GeographicCRS") {
1114
+ result.projName = "longlat";
1115
+ } else if (value === "ProjectedCRS" && projjson.conversion && projjson.conversion.method) {
1116
+ result.projName = projjson.conversion.method.name;
1117
+ }
1118
+ break;
1119
+ case "datum":
1120
+ case "datum_ensemble":
1121
+ if (value.ellipsoid) {
1122
+ result.ellps = value.ellipsoid.name;
1123
+ calculateEllipsoid(value, result);
1124
+ }
1125
+ if (value.prime_meridian) {
1126
+ result.from_greenwich = value.prime_meridian.longitude * Math.PI / 180;
1127
+ }
1128
+ break;
1129
+ case "ellipsoid":
1130
+ result.ellps = value.name;
1131
+ calculateEllipsoid(value, result);
1132
+ break;
1133
+ case "prime_meridian":
1134
+ result.long0 = (value.longitude || 0) * Math.PI / 180;
1135
+ break;
1136
+ case "coordinate_system":
1137
+ if (value.axis) {
1138
+ result.axis = value.axis.map((axis) => {
1139
+ const direction = axis.direction;
1140
+ if (direction === "east")
1141
+ return "e";
1142
+ if (direction === "north")
1143
+ return "n";
1144
+ if (direction === "west")
1145
+ return "w";
1146
+ if (direction === "south")
1147
+ return "s";
1148
+ throw new Error(`Unknown axis direction: ${direction}`);
1149
+ }).join("") + "u";
1150
+ if (value.unit) {
1151
+ const { units, to_meter } = processUnit(value.unit);
1152
+ result.units = units;
1153
+ result.to_meter = to_meter;
1154
+ } else if (value.axis[0] && value.axis[0].unit) {
1155
+ const { units, to_meter } = processUnit(value.axis[0].unit);
1156
+ result.units = units;
1157
+ result.to_meter = to_meter;
1158
+ }
1159
+ }
1160
+ break;
1161
+ case "id":
1162
+ if (value.authority && value.code) {
1163
+ result.title = value.authority + ":" + value.code;
1164
+ }
1165
+ break;
1166
+ case "conversion":
1167
+ if (value.method && value.method.name) {
1168
+ result.projName = value.method.name;
1169
+ }
1170
+ if (value.parameters) {
1171
+ value.parameters.forEach((param) => {
1172
+ const paramName = param.name.toLowerCase().replace(/\s+/g, "_");
1173
+ const paramValue = param.value;
1174
+ if (param.unit && param.unit.conversion_factor) {
1175
+ result[paramName] = paramValue * param.unit.conversion_factor;
1176
+ } else if (param.unit === "degree") {
1177
+ result[paramName] = paramValue * Math.PI / 180;
1178
+ } else {
1179
+ result[paramName] = paramValue;
1180
+ }
1181
+ });
1182
+ }
1183
+ break;
1184
+ case "unit":
1185
+ if (value.name) {
1186
+ result.units = value.name.toLowerCase();
1187
+ if (result.units === "metre") {
1188
+ result.units = "meter";
1189
+ }
1190
+ }
1191
+ if (value.conversion_factor) {
1192
+ result.to_meter = value.conversion_factor;
1193
+ }
1194
+ break;
1195
+ case "base_crs":
1196
+ transformPROJJSON(value, result);
1197
+ result.datumCode = value.id ? value.id.authority + "_" + value.id.code : value.name;
1198
+ break;
1199
+ default:
1200
+ break;
1201
+ }
1202
+ });
1203
+ if (result.latitude_of_false_origin !== void 0) {
1204
+ result.lat0 = result.latitude_of_false_origin;
1205
+ }
1206
+ if (result.longitude_of_false_origin !== void 0) {
1207
+ result.long0 = result.longitude_of_false_origin;
1208
+ }
1209
+ if (result.latitude_of_standard_parallel !== void 0) {
1210
+ result.lat0 = result.latitude_of_standard_parallel;
1211
+ result.lat1 = result.latitude_of_standard_parallel;
1212
+ }
1213
+ if (result.latitude_of_1st_standard_parallel !== void 0) {
1214
+ result.lat1 = result.latitude_of_1st_standard_parallel;
1215
+ }
1216
+ if (result.latitude_of_2nd_standard_parallel !== void 0) {
1217
+ result.lat2 = result.latitude_of_2nd_standard_parallel;
1218
+ }
1219
+ if (result.latitude_of_projection_centre !== void 0) {
1220
+ result.lat0 = result.latitude_of_projection_centre;
1221
+ }
1222
+ if (result.longitude_of_projection_centre !== void 0) {
1223
+ result.longc = result.longitude_of_projection_centre;
1224
+ }
1225
+ if (result.easting_at_false_origin !== void 0) {
1226
+ result.x0 = result.easting_at_false_origin;
1227
+ }
1228
+ if (result.northing_at_false_origin !== void 0) {
1229
+ result.y0 = result.northing_at_false_origin;
1230
+ }
1231
+ if (result.latitude_of_natural_origin !== void 0) {
1232
+ result.lat0 = result.latitude_of_natural_origin;
1233
+ }
1234
+ if (result.longitude_of_natural_origin !== void 0) {
1235
+ result.long0 = result.longitude_of_natural_origin;
1236
+ }
1237
+ if (result.longitude_of_origin !== void 0) {
1238
+ result.long0 = result.longitude_of_origin;
1239
+ }
1240
+ if (result.false_easting !== void 0) {
1241
+ result.x0 = result.false_easting;
1242
+ }
1243
+ if (result.easting_at_projection_centre) {
1244
+ result.x0 = result.easting_at_projection_centre;
1245
+ }
1246
+ if (result.false_northing !== void 0) {
1247
+ result.y0 = result.false_northing;
1248
+ }
1249
+ if (result.northing_at_projection_centre) {
1250
+ result.y0 = result.northing_at_projection_centre;
1251
+ }
1252
+ if (result.standard_parallel_1 !== void 0) {
1253
+ result.lat1 = result.standard_parallel_1;
1254
+ }
1255
+ if (result.standard_parallel_2 !== void 0) {
1256
+ result.lat2 = result.standard_parallel_2;
1257
+ }
1258
+ if (result.scale_factor_at_natural_origin !== void 0) {
1259
+ result.k0 = result.scale_factor_at_natural_origin;
1260
+ }
1261
+ if (result.scale_factor_at_projection_centre !== void 0) {
1262
+ result.k0 = result.scale_factor_at_projection_centre;
1263
+ }
1264
+ if (result.scale_factor_on_pseudo_standard_parallel !== void 0) {
1265
+ result.k0 = result.scale_factor_on_pseudo_standard_parallel;
1266
+ }
1267
+ if (result.azimuth !== void 0) {
1268
+ result.alpha = result.azimuth;
1269
+ }
1270
+ if (result.azimuth_at_projection_centre !== void 0) {
1271
+ result.alpha = result.azimuth_at_projection_centre;
1272
+ }
1273
+ if (result.angle_from_rectified_to_skew_grid) {
1274
+ result.rectified_grid_angle = result.angle_from_rectified_to_skew_grid;
1275
+ }
1276
+ applyProjectionDefaults(result);
1277
+ return result;
1278
+ }
1279
+
1280
+ // ../../node_modules/wkt-parser/index.js
1281
+ var knownTypes = [
1282
+ "PROJECTEDCRS",
1283
+ "PROJCRS",
1284
+ "GEOGCS",
1285
+ "GEOCCS",
1286
+ "PROJCS",
1287
+ "LOCAL_CS",
1288
+ "GEODCRS",
1289
+ "GEODETICCRS",
1290
+ "GEODETICDATUM",
1291
+ "ENGCRS",
1292
+ "ENGINEERINGCRS"
1293
+ ];
697
1294
  function rename(obj, params) {
698
1295
  var outName = params[0];
699
1296
  var inName = params[1];
@@ -704,10 +1301,25 @@
704
1301
  }
705
1302
  }
706
1303
  }
707
- function d2r(input) {
708
- return input * D2R2;
709
- }
710
1304
  function cleanWKT(wkt) {
1305
+ var keys = Object.keys(wkt);
1306
+ for (var i = 0, ii = keys.length; i < ii; ++i) {
1307
+ var key = keys[i];
1308
+ if (knownTypes.indexOf(key) !== -1) {
1309
+ setPropertiesFromWkt(wkt[key]);
1310
+ }
1311
+ if (typeof wkt[key] === "object") {
1312
+ cleanWKT(wkt[key]);
1313
+ }
1314
+ }
1315
+ }
1316
+ function setPropertiesFromWkt(wkt) {
1317
+ if (wkt.AUTHORITY) {
1318
+ var authority = Object.keys(wkt.AUTHORITY)[0];
1319
+ if (authority && authority in wkt.AUTHORITY) {
1320
+ wkt.title = authority + ":" + wkt.AUTHORITY[authority];
1321
+ }
1322
+ }
711
1323
  if (wkt.type === "GEOGCS") {
712
1324
  wkt.projName = "longlat";
713
1325
  } else if (wkt.type === "LOCAL_CS") {
@@ -769,7 +1381,7 @@
769
1381
  if (wkt.datumCode.slice(0, 2) === "d_") {
770
1382
  wkt.datumCode = wkt.datumCode.slice(2);
771
1383
  }
772
- if (wkt.datumCode === "new_zealand_geodetic_datum_1949" || wkt.datumCode === "new_zealand_1949") {
1384
+ if (wkt.datumCode === "new_zealand_1949") {
773
1385
  wkt.datumCode = "nzgd49";
774
1386
  }
775
1387
  if (wkt.datumCode === "wgs_1984" || wkt.datumCode === "world_geodetic_system_1984") {
@@ -778,13 +1390,7 @@
778
1390
  }
779
1391
  wkt.datumCode = "wgs84";
780
1392
  }
781
- if (wkt.datumCode.slice(-6) === "_ferro") {
782
- wkt.datumCode = wkt.datumCode.slice(0, -6);
783
- }
784
- if (wkt.datumCode.slice(-8) === "_jakarta") {
785
- wkt.datumCode = wkt.datumCode.slice(0, -8);
786
- }
787
- if (~wkt.datumCode.indexOf("belge")) {
1393
+ if (wkt.datumCode === "belge_1972") {
788
1394
  wkt.datumCode = "rnb72";
789
1395
  }
790
1396
  if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
@@ -817,6 +1423,9 @@
817
1423
  if (wkt.b && !isFinite(wkt.b)) {
818
1424
  wkt.b = wkt.a;
819
1425
  }
1426
+ if (wkt.rectified_grid_angle) {
1427
+ wkt.rectified_grid_angle = d2r(wkt.rectified_grid_angle);
1428
+ }
820
1429
  function toMeter(input) {
821
1430
  var ratio = wkt.to_meter || 1;
822
1431
  return input * ratio;
@@ -862,27 +1471,23 @@
862
1471
  ["srsCode", "name"]
863
1472
  ];
864
1473
  list.forEach(renamer);
865
- if (!wkt.long0 && wkt.longc && (wkt.projName === "Albers_Conic_Equal_Area" || wkt.projName === "Lambert_Azimuthal_Equal_Area")) {
866
- wkt.long0 = wkt.longc;
867
- }
868
- if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === "Stereographic_South_Pole" || wkt.projName === "Polar Stereographic (variant B)")) {
869
- wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
870
- wkt.lat_ts = wkt.lat1;
871
- } else if (!wkt.lat_ts && wkt.lat0 && wkt.projName === "Polar_Stereographic") {
872
- wkt.lat_ts = wkt.lat0;
873
- wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);
874
- }
1474
+ applyProjectionDefaults(wkt);
875
1475
  }
876
1476
  function wkt_parser_default(wkt) {
1477
+ if (typeof wkt === "object") {
1478
+ return transformPROJJSON(wkt);
1479
+ }
1480
+ const version = detectWKTVersion(wkt);
877
1481
  var lisp = parser_default(wkt);
878
- var type = lisp.shift();
879
- var name = lisp.shift();
880
- lisp.unshift(["name", name]);
881
- lisp.unshift(["type", type]);
1482
+ if (version === "WKT2") {
1483
+ const projjson = buildPROJJSON(lisp);
1484
+ return transformPROJJSON(projjson);
1485
+ }
1486
+ var type = lisp[0];
882
1487
  var obj = {};
883
1488
  sExpr(lisp, obj);
884
1489
  cleanWKT(obj);
885
- return obj;
1490
+ return obj[type];
886
1491
  }
887
1492
 
888
1493
  // ../../node_modules/proj4/lib/defs.js
@@ -8836,7 +9441,7 @@
8836
9441
  }
8837
9442
 
8838
9443
  // src/flatgeobuf-loader.ts
8839
- var VERSION = true ? "4.4.0-alpha.1" : "latest";
9444
+ var VERSION = true ? "4.4.0" : "latest";
8840
9445
  var FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
8841
9446
  var FlatGeobufWorkerLoader = {
8842
9447
  ...FlatGeobufFormat,