@loaders.gl/potree 4.4.0-alpha.13 → 4.4.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +645 -43
- package/dist/dist.min.js +17 -17
- package/dist/index.cjs +2 -2
- package/dist/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree-loader.js +1 -1
- package/dist/utils/bounding-box-utils.d.ts.map +1 -1
- package/dist/utils/projection-utils.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/dist.dev.js
CHANGED
|
@@ -19145,6 +19145,8 @@ var __exports__ = (() => {
|
|
|
19145
19145
|
start2 += 48;
|
|
19146
19146
|
o.maxs = [bounds[0], bounds[2], bounds[4]];
|
|
19147
19147
|
o.mins = [bounds[1], bounds[3], bounds[5]];
|
|
19148
|
+
const colorPointFormats = /* @__PURE__ */ new Set([2, 3]);
|
|
19149
|
+
o.hasColor = colorPointFormats.has(o.pointsFormatId & 63);
|
|
19148
19150
|
return o;
|
|
19149
19151
|
}
|
|
19150
19152
|
var LASLoader = class {
|
|
@@ -19282,11 +19284,10 @@ var __exports__ = (() => {
|
|
|
19282
19284
|
}
|
|
19283
19285
|
/**
|
|
19284
19286
|
* @param count
|
|
19285
|
-
* @param offset
|
|
19286
19287
|
* @param skip
|
|
19287
19288
|
* @returns Data
|
|
19288
19289
|
*/
|
|
19289
|
-
readData(count,
|
|
19290
|
+
readData(count, skip) {
|
|
19290
19291
|
if (!this.instance) {
|
|
19291
19292
|
throw new Error("You need to open the file before trying to read stuff");
|
|
19292
19293
|
}
|
|
@@ -19430,12 +19431,11 @@ var __exports__ = (() => {
|
|
|
19430
19431
|
}
|
|
19431
19432
|
/**
|
|
19432
19433
|
* @param count
|
|
19433
|
-
* @param start
|
|
19434
19434
|
* @param skip
|
|
19435
19435
|
* @returns Data
|
|
19436
19436
|
*/
|
|
19437
|
-
readData(count,
|
|
19438
|
-
return this.loader.readData(count,
|
|
19437
|
+
readData(count, skip) {
|
|
19438
|
+
return this.loader.readData(count, skip);
|
|
19439
19439
|
}
|
|
19440
19440
|
/**
|
|
19441
19441
|
* Closes the file
|
|
@@ -19808,6 +19808,328 @@ var __exports__ = (() => {
|
|
|
19808
19808
|
return self2;
|
|
19809
19809
|
}
|
|
19810
19810
|
|
|
19811
|
+
// ../../node_modules/wkt-parser/PROJJSONBuilderBase.js
|
|
19812
|
+
var PROJJSONBuilderBase = class {
|
|
19813
|
+
static getId(node) {
|
|
19814
|
+
const idNode = node.find((child) => Array.isArray(child) && child[0] === "ID");
|
|
19815
|
+
if (idNode && idNode.length >= 3) {
|
|
19816
|
+
return {
|
|
19817
|
+
authority: idNode[1],
|
|
19818
|
+
code: parseInt(idNode[2], 10)
|
|
19819
|
+
};
|
|
19820
|
+
}
|
|
19821
|
+
return null;
|
|
19822
|
+
}
|
|
19823
|
+
static convertUnit(node, type = "unit") {
|
|
19824
|
+
if (!node || node.length < 3) {
|
|
19825
|
+
return { type, name: "unknown", conversion_factor: null };
|
|
19826
|
+
}
|
|
19827
|
+
const name = node[1];
|
|
19828
|
+
const conversionFactor = parseFloat(node[2]) || null;
|
|
19829
|
+
const idNode = node.find((child) => Array.isArray(child) && child[0] === "ID");
|
|
19830
|
+
const id = idNode ? {
|
|
19831
|
+
authority: idNode[1],
|
|
19832
|
+
code: parseInt(idNode[2], 10)
|
|
19833
|
+
} : null;
|
|
19834
|
+
return {
|
|
19835
|
+
type,
|
|
19836
|
+
name,
|
|
19837
|
+
conversion_factor: conversionFactor,
|
|
19838
|
+
id
|
|
19839
|
+
};
|
|
19840
|
+
}
|
|
19841
|
+
static convertAxis(node) {
|
|
19842
|
+
const name = node[1] || "Unknown";
|
|
19843
|
+
let direction;
|
|
19844
|
+
const abbreviationMatch = name.match(/^\((.)\)$/);
|
|
19845
|
+
if (abbreviationMatch) {
|
|
19846
|
+
const abbreviation = abbreviationMatch[1].toUpperCase();
|
|
19847
|
+
if (abbreviation === "E")
|
|
19848
|
+
direction = "east";
|
|
19849
|
+
else if (abbreviation === "N")
|
|
19850
|
+
direction = "north";
|
|
19851
|
+
else if (abbreviation === "U")
|
|
19852
|
+
direction = "up";
|
|
19853
|
+
else
|
|
19854
|
+
throw new Error(`Unknown axis abbreviation: ${abbreviation}`);
|
|
19855
|
+
} else {
|
|
19856
|
+
direction = node[2] ? node[2].toLowerCase() : "unknown";
|
|
19857
|
+
}
|
|
19858
|
+
const orderNode = node.find((child) => Array.isArray(child) && child[0] === "ORDER");
|
|
19859
|
+
const order = orderNode ? parseInt(orderNode[1], 10) : null;
|
|
19860
|
+
const unitNode = node.find(
|
|
19861
|
+
(child) => Array.isArray(child) && (child[0] === "LENGTHUNIT" || child[0] === "ANGLEUNIT" || child[0] === "SCALEUNIT")
|
|
19862
|
+
);
|
|
19863
|
+
const unit = this.convertUnit(unitNode);
|
|
19864
|
+
return {
|
|
19865
|
+
name,
|
|
19866
|
+
direction,
|
|
19867
|
+
// Use the valid PROJJSON direction value
|
|
19868
|
+
unit,
|
|
19869
|
+
order
|
|
19870
|
+
};
|
|
19871
|
+
}
|
|
19872
|
+
static extractAxes(node) {
|
|
19873
|
+
return node.filter((child) => Array.isArray(child) && child[0] === "AXIS").map((axis) => this.convertAxis(axis)).sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
19874
|
+
}
|
|
19875
|
+
static convert(node, result = {}) {
|
|
19876
|
+
switch (node[0]) {
|
|
19877
|
+
case "PROJCRS":
|
|
19878
|
+
result.type = "ProjectedCRS";
|
|
19879
|
+
result.name = node[1];
|
|
19880
|
+
result.base_crs = node.find((child) => Array.isArray(child) && child[0] === "BASEGEOGCRS") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "BASEGEOGCRS")) : null;
|
|
19881
|
+
result.conversion = node.find((child) => Array.isArray(child) && child[0] === "CONVERSION") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "CONVERSION")) : null;
|
|
19882
|
+
const csNode = node.find((child) => Array.isArray(child) && child[0] === "CS");
|
|
19883
|
+
if (csNode) {
|
|
19884
|
+
result.coordinate_system = {
|
|
19885
|
+
type: csNode[1],
|
|
19886
|
+
axis: this.extractAxes(node)
|
|
19887
|
+
};
|
|
19888
|
+
}
|
|
19889
|
+
const lengthUnitNode = node.find((child) => Array.isArray(child) && child[0] === "LENGTHUNIT");
|
|
19890
|
+
if (lengthUnitNode) {
|
|
19891
|
+
const unit2 = this.convertUnit(lengthUnitNode);
|
|
19892
|
+
result.coordinate_system.unit = unit2;
|
|
19893
|
+
}
|
|
19894
|
+
result.id = this.getId(node);
|
|
19895
|
+
break;
|
|
19896
|
+
case "BASEGEOGCRS":
|
|
19897
|
+
case "GEOGCRS":
|
|
19898
|
+
result.type = "GeographicCRS";
|
|
19899
|
+
result.name = node[1];
|
|
19900
|
+
const datumOrEnsembleNode = node.find(
|
|
19901
|
+
(child) => Array.isArray(child) && (child[0] === "DATUM" || child[0] === "ENSEMBLE")
|
|
19902
|
+
);
|
|
19903
|
+
if (datumOrEnsembleNode) {
|
|
19904
|
+
const datumOrEnsemble = this.convert(datumOrEnsembleNode);
|
|
19905
|
+
if (datumOrEnsembleNode[0] === "ENSEMBLE") {
|
|
19906
|
+
result.datum_ensemble = datumOrEnsemble;
|
|
19907
|
+
} else {
|
|
19908
|
+
result.datum = datumOrEnsemble;
|
|
19909
|
+
}
|
|
19910
|
+
const primem = node.find((child) => Array.isArray(child) && child[0] === "PRIMEM");
|
|
19911
|
+
if (primem && primem[1] !== "Greenwich") {
|
|
19912
|
+
datumOrEnsemble.prime_meridian = {
|
|
19913
|
+
name: primem[1],
|
|
19914
|
+
longitude: parseFloat(primem[2])
|
|
19915
|
+
};
|
|
19916
|
+
}
|
|
19917
|
+
}
|
|
19918
|
+
result.coordinate_system = {
|
|
19919
|
+
type: "ellipsoidal",
|
|
19920
|
+
axis: this.extractAxes(node)
|
|
19921
|
+
};
|
|
19922
|
+
result.id = this.getId(node);
|
|
19923
|
+
break;
|
|
19924
|
+
case "DATUM":
|
|
19925
|
+
result.type = "GeodeticReferenceFrame";
|
|
19926
|
+
result.name = node[1];
|
|
19927
|
+
result.ellipsoid = node.find((child) => Array.isArray(child) && child[0] === "ELLIPSOID") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "ELLIPSOID")) : null;
|
|
19928
|
+
break;
|
|
19929
|
+
case "ENSEMBLE":
|
|
19930
|
+
result.type = "DatumEnsemble";
|
|
19931
|
+
result.name = node[1];
|
|
19932
|
+
result.members = node.filter((child) => Array.isArray(child) && child[0] === "MEMBER").map((member) => ({
|
|
19933
|
+
type: "DatumEnsembleMember",
|
|
19934
|
+
name: member[1],
|
|
19935
|
+
id: this.getId(member)
|
|
19936
|
+
// Extract ID as { authority, code }
|
|
19937
|
+
}));
|
|
19938
|
+
const accuracyNode = node.find((child) => Array.isArray(child) && child[0] === "ENSEMBLEACCURACY");
|
|
19939
|
+
if (accuracyNode) {
|
|
19940
|
+
result.accuracy = parseFloat(accuracyNode[1]);
|
|
19941
|
+
}
|
|
19942
|
+
const ellipsoidNode = node.find((child) => Array.isArray(child) && child[0] === "ELLIPSOID");
|
|
19943
|
+
if (ellipsoidNode) {
|
|
19944
|
+
result.ellipsoid = this.convert(ellipsoidNode);
|
|
19945
|
+
}
|
|
19946
|
+
result.id = this.getId(node);
|
|
19947
|
+
break;
|
|
19948
|
+
case "ELLIPSOID":
|
|
19949
|
+
result.type = "Ellipsoid";
|
|
19950
|
+
result.name = node[1];
|
|
19951
|
+
result.semi_major_axis = parseFloat(node[2]);
|
|
19952
|
+
result.inverse_flattening = parseFloat(node[3]);
|
|
19953
|
+
const units = node.find((child) => Array.isArray(child) && child[0] === "LENGTHUNIT") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "LENGTHUNIT"), result) : null;
|
|
19954
|
+
break;
|
|
19955
|
+
case "CONVERSION":
|
|
19956
|
+
result.type = "Conversion";
|
|
19957
|
+
result.name = node[1];
|
|
19958
|
+
result.method = node.find((child) => Array.isArray(child) && child[0] === "METHOD") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "METHOD")) : null;
|
|
19959
|
+
result.parameters = node.filter((child) => Array.isArray(child) && child[0] === "PARAMETER").map((param) => this.convert(param));
|
|
19960
|
+
break;
|
|
19961
|
+
case "METHOD":
|
|
19962
|
+
result.type = "Method";
|
|
19963
|
+
result.name = node[1];
|
|
19964
|
+
result.id = this.getId(node);
|
|
19965
|
+
break;
|
|
19966
|
+
case "PARAMETER":
|
|
19967
|
+
result.type = "Parameter";
|
|
19968
|
+
result.name = node[1];
|
|
19969
|
+
result.value = parseFloat(node[2]);
|
|
19970
|
+
result.unit = this.convertUnit(
|
|
19971
|
+
node.find(
|
|
19972
|
+
(child) => Array.isArray(child) && (child[0] === "LENGTHUNIT" || child[0] === "ANGLEUNIT" || child[0] === "SCALEUNIT")
|
|
19973
|
+
)
|
|
19974
|
+
);
|
|
19975
|
+
result.id = this.getId(node);
|
|
19976
|
+
break;
|
|
19977
|
+
case "BOUNDCRS":
|
|
19978
|
+
result.type = "BoundCRS";
|
|
19979
|
+
const sourceCrsNode = node.find((child) => Array.isArray(child) && child[0] === "SOURCECRS");
|
|
19980
|
+
if (sourceCrsNode) {
|
|
19981
|
+
const sourceCrsContent = sourceCrsNode.find((child) => Array.isArray(child));
|
|
19982
|
+
result.source_crs = sourceCrsContent ? this.convert(sourceCrsContent) : null;
|
|
19983
|
+
}
|
|
19984
|
+
const targetCrsNode = node.find((child) => Array.isArray(child) && child[0] === "TARGETCRS");
|
|
19985
|
+
if (targetCrsNode) {
|
|
19986
|
+
const targetCrsContent = targetCrsNode.find((child) => Array.isArray(child));
|
|
19987
|
+
result.target_crs = targetCrsContent ? this.convert(targetCrsContent) : null;
|
|
19988
|
+
}
|
|
19989
|
+
const transformationNode = node.find((child) => Array.isArray(child) && child[0] === "ABRIDGEDTRANSFORMATION");
|
|
19990
|
+
if (transformationNode) {
|
|
19991
|
+
result.transformation = this.convert(transformationNode);
|
|
19992
|
+
} else {
|
|
19993
|
+
result.transformation = null;
|
|
19994
|
+
}
|
|
19995
|
+
break;
|
|
19996
|
+
case "ABRIDGEDTRANSFORMATION":
|
|
19997
|
+
result.type = "Transformation";
|
|
19998
|
+
result.name = node[1];
|
|
19999
|
+
result.method = node.find((child) => Array.isArray(child) && child[0] === "METHOD") ? this.convert(node.find((child) => Array.isArray(child) && child[0] === "METHOD")) : null;
|
|
20000
|
+
result.parameters = node.filter((child) => Array.isArray(child) && (child[0] === "PARAMETER" || child[0] === "PARAMETERFILE")).map((param) => {
|
|
20001
|
+
if (param[0] === "PARAMETER") {
|
|
20002
|
+
return this.convert(param);
|
|
20003
|
+
} else if (param[0] === "PARAMETERFILE") {
|
|
20004
|
+
return {
|
|
20005
|
+
name: param[1],
|
|
20006
|
+
value: param[2],
|
|
20007
|
+
id: {
|
|
20008
|
+
"authority": "EPSG",
|
|
20009
|
+
"code": 8656
|
|
20010
|
+
}
|
|
20011
|
+
};
|
|
20012
|
+
}
|
|
20013
|
+
});
|
|
20014
|
+
if (result.parameters.length === 7) {
|
|
20015
|
+
const scaleDifference = result.parameters[6];
|
|
20016
|
+
if (scaleDifference.name === "Scale difference") {
|
|
20017
|
+
scaleDifference.value = Math.round((scaleDifference.value - 1) * 1e12) / 1e6;
|
|
20018
|
+
}
|
|
20019
|
+
}
|
|
20020
|
+
result.id = this.getId(node);
|
|
20021
|
+
break;
|
|
20022
|
+
case "AXIS":
|
|
20023
|
+
if (!result.coordinate_system) {
|
|
20024
|
+
result.coordinate_system = { type: "unspecified", axis: [] };
|
|
20025
|
+
}
|
|
20026
|
+
result.coordinate_system.axis.push(this.convertAxis(node));
|
|
20027
|
+
break;
|
|
20028
|
+
case "LENGTHUNIT":
|
|
20029
|
+
const unit = this.convertUnit(node, "LinearUnit");
|
|
20030
|
+
if (result.coordinate_system && result.coordinate_system.axis) {
|
|
20031
|
+
result.coordinate_system.axis.forEach((axis) => {
|
|
20032
|
+
if (!axis.unit) {
|
|
20033
|
+
axis.unit = unit;
|
|
20034
|
+
}
|
|
20035
|
+
});
|
|
20036
|
+
}
|
|
20037
|
+
if (unit.conversion_factor && unit.conversion_factor !== 1) {
|
|
20038
|
+
if (result.semi_major_axis) {
|
|
20039
|
+
result.semi_major_axis = {
|
|
20040
|
+
value: result.semi_major_axis,
|
|
20041
|
+
unit
|
|
20042
|
+
};
|
|
20043
|
+
}
|
|
20044
|
+
}
|
|
20045
|
+
break;
|
|
20046
|
+
default:
|
|
20047
|
+
result.keyword = node[0];
|
|
20048
|
+
break;
|
|
20049
|
+
}
|
|
20050
|
+
return result;
|
|
20051
|
+
}
|
|
20052
|
+
};
|
|
20053
|
+
var PROJJSONBuilderBase_default = PROJJSONBuilderBase;
|
|
20054
|
+
|
|
20055
|
+
// ../../node_modules/wkt-parser/PROJJSONBuilder2015.js
|
|
20056
|
+
var PROJJSONBuilder2015 = class extends PROJJSONBuilderBase_default {
|
|
20057
|
+
static convert(node, result = {}) {
|
|
20058
|
+
super.convert(node, result);
|
|
20059
|
+
if (result.coordinate_system && result.coordinate_system.subtype === "Cartesian") {
|
|
20060
|
+
delete result.coordinate_system;
|
|
20061
|
+
}
|
|
20062
|
+
if (result.usage) {
|
|
20063
|
+
delete result.usage;
|
|
20064
|
+
}
|
|
20065
|
+
return result;
|
|
20066
|
+
}
|
|
20067
|
+
};
|
|
20068
|
+
var PROJJSONBuilder2015_default = PROJJSONBuilder2015;
|
|
20069
|
+
|
|
20070
|
+
// ../../node_modules/wkt-parser/PROJJSONBuilder2019.js
|
|
20071
|
+
var PROJJSONBuilder2019 = class extends PROJJSONBuilderBase_default {
|
|
20072
|
+
static convert(node, result = {}) {
|
|
20073
|
+
super.convert(node, result);
|
|
20074
|
+
const csNode = node.find((child) => Array.isArray(child) && child[0] === "CS");
|
|
20075
|
+
if (csNode) {
|
|
20076
|
+
result.coordinate_system = {
|
|
20077
|
+
subtype: csNode[1],
|
|
20078
|
+
axis: this.extractAxes(node)
|
|
20079
|
+
};
|
|
20080
|
+
}
|
|
20081
|
+
const usageNode = node.find((child) => Array.isArray(child) && child[0] === "USAGE");
|
|
20082
|
+
if (usageNode) {
|
|
20083
|
+
const scope = usageNode.find((child) => Array.isArray(child) && child[0] === "SCOPE");
|
|
20084
|
+
const area = usageNode.find((child) => Array.isArray(child) && child[0] === "AREA");
|
|
20085
|
+
const bbox = usageNode.find((child) => Array.isArray(child) && child[0] === "BBOX");
|
|
20086
|
+
result.usage = {};
|
|
20087
|
+
if (scope) {
|
|
20088
|
+
result.usage.scope = scope[1];
|
|
20089
|
+
}
|
|
20090
|
+
if (area) {
|
|
20091
|
+
result.usage.area = area[1];
|
|
20092
|
+
}
|
|
20093
|
+
if (bbox) {
|
|
20094
|
+
result.usage.bbox = bbox.slice(1);
|
|
20095
|
+
}
|
|
20096
|
+
}
|
|
20097
|
+
return result;
|
|
20098
|
+
}
|
|
20099
|
+
};
|
|
20100
|
+
var PROJJSONBuilder2019_default = PROJJSONBuilder2019;
|
|
20101
|
+
|
|
20102
|
+
// ../../node_modules/wkt-parser/buildPROJJSON.js
|
|
20103
|
+
function detectWKT2Version(root) {
|
|
20104
|
+
if (root.find((child) => Array.isArray(child) && child[0] === "USAGE")) {
|
|
20105
|
+
return "2019";
|
|
20106
|
+
}
|
|
20107
|
+
if (root.find((child) => Array.isArray(child) && child[0] === "CS")) {
|
|
20108
|
+
return "2015";
|
|
20109
|
+
}
|
|
20110
|
+
if (root[0] === "BOUNDCRS" || root[0] === "PROJCRS" || root[0] === "GEOGCRS") {
|
|
20111
|
+
return "2015";
|
|
20112
|
+
}
|
|
20113
|
+
return "2015";
|
|
20114
|
+
}
|
|
20115
|
+
function buildPROJJSON(root) {
|
|
20116
|
+
const version = detectWKT2Version(root);
|
|
20117
|
+
const builder = version === "2019" ? PROJJSONBuilder2019_default : PROJJSONBuilder2015_default;
|
|
20118
|
+
return builder.convert(root);
|
|
20119
|
+
}
|
|
20120
|
+
|
|
20121
|
+
// ../../node_modules/wkt-parser/detectWKTVersion.js
|
|
20122
|
+
function detectWKTVersion(wkt) {
|
|
20123
|
+
const normalizedWKT = wkt.toUpperCase();
|
|
20124
|
+
if (normalizedWKT.includes("PROJCRS") || normalizedWKT.includes("GEOGCRS") || normalizedWKT.includes("BOUNDCRS") || normalizedWKT.includes("VERTCRS") || normalizedWKT.includes("LENGTHUNIT") || normalizedWKT.includes("ANGLEUNIT") || normalizedWKT.includes("SCALEUNIT")) {
|
|
20125
|
+
return "WKT2";
|
|
20126
|
+
}
|
|
20127
|
+
if (normalizedWKT.includes("PROJCS") || normalizedWKT.includes("GEOGCS") || normalizedWKT.includes("LOCAL_CS") || normalizedWKT.includes("VERT_CS") || normalizedWKT.includes("UNIT")) {
|
|
20128
|
+
return "WKT1";
|
|
20129
|
+
}
|
|
20130
|
+
return "WKT1";
|
|
20131
|
+
}
|
|
20132
|
+
|
|
19811
20133
|
// ../../node_modules/wkt-parser/parser.js
|
|
19812
20134
|
var parser_default = parseString;
|
|
19813
20135
|
var NEUTRAL = 1;
|
|
@@ -20050,6 +20372,19 @@ var __exports__ = (() => {
|
|
|
20050
20372
|
sExpr(v[3], obj[key]);
|
|
20051
20373
|
}
|
|
20052
20374
|
return;
|
|
20375
|
+
case "EDATUM":
|
|
20376
|
+
case "ENGINEERINGDATUM":
|
|
20377
|
+
case "LOCAL_DATUM":
|
|
20378
|
+
case "DATUM":
|
|
20379
|
+
case "VERT_CS":
|
|
20380
|
+
case "VERTCRS":
|
|
20381
|
+
case "VERTICALCRS":
|
|
20382
|
+
v[0] = ["name", v[0]];
|
|
20383
|
+
mapit(obj, key, v);
|
|
20384
|
+
return;
|
|
20385
|
+
case "COMPD_CS":
|
|
20386
|
+
case "COMPOUNDCRS":
|
|
20387
|
+
case "FITTED_CS":
|
|
20053
20388
|
case "PROJECTEDCRS":
|
|
20054
20389
|
case "PROJCRS":
|
|
20055
20390
|
case "GEOGCS":
|
|
@@ -20059,20 +20394,11 @@ var __exports__ = (() => {
|
|
|
20059
20394
|
case "GEODCRS":
|
|
20060
20395
|
case "GEODETICCRS":
|
|
20061
20396
|
case "GEODETICDATUM":
|
|
20062
|
-
case "EDATUM":
|
|
20063
|
-
case "ENGINEERINGDATUM":
|
|
20064
|
-
case "VERT_CS":
|
|
20065
|
-
case "VERTCRS":
|
|
20066
|
-
case "VERTICALCRS":
|
|
20067
|
-
case "COMPD_CS":
|
|
20068
|
-
case "COMPOUNDCRS":
|
|
20069
|
-
case "ENGINEERINGCRS":
|
|
20070
20397
|
case "ENGCRS":
|
|
20071
|
-
case "
|
|
20072
|
-
case "LOCAL_DATUM":
|
|
20073
|
-
case "DATUM":
|
|
20398
|
+
case "ENGINEERINGCRS":
|
|
20074
20399
|
v[0] = ["name", v[0]];
|
|
20075
20400
|
mapit(obj, key, v);
|
|
20401
|
+
obj[key].type = key;
|
|
20076
20402
|
return;
|
|
20077
20403
|
default:
|
|
20078
20404
|
i = -1;
|
|
@@ -20085,8 +20411,276 @@ var __exports__ = (() => {
|
|
|
20085
20411
|
}
|
|
20086
20412
|
}
|
|
20087
20413
|
|
|
20088
|
-
// ../../node_modules/wkt-parser/
|
|
20414
|
+
// ../../node_modules/wkt-parser/util.js
|
|
20089
20415
|
var D2R2 = 0.017453292519943295;
|
|
20416
|
+
function d2r(input) {
|
|
20417
|
+
return input * D2R2;
|
|
20418
|
+
}
|
|
20419
|
+
function applyProjectionDefaults(wkt) {
|
|
20420
|
+
const normalizedProjName = (wkt.projName || "").toLowerCase().replace(/_/g, " ");
|
|
20421
|
+
if (!wkt.long0 && wkt.longc && (normalizedProjName === "albers conic equal area" || normalizedProjName === "lambert azimuthal equal area")) {
|
|
20422
|
+
wkt.long0 = wkt.longc;
|
|
20423
|
+
}
|
|
20424
|
+
if (!wkt.lat_ts && wkt.lat1 && (normalizedProjName === "stereographic south pole" || normalizedProjName === "polar stereographic (variant b)")) {
|
|
20425
|
+
wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
|
|
20426
|
+
wkt.lat_ts = wkt.lat1;
|
|
20427
|
+
delete wkt.lat1;
|
|
20428
|
+
} else if (!wkt.lat_ts && wkt.lat0 && (normalizedProjName === "polar stereographic" || normalizedProjName === "polar stereographic (variant a)")) {
|
|
20429
|
+
wkt.lat_ts = wkt.lat0;
|
|
20430
|
+
wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);
|
|
20431
|
+
delete wkt.lat1;
|
|
20432
|
+
}
|
|
20433
|
+
}
|
|
20434
|
+
|
|
20435
|
+
// ../../node_modules/wkt-parser/transformPROJJSON.js
|
|
20436
|
+
function processUnit(unit) {
|
|
20437
|
+
let result = { units: null, to_meter: void 0 };
|
|
20438
|
+
if (typeof unit === "string") {
|
|
20439
|
+
result.units = unit.toLowerCase();
|
|
20440
|
+
if (result.units === "metre") {
|
|
20441
|
+
result.units = "meter";
|
|
20442
|
+
}
|
|
20443
|
+
if (result.units === "meter") {
|
|
20444
|
+
result.to_meter = 1;
|
|
20445
|
+
}
|
|
20446
|
+
} else if (unit && unit.name) {
|
|
20447
|
+
result.units = unit.name.toLowerCase();
|
|
20448
|
+
if (result.units === "metre") {
|
|
20449
|
+
result.units = "meter";
|
|
20450
|
+
}
|
|
20451
|
+
result.to_meter = unit.conversion_factor;
|
|
20452
|
+
}
|
|
20453
|
+
return result;
|
|
20454
|
+
}
|
|
20455
|
+
function toValue(valueOrObject) {
|
|
20456
|
+
if (typeof valueOrObject === "object") {
|
|
20457
|
+
return valueOrObject.value * valueOrObject.unit.conversion_factor;
|
|
20458
|
+
}
|
|
20459
|
+
return valueOrObject;
|
|
20460
|
+
}
|
|
20461
|
+
function calculateEllipsoid(value, result) {
|
|
20462
|
+
if (value.ellipsoid.radius) {
|
|
20463
|
+
result.a = value.ellipsoid.radius;
|
|
20464
|
+
result.rf = 0;
|
|
20465
|
+
} else {
|
|
20466
|
+
result.a = toValue(value.ellipsoid.semi_major_axis);
|
|
20467
|
+
if (value.ellipsoid.inverse_flattening !== void 0) {
|
|
20468
|
+
result.rf = value.ellipsoid.inverse_flattening;
|
|
20469
|
+
} else if (value.ellipsoid.semi_major_axis !== void 0 && value.ellipsoid.semi_minor_axis !== void 0) {
|
|
20470
|
+
result.rf = result.a / (result.a - toValue(value.ellipsoid.semi_minor_axis));
|
|
20471
|
+
}
|
|
20472
|
+
}
|
|
20473
|
+
}
|
|
20474
|
+
function transformPROJJSON(projjson, result = {}) {
|
|
20475
|
+
if (!projjson || typeof projjson !== "object") {
|
|
20476
|
+
return projjson;
|
|
20477
|
+
}
|
|
20478
|
+
if (projjson.type === "BoundCRS") {
|
|
20479
|
+
transformPROJJSON(projjson.source_crs, result);
|
|
20480
|
+
if (projjson.transformation) {
|
|
20481
|
+
if (projjson.transformation.method && projjson.transformation.method.name === "NTv2") {
|
|
20482
|
+
result.nadgrids = projjson.transformation.parameters[0].value;
|
|
20483
|
+
} else {
|
|
20484
|
+
result.datum_params = projjson.transformation.parameters.map((param) => param.value);
|
|
20485
|
+
}
|
|
20486
|
+
}
|
|
20487
|
+
return result;
|
|
20488
|
+
}
|
|
20489
|
+
Object.keys(projjson).forEach((key) => {
|
|
20490
|
+
const value = projjson[key];
|
|
20491
|
+
if (value === null) {
|
|
20492
|
+
return;
|
|
20493
|
+
}
|
|
20494
|
+
switch (key) {
|
|
20495
|
+
case "name":
|
|
20496
|
+
if (result.srsCode) {
|
|
20497
|
+
break;
|
|
20498
|
+
}
|
|
20499
|
+
result.name = value;
|
|
20500
|
+
result.srsCode = value;
|
|
20501
|
+
break;
|
|
20502
|
+
case "type":
|
|
20503
|
+
if (value === "GeographicCRS") {
|
|
20504
|
+
result.projName = "longlat";
|
|
20505
|
+
} else if (value === "ProjectedCRS" && projjson.conversion && projjson.conversion.method) {
|
|
20506
|
+
result.projName = projjson.conversion.method.name;
|
|
20507
|
+
}
|
|
20508
|
+
break;
|
|
20509
|
+
case "datum":
|
|
20510
|
+
case "datum_ensemble":
|
|
20511
|
+
if (value.ellipsoid) {
|
|
20512
|
+
result.ellps = value.ellipsoid.name;
|
|
20513
|
+
calculateEllipsoid(value, result);
|
|
20514
|
+
}
|
|
20515
|
+
if (value.prime_meridian) {
|
|
20516
|
+
result.from_greenwich = value.prime_meridian.longitude * Math.PI / 180;
|
|
20517
|
+
}
|
|
20518
|
+
break;
|
|
20519
|
+
case "ellipsoid":
|
|
20520
|
+
result.ellps = value.name;
|
|
20521
|
+
calculateEllipsoid(value, result);
|
|
20522
|
+
break;
|
|
20523
|
+
case "prime_meridian":
|
|
20524
|
+
result.long0 = (value.longitude || 0) * Math.PI / 180;
|
|
20525
|
+
break;
|
|
20526
|
+
case "coordinate_system":
|
|
20527
|
+
if (value.axis) {
|
|
20528
|
+
result.axis = value.axis.map((axis) => {
|
|
20529
|
+
const direction = axis.direction;
|
|
20530
|
+
if (direction === "east")
|
|
20531
|
+
return "e";
|
|
20532
|
+
if (direction === "north")
|
|
20533
|
+
return "n";
|
|
20534
|
+
if (direction === "west")
|
|
20535
|
+
return "w";
|
|
20536
|
+
if (direction === "south")
|
|
20537
|
+
return "s";
|
|
20538
|
+
throw new Error(`Unknown axis direction: ${direction}`);
|
|
20539
|
+
}).join("") + "u";
|
|
20540
|
+
if (value.unit) {
|
|
20541
|
+
const { units, to_meter } = processUnit(value.unit);
|
|
20542
|
+
result.units = units;
|
|
20543
|
+
result.to_meter = to_meter;
|
|
20544
|
+
} else if (value.axis[0] && value.axis[0].unit) {
|
|
20545
|
+
const { units, to_meter } = processUnit(value.axis[0].unit);
|
|
20546
|
+
result.units = units;
|
|
20547
|
+
result.to_meter = to_meter;
|
|
20548
|
+
}
|
|
20549
|
+
}
|
|
20550
|
+
break;
|
|
20551
|
+
case "id":
|
|
20552
|
+
if (value.authority && value.code) {
|
|
20553
|
+
result.title = value.authority + ":" + value.code;
|
|
20554
|
+
}
|
|
20555
|
+
break;
|
|
20556
|
+
case "conversion":
|
|
20557
|
+
if (value.method && value.method.name) {
|
|
20558
|
+
result.projName = value.method.name;
|
|
20559
|
+
}
|
|
20560
|
+
if (value.parameters) {
|
|
20561
|
+
value.parameters.forEach((param) => {
|
|
20562
|
+
const paramName = param.name.toLowerCase().replace(/\s+/g, "_");
|
|
20563
|
+
const paramValue = param.value;
|
|
20564
|
+
if (param.unit && param.unit.conversion_factor) {
|
|
20565
|
+
result[paramName] = paramValue * param.unit.conversion_factor;
|
|
20566
|
+
} else if (param.unit === "degree") {
|
|
20567
|
+
result[paramName] = paramValue * Math.PI / 180;
|
|
20568
|
+
} else {
|
|
20569
|
+
result[paramName] = paramValue;
|
|
20570
|
+
}
|
|
20571
|
+
});
|
|
20572
|
+
}
|
|
20573
|
+
break;
|
|
20574
|
+
case "unit":
|
|
20575
|
+
if (value.name) {
|
|
20576
|
+
result.units = value.name.toLowerCase();
|
|
20577
|
+
if (result.units === "metre") {
|
|
20578
|
+
result.units = "meter";
|
|
20579
|
+
}
|
|
20580
|
+
}
|
|
20581
|
+
if (value.conversion_factor) {
|
|
20582
|
+
result.to_meter = value.conversion_factor;
|
|
20583
|
+
}
|
|
20584
|
+
break;
|
|
20585
|
+
case "base_crs":
|
|
20586
|
+
transformPROJJSON(value, result);
|
|
20587
|
+
result.datumCode = value.id ? value.id.authority + "_" + value.id.code : value.name;
|
|
20588
|
+
break;
|
|
20589
|
+
default:
|
|
20590
|
+
break;
|
|
20591
|
+
}
|
|
20592
|
+
});
|
|
20593
|
+
if (result.latitude_of_false_origin !== void 0) {
|
|
20594
|
+
result.lat0 = result.latitude_of_false_origin;
|
|
20595
|
+
}
|
|
20596
|
+
if (result.longitude_of_false_origin !== void 0) {
|
|
20597
|
+
result.long0 = result.longitude_of_false_origin;
|
|
20598
|
+
}
|
|
20599
|
+
if (result.latitude_of_standard_parallel !== void 0) {
|
|
20600
|
+
result.lat0 = result.latitude_of_standard_parallel;
|
|
20601
|
+
result.lat1 = result.latitude_of_standard_parallel;
|
|
20602
|
+
}
|
|
20603
|
+
if (result.latitude_of_1st_standard_parallel !== void 0) {
|
|
20604
|
+
result.lat1 = result.latitude_of_1st_standard_parallel;
|
|
20605
|
+
}
|
|
20606
|
+
if (result.latitude_of_2nd_standard_parallel !== void 0) {
|
|
20607
|
+
result.lat2 = result.latitude_of_2nd_standard_parallel;
|
|
20608
|
+
}
|
|
20609
|
+
if (result.latitude_of_projection_centre !== void 0) {
|
|
20610
|
+
result.lat0 = result.latitude_of_projection_centre;
|
|
20611
|
+
}
|
|
20612
|
+
if (result.longitude_of_projection_centre !== void 0) {
|
|
20613
|
+
result.longc = result.longitude_of_projection_centre;
|
|
20614
|
+
}
|
|
20615
|
+
if (result.easting_at_false_origin !== void 0) {
|
|
20616
|
+
result.x0 = result.easting_at_false_origin;
|
|
20617
|
+
}
|
|
20618
|
+
if (result.northing_at_false_origin !== void 0) {
|
|
20619
|
+
result.y0 = result.northing_at_false_origin;
|
|
20620
|
+
}
|
|
20621
|
+
if (result.latitude_of_natural_origin !== void 0) {
|
|
20622
|
+
result.lat0 = result.latitude_of_natural_origin;
|
|
20623
|
+
}
|
|
20624
|
+
if (result.longitude_of_natural_origin !== void 0) {
|
|
20625
|
+
result.long0 = result.longitude_of_natural_origin;
|
|
20626
|
+
}
|
|
20627
|
+
if (result.longitude_of_origin !== void 0) {
|
|
20628
|
+
result.long0 = result.longitude_of_origin;
|
|
20629
|
+
}
|
|
20630
|
+
if (result.false_easting !== void 0) {
|
|
20631
|
+
result.x0 = result.false_easting;
|
|
20632
|
+
}
|
|
20633
|
+
if (result.easting_at_projection_centre) {
|
|
20634
|
+
result.x0 = result.easting_at_projection_centre;
|
|
20635
|
+
}
|
|
20636
|
+
if (result.false_northing !== void 0) {
|
|
20637
|
+
result.y0 = result.false_northing;
|
|
20638
|
+
}
|
|
20639
|
+
if (result.northing_at_projection_centre) {
|
|
20640
|
+
result.y0 = result.northing_at_projection_centre;
|
|
20641
|
+
}
|
|
20642
|
+
if (result.standard_parallel_1 !== void 0) {
|
|
20643
|
+
result.lat1 = result.standard_parallel_1;
|
|
20644
|
+
}
|
|
20645
|
+
if (result.standard_parallel_2 !== void 0) {
|
|
20646
|
+
result.lat2 = result.standard_parallel_2;
|
|
20647
|
+
}
|
|
20648
|
+
if (result.scale_factor_at_natural_origin !== void 0) {
|
|
20649
|
+
result.k0 = result.scale_factor_at_natural_origin;
|
|
20650
|
+
}
|
|
20651
|
+
if (result.scale_factor_at_projection_centre !== void 0) {
|
|
20652
|
+
result.k0 = result.scale_factor_at_projection_centre;
|
|
20653
|
+
}
|
|
20654
|
+
if (result.scale_factor_on_pseudo_standard_parallel !== void 0) {
|
|
20655
|
+
result.k0 = result.scale_factor_on_pseudo_standard_parallel;
|
|
20656
|
+
}
|
|
20657
|
+
if (result.azimuth !== void 0) {
|
|
20658
|
+
result.alpha = result.azimuth;
|
|
20659
|
+
}
|
|
20660
|
+
if (result.azimuth_at_projection_centre !== void 0) {
|
|
20661
|
+
result.alpha = result.azimuth_at_projection_centre;
|
|
20662
|
+
}
|
|
20663
|
+
if (result.angle_from_rectified_to_skew_grid) {
|
|
20664
|
+
result.rectified_grid_angle = result.angle_from_rectified_to_skew_grid;
|
|
20665
|
+
}
|
|
20666
|
+
applyProjectionDefaults(result);
|
|
20667
|
+
return result;
|
|
20668
|
+
}
|
|
20669
|
+
|
|
20670
|
+
// ../../node_modules/wkt-parser/index.js
|
|
20671
|
+
var knownTypes = [
|
|
20672
|
+
"PROJECTEDCRS",
|
|
20673
|
+
"PROJCRS",
|
|
20674
|
+
"GEOGCS",
|
|
20675
|
+
"GEOCCS",
|
|
20676
|
+
"PROJCS",
|
|
20677
|
+
"LOCAL_CS",
|
|
20678
|
+
"GEODCRS",
|
|
20679
|
+
"GEODETICCRS",
|
|
20680
|
+
"GEODETICDATUM",
|
|
20681
|
+
"ENGCRS",
|
|
20682
|
+
"ENGINEERINGCRS"
|
|
20683
|
+
];
|
|
20090
20684
|
function rename(obj, params) {
|
|
20091
20685
|
var outName = params[0];
|
|
20092
20686
|
var inName = params[1];
|
|
@@ -20097,10 +20691,25 @@ var __exports__ = (() => {
|
|
|
20097
20691
|
}
|
|
20098
20692
|
}
|
|
20099
20693
|
}
|
|
20100
|
-
function d2r(input) {
|
|
20101
|
-
return input * D2R2;
|
|
20102
|
-
}
|
|
20103
20694
|
function cleanWKT(wkt) {
|
|
20695
|
+
var keys = Object.keys(wkt);
|
|
20696
|
+
for (var i = 0, ii = keys.length; i < ii; ++i) {
|
|
20697
|
+
var key = keys[i];
|
|
20698
|
+
if (knownTypes.indexOf(key) !== -1) {
|
|
20699
|
+
setPropertiesFromWkt(wkt[key]);
|
|
20700
|
+
}
|
|
20701
|
+
if (typeof wkt[key] === "object") {
|
|
20702
|
+
cleanWKT(wkt[key]);
|
|
20703
|
+
}
|
|
20704
|
+
}
|
|
20705
|
+
}
|
|
20706
|
+
function setPropertiesFromWkt(wkt) {
|
|
20707
|
+
if (wkt.AUTHORITY) {
|
|
20708
|
+
var authority = Object.keys(wkt.AUTHORITY)[0];
|
|
20709
|
+
if (authority && authority in wkt.AUTHORITY) {
|
|
20710
|
+
wkt.title = authority + ":" + wkt.AUTHORITY[authority];
|
|
20711
|
+
}
|
|
20712
|
+
}
|
|
20104
20713
|
if (wkt.type === "GEOGCS") {
|
|
20105
20714
|
wkt.projName = "longlat";
|
|
20106
20715
|
} else if (wkt.type === "LOCAL_CS") {
|
|
@@ -20162,7 +20771,7 @@ var __exports__ = (() => {
|
|
|
20162
20771
|
if (wkt.datumCode.slice(0, 2) === "d_") {
|
|
20163
20772
|
wkt.datumCode = wkt.datumCode.slice(2);
|
|
20164
20773
|
}
|
|
20165
|
-
if (wkt.datumCode === "
|
|
20774
|
+
if (wkt.datumCode === "new_zealand_1949") {
|
|
20166
20775
|
wkt.datumCode = "nzgd49";
|
|
20167
20776
|
}
|
|
20168
20777
|
if (wkt.datumCode === "wgs_1984" || wkt.datumCode === "world_geodetic_system_1984") {
|
|
@@ -20171,13 +20780,7 @@ var __exports__ = (() => {
|
|
|
20171
20780
|
}
|
|
20172
20781
|
wkt.datumCode = "wgs84";
|
|
20173
20782
|
}
|
|
20174
|
-
if (wkt.datumCode
|
|
20175
|
-
wkt.datumCode = wkt.datumCode.slice(0, -6);
|
|
20176
|
-
}
|
|
20177
|
-
if (wkt.datumCode.slice(-8) === "_jakarta") {
|
|
20178
|
-
wkt.datumCode = wkt.datumCode.slice(0, -8);
|
|
20179
|
-
}
|
|
20180
|
-
if (~wkt.datumCode.indexOf("belge")) {
|
|
20783
|
+
if (wkt.datumCode === "belge_1972") {
|
|
20181
20784
|
wkt.datumCode = "rnb72";
|
|
20182
20785
|
}
|
|
20183
20786
|
if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
|
|
@@ -20210,6 +20813,9 @@ var __exports__ = (() => {
|
|
|
20210
20813
|
if (wkt.b && !isFinite(wkt.b)) {
|
|
20211
20814
|
wkt.b = wkt.a;
|
|
20212
20815
|
}
|
|
20816
|
+
if (wkt.rectified_grid_angle) {
|
|
20817
|
+
wkt.rectified_grid_angle = d2r(wkt.rectified_grid_angle);
|
|
20818
|
+
}
|
|
20213
20819
|
function toMeter(input) {
|
|
20214
20820
|
var ratio = wkt.to_meter || 1;
|
|
20215
20821
|
return input * ratio;
|
|
@@ -20255,27 +20861,23 @@ var __exports__ = (() => {
|
|
|
20255
20861
|
["srsCode", "name"]
|
|
20256
20862
|
];
|
|
20257
20863
|
list.forEach(renamer);
|
|
20258
|
-
|
|
20259
|
-
wkt.long0 = wkt.longc;
|
|
20260
|
-
}
|
|
20261
|
-
if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === "Stereographic_South_Pole" || wkt.projName === "Polar Stereographic (variant B)")) {
|
|
20262
|
-
wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
|
|
20263
|
-
wkt.lat_ts = wkt.lat1;
|
|
20264
|
-
} else if (!wkt.lat_ts && wkt.lat0 && wkt.projName === "Polar_Stereographic") {
|
|
20265
|
-
wkt.lat_ts = wkt.lat0;
|
|
20266
|
-
wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);
|
|
20267
|
-
}
|
|
20864
|
+
applyProjectionDefaults(wkt);
|
|
20268
20865
|
}
|
|
20269
20866
|
function wkt_parser_default(wkt) {
|
|
20867
|
+
if (typeof wkt === "object") {
|
|
20868
|
+
return transformPROJJSON(wkt);
|
|
20869
|
+
}
|
|
20870
|
+
const version = detectWKTVersion(wkt);
|
|
20270
20871
|
var lisp = parser_default(wkt);
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20872
|
+
if (version === "WKT2") {
|
|
20873
|
+
const projjson = buildPROJJSON(lisp);
|
|
20874
|
+
return transformPROJJSON(projjson);
|
|
20875
|
+
}
|
|
20876
|
+
var type = lisp[0];
|
|
20275
20877
|
var obj = {};
|
|
20276
20878
|
sExpr(lisp, obj);
|
|
20277
20879
|
cleanWKT(obj);
|
|
20278
|
-
return obj;
|
|
20880
|
+
return obj[type];
|
|
20279
20881
|
}
|
|
20280
20882
|
|
|
20281
20883
|
// ../../node_modules/proj4/lib/defs.js
|