@itwin/core-backend 5.13.0-dev.2 → 5.13.0-dev.4

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EditTxn.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditTxn.test.d.ts","sourceRoot":"","sources":["../../../../src/test/example-code/EditTxn.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { expect } from "chai";
6
+ import { EditTxn, Element, IModelDb, IModelJsFs, StandaloneDb, Subject, withEditTxn } from "../../core-backend";
7
+ import { IModelTestUtils } from "../IModelTestUtils";
8
+ const relatedElementLabel = "Updated from element callback";
9
+ class ElementWithRelatedUpdate extends Element {
10
+ static get className() { return "ElementWithRelatedUpdate"; }
11
+ // __PUBLISH_EXTRACT_START__ EditTxn.ElementCallback
12
+ static onUpdate(arg) {
13
+ super.onUpdate(arg);
14
+ if (undefined !== arg.props.parent)
15
+ arg.iModel.getIndirectTxn().updateElement({ id: arg.props.parent.id, userLabel: "Updated from element callback" });
16
+ }
17
+ // __PUBLISH_EXTRACT_END__
18
+ static invokeOnUpdate(arg) {
19
+ this.onUpdate(arg);
20
+ }
21
+ }
22
+ describe("EditTxn examples", () => {
23
+ it("reuses the active transaction for writes from an element callback", () => {
24
+ const previousEnforcement = EditTxn.implicitWriteEnforcement;
25
+ const fileName = IModelTestUtils.prepareOutputFile("EditTxnExamples", "EditTxnExamples.bim");
26
+ const iModel = StandaloneDb.createEmpty(fileName, {
27
+ rootSubject: { name: "EditTxn examples" },
28
+ enableTransactions: true,
29
+ });
30
+ try {
31
+ const childId = withEditTxn(iModel, (txn) => Subject.insert(txn, IModelDb.rootSubjectId, "Child subject"));
32
+ const childProps = iModel.elements.getElementProps(childId);
33
+ EditTxn.implicitWriteEnforcement = "throw";
34
+ withEditTxn(iModel, (txn) => {
35
+ ElementWithRelatedUpdate.invokeOnUpdate({ iModel, props: childProps });
36
+ expect(iModel.getIndirectTxn()).to.equal(txn);
37
+ });
38
+ expect(iModel.elements.getElementProps(IModelDb.rootSubjectId).userLabel).to.equal(relatedElementLabel);
39
+ }
40
+ finally {
41
+ EditTxn.implicitWriteEnforcement = previousEnforcement;
42
+ iModel.close();
43
+ IModelJsFs.removeSync(fileName);
44
+ }
45
+ });
46
+ });
47
+ //# sourceMappingURL=EditTxn.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditTxn.test.js","sourceRoot":"","sources":["../../../../src/test/example-code/EditTxn.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAqB,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACnI,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAE5D,MAAM,wBAAyB,SAAQ,OAAO;IACrC,MAAM,KAAc,SAAS,KAAa,OAAO,0BAA0B,CAAC,CAAC,CAAC;IAErF,oDAAoD;IAC1C,MAAM,CAAU,QAAQ,CAAC,GAAsB;QACvD,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpB,IAAI,SAAS,KAAK,GAAG,CAAC,KAAK,CAAC,MAAM;YAChC,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,+BAA+B,EAAE,CAAC,CAAC;IACvH,CAAC;IACD,0BAA0B;IAEnB,MAAM,CAAC,cAAc,CAAC,GAAsB;QACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;CACF;AAED,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,mBAAmB,GAAG,OAAO,CAAC,wBAAwB,CAAC;QAC7D,MAAM,QAAQ,GAAG,eAAe,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,QAAQ,EAAE;YAChD,WAAW,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;YACzC,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC;YAC3G,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAC5D,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC;YAE3C,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC1B,wBAAwB,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;gBACvE,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC1G,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,wBAAwB,GAAG,mBAAmB,CAAC;YACvD,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { expect } from \"chai\";\nimport { EditTxn, Element, IModelDb, IModelJsFs, OnElementPropsArg, StandaloneDb, Subject, withEditTxn } from \"../../core-backend\";\nimport { IModelTestUtils } from \"../IModelTestUtils\";\n\nconst relatedElementLabel = \"Updated from element callback\";\n\nclass ElementWithRelatedUpdate extends Element {\n public static override get className(): string { return \"ElementWithRelatedUpdate\"; }\n\n // __PUBLISH_EXTRACT_START__ EditTxn.ElementCallback\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n if (undefined !== arg.props.parent)\n arg.iModel.getIndirectTxn().updateElement({ id: arg.props.parent.id, userLabel: \"Updated from element callback\" });\n }\n // __PUBLISH_EXTRACT_END__\n\n public static invokeOnUpdate(arg: OnElementPropsArg): void {\n this.onUpdate(arg);\n }\n}\n\ndescribe(\"EditTxn examples\", () => {\n it(\"reuses the active transaction for writes from an element callback\", () => {\n const previousEnforcement = EditTxn.implicitWriteEnforcement;\n const fileName = IModelTestUtils.prepareOutputFile(\"EditTxnExamples\", \"EditTxnExamples.bim\");\n const iModel = StandaloneDb.createEmpty(fileName, {\n rootSubject: { name: \"EditTxn examples\" },\n enableTransactions: true,\n });\n\n try {\n const childId = withEditTxn(iModel, (txn) => Subject.insert(txn, IModelDb.rootSubjectId, \"Child subject\"));\n const childProps = iModel.elements.getElementProps(childId);\n EditTxn.implicitWriteEnforcement = \"throw\";\n\n withEditTxn(iModel, (txn) => {\n ElementWithRelatedUpdate.invokeOnUpdate({ iModel, props: childProps });\n expect(iModel.getIndirectTxn()).to.equal(txn);\n });\n\n expect(iModel.elements.getElementProps(IModelDb.rootSubjectId).userLabel).to.equal(relatedElementLabel);\n } finally {\n EditTxn.implicitWriteEnforcement = previousEnforcement;\n iModel.close();\n IModelJsFs.removeSync(fileName);\n }\n });\n});\n"]}
@@ -58,7 +58,7 @@ import { assert, expect } from "chai";
58
58
  import * as path from "path";
59
59
  import * as semver from "semver";
60
60
  import * as sinon from "sinon";
61
- import { DbResult, Guid, Id64, IModelStatus, Logger, OpenMode, ProcessDetector } from "@itwin/core-bentley";
61
+ import { DbResult, Guid, Id64, IModelStatus, Logger, OpenMode } from "@itwin/core-bentley";
62
62
  import { EditTxn, withEditTxn } from "../../EditTxn";
63
63
  import { BisCodeSpec, BriefcaseIdValue, Code, CodeScopeSpec, CodeSpec, ColorByName, ColorDef, DisplayStyleSettings, EcefLocation, FontMap, FontType, GeoCoordStatus, GeographicCRS, GeometryParams, GeometryStreamBuilder, ImageSourceFormat, IModel, IModelError, QueryBinder, RelatedElement, RenderMode, SchemaState, SubCategoryAppearance, TextureMapping, TextureMapUnits, ViewFlags, } from "@itwin/core-common";
64
64
  import { Geometry, LineString3d, Loop, Matrix4d, Point3d, PolyfaceBuilder, Range3d, StrokeOptions, Transform, YawPitchRollAngles, } from "@itwin/core-geometry";
@@ -1754,267 +1754,265 @@ describe("iModel", () => {
1754
1754
  }
1755
1755
  });
1756
1756
  });
1757
- if (!ProcessDetector.isIOSAppBackend) {
1758
- it("should be able to reproject with iModel coordinates to or from any other GeographicCRS", async () => {
1759
- const convertTest = async (fileName, fileGCS, datum, inputCoord, outputCoord) => {
1760
- const args = {
1761
- rootSubject: { name: "TestSubject", description: "test project" },
1762
- client: "ABC Engineering",
1763
- globalOrigin: { x: 0.0, y: 0.0 },
1764
- projectExtents: { low: { x: -300, y: -300, z: -20 }, high: { x: 500, y: 500, z: 400 } },
1765
- guid: Guid.createValue(),
1766
- };
1767
- let datumOrGCS;
1768
- if (typeof datum === "object")
1769
- datumOrGCS = JSON.stringify(datum);
1770
- else
1771
- datumOrGCS = datum;
1772
- const testFile = IModelTestUtils.prepareOutputFile("IModel", fileName);
1773
- const iModel = SnapshotDb.createEmpty(testFile, args);
1774
- withEditTxn(iModel, (txn) => {
1775
- iModel.setGeographicCoordinateSystem(fileGCS);
1776
- txn.updateIModelProps();
1777
- });
1778
- const testPoint1 = [];
1779
- testPoint1.push(inputCoord);
1780
- const requestProps1 = { target: datumOrGCS, iModelCoords: testPoint1 };
1781
- const response1 = await iModel.getGeoCoordinatesFromIModelCoordinates(requestProps1);
1782
- expect(response1.geoCoords[0].s === outputCoord.s).to.be.true;
1783
- // If success or warning we compare result
1784
- if (outputCoord.s === GeoCoordStatus.Success || outputCoord.s === GeoCoordStatus.OutOfUsefulRange) {
1785
- const expectedPt1 = Point3d.fromJSON(outputCoord.p);
1786
- const outPt1 = Point3d.fromJSON(response1.geoCoords[0].p);
1787
- expect(Geometry.isSamePoint3dXY(expectedPt1, outPt1, 0.001)).to.be.true;
1788
- expect(Math.abs(expectedPt1.z - outPt1.z) < 0.0001).to.be.true;
1789
- // No point testing reversal when Out of useful range since reversibility is doubtful
1790
- if (outputCoord.s !== GeoCoordStatus.OutOfUsefulRange) {
1791
- const testPoint2 = [];
1792
- testPoint2.push(outputCoord.p);
1793
- const requestProps2 = { source: datumOrGCS, geoCoords: testPoint2 };
1794
- const response2 = await iModel.getIModelCoordinatesFromGeoCoordinates(requestProps2);
1795
- const expectedPt2 = Point3d.fromJSON(inputCoord);
1796
- const outPt2 = Point3d.fromJSON(response2.iModelCoords[0].p);
1797
- expect(expectedPt2.distanceXY(outPt2) < 0.001).to.be.true;
1798
- expect(Math.abs(expectedPt2.z - outPt2.z) < 0.001).to.be.true;
1799
- }
1800
- }
1801
- iModel.close();
1757
+ it("should be able to reproject with iModel coordinates to or from any other GeographicCRS", async () => {
1758
+ const convertTest = async (fileName, fileGCS, datum, inputCoord, outputCoord) => {
1759
+ const args = {
1760
+ rootSubject: { name: "TestSubject", description: "test project" },
1761
+ client: "ABC Engineering",
1762
+ globalOrigin: { x: 0.0, y: 0.0 },
1763
+ projectExtents: { low: { x: -300, y: -300, z: -20 }, high: { x: 500, y: 500, z: 400 } },
1764
+ guid: Guid.createValue(),
1802
1765
  };
1803
- const EWRGCS = {
1804
- horizontalCRS: {
1805
- id: "EPSG:27700",
1806
- description: "OSGB 1936 / British National Grid",
1807
- source: "EPSG V6 [Large and medium scale topographic mapping and engin]",
1808
- datumId: "EPSG:6277",
1809
- datum: {
1810
- id: "EPSG:6277",
1811
- description: "OSGB36 - Use OSGB-7P-2. Consider OSGB/OSTN15 instead",
1812
- deprecated: true,
1813
- source: "EPSG V6.12 operation EPSG:1314 [EPSG]",
1814
- ellipsoidId: "EPSG:7001",
1815
- ellipsoid: {
1816
- equatorialRadius: 6377563.396,
1817
- polarRadius: 6356256.909237,
1818
- id: "EPSG:7001",
1819
- description: "Airy 1830",
1820
- source: "EPSG, Version 6 [EPSG]",
1821
- },
1822
- transforms: [
1823
- {
1824
- method: "PositionalVector",
1825
- sourceEllipsoid: {
1826
- equatorialRadius: 6377563.396,
1827
- polarRadius: 6356256.909237,
1828
- id: "EPSG:7001",
1829
- },
1830
- targetEllipsoid: {
1831
- equatorialRadius: 6378137,
1832
- polarRadius: 6356752.3142,
1833
- id: "WGS84",
1766
+ let datumOrGCS;
1767
+ if (typeof datum === "object")
1768
+ datumOrGCS = JSON.stringify(datum);
1769
+ else
1770
+ datumOrGCS = datum;
1771
+ const testFile = IModelTestUtils.prepareOutputFile("IModel", fileName);
1772
+ const iModel = SnapshotDb.createEmpty(testFile, args);
1773
+ withEditTxn(iModel, (txn) => {
1774
+ iModel.setGeographicCoordinateSystem(fileGCS);
1775
+ txn.updateIModelProps();
1776
+ });
1777
+ const testPoint1 = [];
1778
+ testPoint1.push(inputCoord);
1779
+ const requestProps1 = { target: datumOrGCS, iModelCoords: testPoint1 };
1780
+ const response1 = await iModel.getGeoCoordinatesFromIModelCoordinates(requestProps1);
1781
+ expect(response1.geoCoords[0].s === outputCoord.s).to.be.true;
1782
+ // If success or warning we compare result
1783
+ if (outputCoord.s === GeoCoordStatus.Success || outputCoord.s === GeoCoordStatus.OutOfUsefulRange) {
1784
+ const expectedPt1 = Point3d.fromJSON(outputCoord.p);
1785
+ const outPt1 = Point3d.fromJSON(response1.geoCoords[0].p);
1786
+ expect(Geometry.isSamePoint3dXY(expectedPt1, outPt1, 0.001)).to.be.true;
1787
+ expect(Math.abs(expectedPt1.z - outPt1.z) < 0.0001).to.be.true;
1788
+ // No point testing reversal when Out of useful range since reversibility is doubtful
1789
+ if (outputCoord.s !== GeoCoordStatus.OutOfUsefulRange) {
1790
+ const testPoint2 = [];
1791
+ testPoint2.push(outputCoord.p);
1792
+ const requestProps2 = { source: datumOrGCS, geoCoords: testPoint2 };
1793
+ const response2 = await iModel.getIModelCoordinatesFromGeoCoordinates(requestProps2);
1794
+ const expectedPt2 = Point3d.fromJSON(inputCoord);
1795
+ const outPt2 = Point3d.fromJSON(response2.iModelCoords[0].p);
1796
+ expect(expectedPt2.distanceXY(outPt2) < 0.001).to.be.true;
1797
+ expect(Math.abs(expectedPt2.z - outPt2.z) < 0.001).to.be.true;
1798
+ }
1799
+ }
1800
+ iModel.close();
1801
+ };
1802
+ const EWRGCS = {
1803
+ horizontalCRS: {
1804
+ id: "EPSG:27700",
1805
+ description: "OSGB 1936 / British National Grid",
1806
+ source: "EPSG V6 [Large and medium scale topographic mapping and engin]",
1807
+ datumId: "EPSG:6277",
1808
+ datum: {
1809
+ id: "EPSG:6277",
1810
+ description: "OSGB36 - Use OSGB-7P-2. Consider OSGB/OSTN15 instead",
1811
+ deprecated: true,
1812
+ source: "EPSG V6.12 operation EPSG:1314 [EPSG]",
1813
+ ellipsoidId: "EPSG:7001",
1814
+ ellipsoid: {
1815
+ equatorialRadius: 6377563.396,
1816
+ polarRadius: 6356256.909237,
1817
+ id: "EPSG:7001",
1818
+ description: "Airy 1830",
1819
+ source: "EPSG, Version 6 [EPSG]",
1820
+ },
1821
+ transforms: [
1822
+ {
1823
+ method: "PositionalVector",
1824
+ sourceEllipsoid: {
1825
+ equatorialRadius: 6377563.396,
1826
+ polarRadius: 6356256.909237,
1827
+ id: "EPSG:7001",
1828
+ },
1829
+ targetEllipsoid: {
1830
+ equatorialRadius: 6378137,
1831
+ polarRadius: 6356752.3142,
1832
+ id: "WGS84",
1833
+ },
1834
+ positionalVector: {
1835
+ delta: {
1836
+ x: 446.448,
1837
+ y: -125.157,
1838
+ z: 542.06,
1834
1839
  },
1835
- positionalVector: {
1836
- delta: {
1837
- x: 446.448,
1838
- y: -125.157,
1839
- z: 542.06,
1840
- },
1841
- rotation: {
1842
- x: 0.15,
1843
- y: 0.247,
1844
- z: 0.842,
1845
- },
1846
- scalePPM: -20.489,
1840
+ rotation: {
1841
+ x: 0.15,
1842
+ y: 0.247,
1843
+ z: 0.842,
1847
1844
  },
1848
- }
1849
- ],
1850
- },
1851
- unit: "Meter",
1852
- projection: {
1853
- method: "TransverseMercator",
1854
- falseEasting: 400000,
1855
- falseNorthing: -100000,
1856
- centralMeridian: -2,
1857
- latitudeOfOrigin: 49,
1858
- scaleFactor: 0.999601272737422,
1859
- },
1860
- extent: {
1861
- southWest: {
1862
- latitude: 49.96,
1863
- longitude: -7.56,
1864
- },
1865
- northEast: {
1866
- latitude: 60.84,
1867
- longitude: 1.78,
1868
- },
1869
- },
1845
+ scalePPM: -20.489,
1846
+ },
1847
+ }
1848
+ ],
1870
1849
  },
1871
- verticalCRS: {
1872
- id: "ELLIPSOID",
1850
+ unit: "Meter",
1851
+ projection: {
1852
+ method: "TransverseMercator",
1853
+ falseEasting: 400000,
1854
+ falseNorthing: -100000,
1855
+ centralMeridian: -2,
1856
+ latitudeOfOrigin: 49,
1857
+ scaleFactor: 0.999601272737422,
1873
1858
  },
1874
- additionalTransform: {
1875
- helmert2DWithZOffset: {
1876
- translationX: 284597.3343,
1877
- translationY: 79859.4651,
1878
- translationZ: 0,
1879
- rotDeg: 0.5263624458992088,
1880
- scale: 0.9996703340508721,
1859
+ extent: {
1860
+ southWest: {
1861
+ latitude: 49.96,
1862
+ longitude: -7.56,
1881
1863
  },
1882
- },
1883
- };
1884
- await convertTest("ExtonCampus1.bim", { horizontalCRS: { id: "EPSG:2272" }, verticalCRS: { id: "NAVD88" } }, "WGS84", { x: 775970.3155166894, y: 83323.24543981979, z: 130.74977547686285 }, { p: { x: -75.68712011112366, y: 40.06524845273591, z: 95.9769083 }, s: GeoCoordStatus.Success });
1885
- await convertTest("UTM83-10-NGVD29-10.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NAVD88" } }, { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "NGVD29" } }, { x: 548296.472, y: 4179414.470, z: 0.8457 }, { p: { x: 548392.9689991799, y: 4179217.683834238, z: -0.0006774162750405877 }, s: GeoCoordStatus.Success });
1886
- await convertTest("BritishNatGrid-EllipsoidHelmert1.bim", EWRGCS, "WGS84", { x: 199247.08883859176, y: 150141.68625139236, z: 0.0 }, { p: { x: -0.80184489371471, y: 51.978341907041205, z: 0.0 }, s: GeoCoordStatus.Success });
1887
- await convertTest("BritishNatGrid-Ellipsoid1.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: 170370.718, y: 11572.405, z: 0.0 }, { p: { x: -5.2020119082059511, y: 49.959453295440234, z: 0.0 }, s: GeoCoordStatus.Success });
1888
- await convertTest("BritishNatGrid-Ellipsoid2.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, "ETRF89", { x: 170370.718, y: 11572.405, z: 0.0 }, { p: { x: -5.2030365061523707, y: 49.960007477936202, z: 0.0 }, s: GeoCoordStatus.Success });
1889
- await convertTest("BritishNatGrid-Ellipsoid3.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, "OSGB", { x: 170370.718, y: 11572.405, z: 0.0 }, { p: { x: -5.2020119082059511, y: 49.959453295440234, z: 0.0 }, s: GeoCoordStatus.Success });
1890
- await convertTest("GermanyDHDN-3-Ellipsoid1.bim", { horizontalCRS: { id: "DHDN/3.GK3d-4/EN" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: 4360857.005, y: 5606083.067, z: 0.0 }, { p: { x: 10.035413954488630, y: 50.575070810112159, z: 0.0 }, s: GeoCoordStatus.Success });
1891
- await convertTest("GermanyDHDN-3-Ellipsoid2.bim", { horizontalCRS: { id: "DHDN/3.GK3d-4/EN" }, verticalCRS: { id: "ELLIPSOID" } }, "DHDN/3", { x: 4360857.005, y: 5606083.067, z: 0.0 }, { p: { x: 10.035413954488630, y: 50.575070810112159, z: 0.0 }, s: GeoCoordStatus.Success });
1892
- await convertTest("GermanyDHDN-3-Ellipsoid3.bim", { horizontalCRS: { id: "DHDN/3.GK3d-4/EN" }, verticalCRS: { id: "ELLIPSOID" } }, "WGS84", { x: 4360857.005, y: 5606083.067, z: 0.0 }, { p: { x: 10.034215937440818, y: 50.573862480894853, z: 0.0 }, s: GeoCoordStatus.Success });
1893
- await convertTest("UTM83-10-NGVD29-1.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, "", { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: 0.0 }, s: GeoCoordStatus.Success });
1894
- await convertTest("UTM83-10-NGVD29-2.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, "NAD83", { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: -30.12668428839329 }, s: GeoCoordStatus.Success });
1895
- await convertTest("UTM83-10-NGVD29-3.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, "WGS84", { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: -30.12668428839329 }, s: GeoCoordStatus.Success });
1896
- await convertTest("UTM27-10-Ellipsoid1.bim", { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: 623075.328, y: 4265650.532, z: 0.0 }, { p: { x: -121.58798236995744, y: 38.532616292207997, z: 0.0 }, s: GeoCoordStatus.Success });
1897
- await convertTest("UTM27-10-Ellipsoid2.bim", { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "ELLIPSOID" } }, "NAD83", { x: 623075.328, y: 4265650.532, z: 0.0 }, { p: { x: -121.58905088839697, y: 38.532522753851708, z: 0.0 }, s: GeoCoordStatus.Success });
1898
- await convertTest("UTM83-10-NGVD29-4.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "LL84" }, verticalCRS: { id: "ELLIPSOID" } }, { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: -30.12668428839329 }, s: GeoCoordStatus.Success });
1899
- await convertTest("UTM83-10-NGVD29-5.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "LL84" }, verticalCRS: { id: "GEOID" } }, { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: 0.7621583779125531 }, s: GeoCoordStatus.Success });
1900
- await convertTest("UTM83-10-NGVD29-6.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "CA83-II" }, verticalCRS: { id: "NAVD88" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1901
- await convertTest("UTM83-10-NGVD29-7.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "CA83-II" }, verticalCRS: { id: "GEOID" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1902
- await convertTest("UTM83-10-NGVD29-8.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "CA83-II" }, verticalCRS: { id: "NGVD29" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.0 }, s: GeoCoordStatus.Success });
1903
- await convertTest("UTM83-10-NGVD29-9.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { epsg: 26942 }, verticalCRS: { id: "NAVD88" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1904
- await convertTest("UTM83-10-NGVD29-10.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NAVD88" } }, { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "NGVD29" } }, { x: 548296.472, y: 4179414.470, z: 0.8457 }, { p: { x: 548392.9689991799, y: 4179217.683834238, z: -0.0006774162750405877 }, s: GeoCoordStatus.Success });
1905
- await convertTest("BritishNatGrid-Ellipsoid4.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "HS2_Snake_2015" }, verticalCRS: { id: "GEOID" } }, { x: 473327.251, y: 257049.636, z: 0.0 }, { p: { x: 237732.58101946692, y: 364048.01547843055, z: -47.874172425966336 }, s: GeoCoordStatus.Success });
1906
- await convertTest("BritishNatGrid-Ellipsoid5.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, {
1907
- horizontalCRS: {
1908
- id: "HS2-MOCK",
1909
- description: "USES CUSTOM DATUM",
1910
- source: "Test",
1911
- deprecated: false,
1912
- datumId: "HS2SD_2015",
1913
- unit: "Meter",
1914
- projection: {
1915
- method: "TransverseMercator",
1916
- centralMeridian: -1.5,
1917
- latitudeOfOrigin: 52.30,
1918
- scaleFactor: 1.0,
1919
- falseEasting: 198873.0046,
1920
- falseNorthing: 375064.3871,
1864
+ northEast: {
1865
+ latitude: 60.84,
1866
+ longitude: 1.78,
1921
1867
  },
1922
1868
  },
1923
- verticalCRS: {
1924
- id: "GEOID",
1869
+ },
1870
+ verticalCRS: {
1871
+ id: "ELLIPSOID",
1872
+ },
1873
+ additionalTransform: {
1874
+ helmert2DWithZOffset: {
1875
+ translationX: 284597.3343,
1876
+ translationY: 79859.4651,
1877
+ translationZ: 0,
1878
+ rotDeg: 0.5263624458992088,
1879
+ scale: 0.9996703340508721,
1925
1880
  },
1926
- }, { x: 473327.251, y: 257049.636, z: 0.0 }, { p: { x: 237732.58101952373, y: 364048.01548327296, z: -47.874172425966336 }, s: GeoCoordStatus.Success });
1927
- await convertTest("BritishNatGrid-Ellipsoid.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "OSGB-GPS-2015" }, verticalCRS: { id: "GEOID" } }, { x: 473327.251, y: 257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.Success });
1928
- await convertTest("UTM83-10-NGVD29-12.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, {
1929
- horizontalCRS: {
1930
- id: "California2",
1931
- description: "USES CUSTOM DATUM",
1932
- source: "Test",
1933
- deprecated: false,
1934
- datumId: "NAD83",
1935
- unit: "Meter",
1936
- projection: {
1937
- method: "LambertConformalConicTwoParallels",
1938
- longitudeOfOrigin: -122,
1939
- latitudeOfOrigin: 37.66666666667,
1940
- standardParallel1: 39.833333333333336,
1941
- standardParallel2: 38.333333333333336,
1942
- falseEasting: 2000000.0,
1943
- falseNorthing: 500000.0,
1944
- },
1945
- extent: {
1946
- southWest: {
1947
- latitude: 35,
1948
- longitude: -125,
1949
- },
1950
- northEast: {
1951
- latitude: 39.1,
1952
- longitude: -120.45,
1953
- },
1954
- },
1881
+ },
1882
+ };
1883
+ await convertTest("ExtonCampus1.bim", { horizontalCRS: { id: "EPSG:2272" }, verticalCRS: { id: "NAVD88" } }, "WGS84", { x: 775970.3155166894, y: 83323.24543981979, z: 130.74977547686285 }, { p: { x: -75.68712011112366, y: 40.06524845273591, z: 95.9769083 }, s: GeoCoordStatus.Success });
1884
+ await convertTest("UTM83-10-NGVD29-10.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NAVD88" } }, { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "NGVD29" } }, { x: 548296.472, y: 4179414.470, z: 0.8457 }, { p: { x: 548392.9689991799, y: 4179217.683834238, z: -0.0006774162750405877 }, s: GeoCoordStatus.Success });
1885
+ await convertTest("BritishNatGrid-EllipsoidHelmert1.bim", EWRGCS, "WGS84", { x: 199247.08883859176, y: 150141.68625139236, z: 0.0 }, { p: { x: -0.80184489371471, y: 51.978341907041205, z: 0.0 }, s: GeoCoordStatus.Success });
1886
+ await convertTest("BritishNatGrid-Ellipsoid1.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: 170370.718, y: 11572.405, z: 0.0 }, { p: { x: -5.2020119082059511, y: 49.959453295440234, z: 0.0 }, s: GeoCoordStatus.Success });
1887
+ await convertTest("BritishNatGrid-Ellipsoid2.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, "ETRF89", { x: 170370.718, y: 11572.405, z: 0.0 }, { p: { x: -5.2030365061523707, y: 49.960007477936202, z: 0.0 }, s: GeoCoordStatus.Success });
1888
+ await convertTest("BritishNatGrid-Ellipsoid3.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, "OSGB", { x: 170370.718, y: 11572.405, z: 0.0 }, { p: { x: -5.2020119082059511, y: 49.959453295440234, z: 0.0 }, s: GeoCoordStatus.Success });
1889
+ await convertTest("GermanyDHDN-3-Ellipsoid1.bim", { horizontalCRS: { id: "DHDN/3.GK3d-4/EN" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: 4360857.005, y: 5606083.067, z: 0.0 }, { p: { x: 10.035413954488630, y: 50.575070810112159, z: 0.0 }, s: GeoCoordStatus.Success });
1890
+ await convertTest("GermanyDHDN-3-Ellipsoid2.bim", { horizontalCRS: { id: "DHDN/3.GK3d-4/EN" }, verticalCRS: { id: "ELLIPSOID" } }, "DHDN/3", { x: 4360857.005, y: 5606083.067, z: 0.0 }, { p: { x: 10.035413954488630, y: 50.575070810112159, z: 0.0 }, s: GeoCoordStatus.Success });
1891
+ await convertTest("GermanyDHDN-3-Ellipsoid3.bim", { horizontalCRS: { id: "DHDN/3.GK3d-4/EN" }, verticalCRS: { id: "ELLIPSOID" } }, "WGS84", { x: 4360857.005, y: 5606083.067, z: 0.0 }, { p: { x: 10.034215937440818, y: 50.573862480894853, z: 0.0 }, s: GeoCoordStatus.Success });
1892
+ await convertTest("UTM83-10-NGVD29-1.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, "", { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: 0.0 }, s: GeoCoordStatus.Success });
1893
+ await convertTest("UTM83-10-NGVD29-2.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, "NAD83", { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: -30.12668428839329 }, s: GeoCoordStatus.Success });
1894
+ await convertTest("UTM83-10-NGVD29-3.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, "WGS84", { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: -30.12668428839329 }, s: GeoCoordStatus.Success });
1895
+ await convertTest("UTM27-10-Ellipsoid1.bim", { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: 623075.328, y: 4265650.532, z: 0.0 }, { p: { x: -121.58798236995744, y: 38.532616292207997, z: 0.0 }, s: GeoCoordStatus.Success });
1896
+ await convertTest("UTM27-10-Ellipsoid2.bim", { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "ELLIPSOID" } }, "NAD83", { x: 623075.328, y: 4265650.532, z: 0.0 }, { p: { x: -121.58905088839697, y: 38.532522753851708, z: 0.0 }, s: GeoCoordStatus.Success });
1897
+ await convertTest("UTM83-10-NGVD29-4.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "LL84" }, verticalCRS: { id: "ELLIPSOID" } }, { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: -30.12668428839329 }, s: GeoCoordStatus.Success });
1898
+ await convertTest("UTM83-10-NGVD29-5.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "LL84" }, verticalCRS: { id: "GEOID" } }, { x: 632748.112, y: 4263868.307, z: 0.0 }, { p: { x: -121.47738265889652, y: 38.513305313793019, z: 0.7621583779125531 }, s: GeoCoordStatus.Success });
1899
+ await convertTest("UTM83-10-NGVD29-6.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "CA83-II" }, verticalCRS: { id: "NAVD88" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1900
+ await convertTest("UTM83-10-NGVD29-7.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "CA83-II" }, verticalCRS: { id: "GEOID" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1901
+ await convertTest("UTM83-10-NGVD29-8.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { id: "CA83-II" }, verticalCRS: { id: "NGVD29" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.0 }, s: GeoCoordStatus.Success });
1902
+ await convertTest("UTM83-10-NGVD29-9.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, { horizontalCRS: { epsg: 26942 }, verticalCRS: { id: "NAVD88" } }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1903
+ await convertTest("UTM83-10-NGVD29-10.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NAVD88" } }, { horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "NGVD29" } }, { x: 548296.472, y: 4179414.470, z: 0.8457 }, { p: { x: 548392.9689991799, y: 4179217.683834238, z: -0.0006774162750405877 }, s: GeoCoordStatus.Success });
1904
+ await convertTest("BritishNatGrid-Ellipsoid4.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "HS2_Snake_2015" }, verticalCRS: { id: "GEOID" } }, { x: 473327.251, y: 257049.636, z: 0.0 }, { p: { x: 237732.58101946692, y: 364048.01547843055, z: -47.874172425966336 }, s: GeoCoordStatus.Success });
1905
+ await convertTest("BritishNatGrid-Ellipsoid5.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, {
1906
+ horizontalCRS: {
1907
+ id: "HS2-MOCK",
1908
+ description: "USES CUSTOM DATUM",
1909
+ source: "Test",
1910
+ deprecated: false,
1911
+ datumId: "HS2SD_2015",
1912
+ unit: "Meter",
1913
+ projection: {
1914
+ method: "TransverseMercator",
1915
+ centralMeridian: -1.5,
1916
+ latitudeOfOrigin: 52.30,
1917
+ scaleFactor: 1.0,
1918
+ falseEasting: 198873.0046,
1919
+ falseNorthing: 375064.3871,
1955
1920
  },
1956
- verticalCRS: {
1957
- id: "GEOID",
1921
+ },
1922
+ verticalCRS: {
1923
+ id: "GEOID",
1924
+ },
1925
+ }, { x: 473327.251, y: 257049.636, z: 0.0 }, { p: { x: 237732.58101952373, y: 364048.01548327296, z: -47.874172425966336 }, s: GeoCoordStatus.Success });
1926
+ await convertTest("BritishNatGrid-Ellipsoid.bim", { horizontalCRS: { id: "BritishNatGrid" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "OSGB-GPS-2015" }, verticalCRS: { id: "GEOID" } }, { x: 473327.251, y: 257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.Success });
1927
+ await convertTest("UTM83-10-NGVD29-12.bim", { horizontalCRS: { id: "UTM83-10" }, verticalCRS: { id: "NGVD29" } }, {
1928
+ horizontalCRS: {
1929
+ id: "California2",
1930
+ description: "USES CUSTOM DATUM",
1931
+ source: "Test",
1932
+ deprecated: false,
1933
+ datumId: "NAD83",
1934
+ unit: "Meter",
1935
+ projection: {
1936
+ method: "LambertConformalConicTwoParallels",
1937
+ longitudeOfOrigin: -122,
1938
+ latitudeOfOrigin: 37.66666666667,
1939
+ standardParallel1: 39.833333333333336,
1940
+ standardParallel2: 38.333333333333336,
1941
+ falseEasting: 2000000.0,
1942
+ falseNorthing: 500000.0,
1958
1943
  },
1959
- }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1960
- // Do some test that return errors
1961
- // First test uses one GCS in Eastern USA and the other in UK. This will produce a hard domain error
1962
- await convertTest("Error1.bim", { horizontalCRS: { id: "UTM84-17N" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "OSGB-GPS-2015" }, verticalCRS: { id: "GEOID" } }, { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.OutOfMathematicalDomain });
1963
- // This test performs conversion in a region outside normal use of GCS but still mathematically valid (soft domain error)
1964
- await convertTest("Error2.bim", { horizontalCRS: { id: "DanishS34-S99" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: -6618.5925260757449, y: 36058.097489683532, z: 0.0 }, { p: { x: 13.53250346041385, y: 54.71216475341563, z: 0.0 }, s: GeoCoordStatus.OutOfUsefulRange });
1965
- // -6618.5925260757449, 36058.097489683532
1966
- // { x: -221748.034, y: -10012.784, z: 0.0 } { p: { x: 10.36481105, y: 54.38462506, z: 0.0 }
1967
- // This test makes use of a GCS using a grid file that does not even exist and will return a datum conversion error.
1968
- const userGCSWithinexistentGridFile = {
1969
- horizontalCRS: {
1970
- id: "User1",
1971
- datumId: "UserDatum1",
1972
- datum: {
1973
- id: "UserDatum1",
1974
- ellipsoidId: "CLRK66",
1975
- transforms: [
1976
- {
1977
- method: "GridFiles",
1978
- sourceEllipsoid: {
1979
- id: "CLRK66",
1980
- equatorialRadius: 6378160.0,
1981
- polarRadius: 6356774.719195306,
1982
- },
1983
- targetEllipsoid: {
1984
- id: "WGS84",
1985
- equatorialRadius: 6378160.0,
1986
- polarRadius: 6356774.719195306,
1987
- },
1988
- gridFile: {
1989
- files: [
1990
- { fileName: "./user/inexistent.gdc", format: "NTv2", direction: "Direct" },
1991
- ],
1992
- },
1993
- },
1994
- ],
1995
- },
1996
- unit: "Meter",
1997
- projection: {
1998
- method: "TransverseMercator",
1999
- centralMeridian: -115,
2000
- latitudeOfOrigin: 0,
2001
- scaleFactor: 0.9992,
2002
- falseEasting: 1.0,
2003
- falseNorthing: 2.0,
1944
+ extent: {
1945
+ southWest: {
1946
+ latitude: 35,
1947
+ longitude: -125,
2004
1948
  },
2005
- extent: {
2006
- southWest: { latitude: 48, longitude: -120.5 },
2007
- northEast: { latitude: 84, longitude: -109.5 },
1949
+ northEast: {
1950
+ latitude: 39.1,
1951
+ longitude: -120.45,
2008
1952
  },
2009
- }, verticalCRS: { id: "ELLIPSOID" },
2010
- };
2011
- await convertTest("Error3.bim", userGCSWithinexistentGridFile, "WGS84", { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.NoDatumConverter });
2012
- // The model GCS is not valid
2013
- await convertTest("Error4.bim", { horizontalCRS: { id: "badfood" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "OSGB-GPS-2015" }, verticalCRS: { id: "GEOID" } }, { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.NoGCSDefined });
2014
- // The given GCS is not valid
2015
- await convertTest("Error5.bim", { horizontalCRS: { id: "UTM84-17N" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "badfood" }, verticalCRS: { id: "GEOID" } }, { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.NoGCSDefined });
2016
- });
2017
- }
1953
+ },
1954
+ },
1955
+ verticalCRS: {
1956
+ id: "GEOID",
1957
+ },
1958
+ }, { x: 569024.940, y: 4386341.752, z: 0.0 }, { p: { x: 1983192.529823256, y: 717304.0311293667, z: 0.745910484422781 }, s: GeoCoordStatus.Success });
1959
+ // Do some test that return errors
1960
+ // First test uses one GCS in Eastern USA and the other in UK. This will produce a hard domain error
1961
+ await convertTest("Error1.bim", { horizontalCRS: { id: "UTM84-17N" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "OSGB-GPS-2015" }, verticalCRS: { id: "GEOID" } }, { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.OutOfMathematicalDomain });
1962
+ // This test performs conversion in a region outside normal use of GCS but still mathematically valid (soft domain error)
1963
+ await convertTest("Error2.bim", { horizontalCRS: { id: "DanishS34-S99" }, verticalCRS: { id: "ELLIPSOID" } }, "", { x: -6618.5925260757449, y: 36058.097489683532, z: 0.0 }, { p: { x: 13.53250346041385, y: 54.71216475341563, z: 0.0 }, s: GeoCoordStatus.OutOfUsefulRange });
1964
+ // -6618.5925260757449, 36058.097489683532
1965
+ // { x: -221748.034, y: -10012.784, z: 0.0 } { p: { x: 10.36481105, y: 54.38462506, z: 0.0 }
1966
+ // This test makes use of a GCS using a grid file that does not even exist and will return a datum conversion error.
1967
+ const userGCSWithinexistentGridFile = {
1968
+ horizontalCRS: {
1969
+ id: "User1",
1970
+ datumId: "UserDatum1",
1971
+ datum: {
1972
+ id: "UserDatum1",
1973
+ ellipsoidId: "CLRK66",
1974
+ transforms: [
1975
+ {
1976
+ method: "GridFiles",
1977
+ sourceEllipsoid: {
1978
+ id: "CLRK66",
1979
+ equatorialRadius: 6378160.0,
1980
+ polarRadius: 6356774.719195306,
1981
+ },
1982
+ targetEllipsoid: {
1983
+ id: "WGS84",
1984
+ equatorialRadius: 6378160.0,
1985
+ polarRadius: 6356774.719195306,
1986
+ },
1987
+ gridFile: {
1988
+ files: [
1989
+ { fileName: "./user/inexistent.gdc", format: "NTv2", direction: "Direct" },
1990
+ ],
1991
+ },
1992
+ },
1993
+ ],
1994
+ },
1995
+ unit: "Meter",
1996
+ projection: {
1997
+ method: "TransverseMercator",
1998
+ centralMeridian: -115,
1999
+ latitudeOfOrigin: 0,
2000
+ scaleFactor: 0.9992,
2001
+ falseEasting: 1.0,
2002
+ falseNorthing: 2.0,
2003
+ },
2004
+ extent: {
2005
+ southWest: { latitude: 48, longitude: -120.5 },
2006
+ northEast: { latitude: 84, longitude: -109.5 },
2007
+ },
2008
+ }, verticalCRS: { id: "ELLIPSOID" },
2009
+ };
2010
+ await convertTest("Error3.bim", userGCSWithinexistentGridFile, "WGS84", { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.NoDatumConverter });
2011
+ // The model GCS is not valid
2012
+ await convertTest("Error4.bim", { horizontalCRS: { id: "badfood" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "OSGB-GPS-2015" }, verticalCRS: { id: "GEOID" } }, { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.NoGCSDefined });
2013
+ // The given GCS is not valid
2014
+ await convertTest("Error5.bim", { horizontalCRS: { id: "UTM84-17N" }, verticalCRS: { id: "ELLIPSOID" } }, { horizontalCRS: { id: "badfood" }, verticalCRS: { id: "GEOID" } }, { x: 1473327.251, y: 1257049.636, z: 0.0 }, { p: { x: 473325.6830048648, y: 257049.77062273448, z: -47.87643904264457 }, s: GeoCoordStatus.NoGCSDefined });
2015
+ });
2018
2016
  it("should be able to create a snapshot IModel and set geolocation by ECEF", async () => {
2019
2017
  const args = {
2020
2018
  rootSubject: { name: "TestSubject", description: "test iTwin" },