@loaders.gl/flatgeobuf 4.4.0-alpha.9 → 4.4.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.
@@ -418,6 +418,328 @@
418
418
  return self2;
419
419
  }
420
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
+
421
743
  // ../../node_modules/wkt-parser/parser.js
422
744
  var parser_default = parseString;
423
745
  var NEUTRAL = 1;
@@ -660,6 +982,19 @@
660
982
  sExpr(v[3], obj[key]);
661
983
  }
662
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":
663
998
  case "PROJECTEDCRS":
664
999
  case "PROJCRS":
665
1000
  case "GEOGCS":
@@ -669,20 +1004,11 @@
669
1004
  case "GEODCRS":
670
1005
  case "GEODETICCRS":
671
1006
  case "GEODETICDATUM":
672
- case "EDATUM":
673
- case "ENGINEERINGDATUM":
674
- case "VERT_CS":
675
- case "VERTCRS":
676
- case "VERTICALCRS":
677
- case "COMPD_CS":
678
- case "COMPOUNDCRS":
679
- case "ENGINEERINGCRS":
680
1007
  case "ENGCRS":
681
- case "FITTED_CS":
682
- case "LOCAL_DATUM":
683
- case "DATUM":
1008
+ case "ENGINEERINGCRS":
684
1009
  v[0] = ["name", v[0]];
685
1010
  mapit(obj, key, v);
1011
+ obj[key].type = key;
686
1012
  return;
687
1013
  default:
688
1014
  i = -1;
@@ -695,8 +1021,276 @@
695
1021
  }
696
1022
  }
697
1023
 
698
- // ../../node_modules/wkt-parser/index.js
1024
+ // ../../node_modules/wkt-parser/util.js
699
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
+ ];
700
1294
  function rename(obj, params) {
701
1295
  var outName = params[0];
702
1296
  var inName = params[1];
@@ -707,10 +1301,25 @@
707
1301
  }
708
1302
  }
709
1303
  }
710
- function d2r(input) {
711
- return input * D2R2;
712
- }
713
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
+ }
714
1323
  if (wkt.type === "GEOGCS") {
715
1324
  wkt.projName = "longlat";
716
1325
  } else if (wkt.type === "LOCAL_CS") {
@@ -772,7 +1381,7 @@
772
1381
  if (wkt.datumCode.slice(0, 2) === "d_") {
773
1382
  wkt.datumCode = wkt.datumCode.slice(2);
774
1383
  }
775
- if (wkt.datumCode === "new_zealand_geodetic_datum_1949" || wkt.datumCode === "new_zealand_1949") {
1384
+ if (wkt.datumCode === "new_zealand_1949") {
776
1385
  wkt.datumCode = "nzgd49";
777
1386
  }
778
1387
  if (wkt.datumCode === "wgs_1984" || wkt.datumCode === "world_geodetic_system_1984") {
@@ -781,13 +1390,7 @@
781
1390
  }
782
1391
  wkt.datumCode = "wgs84";
783
1392
  }
784
- if (wkt.datumCode.slice(-6) === "_ferro") {
785
- wkt.datumCode = wkt.datumCode.slice(0, -6);
786
- }
787
- if (wkt.datumCode.slice(-8) === "_jakarta") {
788
- wkt.datumCode = wkt.datumCode.slice(0, -8);
789
- }
790
- if (~wkt.datumCode.indexOf("belge")) {
1393
+ if (wkt.datumCode === "belge_1972") {
791
1394
  wkt.datumCode = "rnb72";
792
1395
  }
793
1396
  if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
@@ -820,6 +1423,9 @@
820
1423
  if (wkt.b && !isFinite(wkt.b)) {
821
1424
  wkt.b = wkt.a;
822
1425
  }
1426
+ if (wkt.rectified_grid_angle) {
1427
+ wkt.rectified_grid_angle = d2r(wkt.rectified_grid_angle);
1428
+ }
823
1429
  function toMeter(input) {
824
1430
  var ratio = wkt.to_meter || 1;
825
1431
  return input * ratio;
@@ -865,27 +1471,23 @@
865
1471
  ["srsCode", "name"]
866
1472
  ];
867
1473
  list.forEach(renamer);
868
- if (!wkt.long0 && wkt.longc && (wkt.projName === "Albers_Conic_Equal_Area" || wkt.projName === "Lambert_Azimuthal_Equal_Area")) {
869
- wkt.long0 = wkt.longc;
870
- }
871
- if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === "Stereographic_South_Pole" || wkt.projName === "Polar Stereographic (variant B)")) {
872
- wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
873
- wkt.lat_ts = wkt.lat1;
874
- } else if (!wkt.lat_ts && wkt.lat0 && wkt.projName === "Polar_Stereographic") {
875
- wkt.lat_ts = wkt.lat0;
876
- wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);
877
- }
1474
+ applyProjectionDefaults(wkt);
878
1475
  }
879
1476
  function wkt_parser_default(wkt) {
1477
+ if (typeof wkt === "object") {
1478
+ return transformPROJJSON(wkt);
1479
+ }
1480
+ const version = detectWKTVersion(wkt);
880
1481
  var lisp = parser_default(wkt);
881
- var type = lisp.shift();
882
- var name = lisp.shift();
883
- lisp.unshift(["name", name]);
884
- lisp.unshift(["type", type]);
1482
+ if (version === "WKT2") {
1483
+ const projjson = buildPROJJSON(lisp);
1484
+ return transformPROJJSON(projjson);
1485
+ }
1486
+ var type = lisp[0];
885
1487
  var obj = {};
886
1488
  sExpr(lisp, obj);
887
1489
  cleanWKT(obj);
888
- return obj;
1490
+ return obj[type];
889
1491
  }
890
1492
 
891
1493
  // ../../node_modules/proj4/lib/defs.js
@@ -8839,7 +9441,7 @@
8839
9441
  }
8840
9442
 
8841
9443
  // src/flatgeobuf-loader.ts
8842
- var VERSION = true ? "4.4.0-alpha.9" : "latest";
9444
+ var VERSION = true ? "4.4.1" : "latest";
8843
9445
  var FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
8844
9446
  var FlatGeobufWorkerLoader = {
8845
9447
  ...FlatGeobufFormat,