@itwin/core-backend 5.11.0-dev.9 → 5.12.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/lib/cjs/BlobContainerService.d.ts +14 -1
  3. package/lib/cjs/BlobContainerService.d.ts.map +1 -1
  4. package/lib/cjs/BlobContainerService.js.map +1 -1
  5. package/lib/cjs/BriefcaseManager.d.ts +3 -1
  6. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  7. package/lib/cjs/BriefcaseManager.js +3 -3
  8. package/lib/cjs/BriefcaseManager.js.map +1 -1
  9. package/lib/cjs/CloudSqlite.d.ts +1 -1
  10. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  11. package/lib/cjs/CloudSqlite.js +4 -1
  12. package/lib/cjs/CloudSqlite.js.map +1 -1
  13. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  14. package/lib/cjs/DisplayStyle.js +4 -8
  15. package/lib/cjs/DisplayStyle.js.map +1 -1
  16. package/lib/cjs/EditTxn.d.ts +56 -1
  17. package/lib/cjs/EditTxn.d.ts.map +1 -1
  18. package/lib/cjs/EditTxn.js +138 -0
  19. package/lib/cjs/EditTxn.js.map +1 -1
  20. package/lib/cjs/GeoCoordConfig.d.ts +6 -0
  21. package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
  22. package/lib/cjs/GeoCoordConfig.js +6 -0
  23. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  24. package/lib/cjs/IModelDb.d.ts +40 -0
  25. package/lib/cjs/IModelDb.d.ts.map +1 -1
  26. package/lib/cjs/IModelDb.js +18 -0
  27. package/lib/cjs/IModelDb.js.map +1 -1
  28. package/lib/cjs/IModelHost.d.ts +5 -3
  29. package/lib/cjs/IModelHost.d.ts.map +1 -1
  30. package/lib/cjs/IModelHost.js.map +1 -1
  31. package/lib/cjs/NativeHost.js +1 -1
  32. package/lib/cjs/NativeHost.js.map +1 -1
  33. package/lib/cjs/workspace/SettingsEditor.d.ts +4 -9
  34. package/lib/cjs/workspace/SettingsEditor.d.ts.map +1 -1
  35. package/lib/cjs/workspace/SettingsEditor.js +31 -15
  36. package/lib/cjs/workspace/SettingsEditor.js.map +1 -1
  37. package/lib/esm/BlobContainerService.d.ts +14 -1
  38. package/lib/esm/BlobContainerService.d.ts.map +1 -1
  39. package/lib/esm/BlobContainerService.js.map +1 -1
  40. package/lib/esm/BriefcaseManager.d.ts +3 -1
  41. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  42. package/lib/esm/BriefcaseManager.js +3 -3
  43. package/lib/esm/BriefcaseManager.js.map +1 -1
  44. package/lib/esm/CloudSqlite.d.ts +1 -1
  45. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  46. package/lib/esm/CloudSqlite.js +4 -1
  47. package/lib/esm/CloudSqlite.js.map +1 -1
  48. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  49. package/lib/esm/DisplayStyle.js +4 -8
  50. package/lib/esm/DisplayStyle.js.map +1 -1
  51. package/lib/esm/EditTxn.d.ts +56 -1
  52. package/lib/esm/EditTxn.d.ts.map +1 -1
  53. package/lib/esm/EditTxn.js +140 -2
  54. package/lib/esm/EditTxn.js.map +1 -1
  55. package/lib/esm/GeoCoordConfig.d.ts +6 -0
  56. package/lib/esm/GeoCoordConfig.d.ts.map +1 -1
  57. package/lib/esm/GeoCoordConfig.js +6 -0
  58. package/lib/esm/GeoCoordConfig.js.map +1 -1
  59. package/lib/esm/IModelDb.d.ts +40 -0
  60. package/lib/esm/IModelDb.d.ts.map +1 -1
  61. package/lib/esm/IModelDb.js +18 -0
  62. package/lib/esm/IModelDb.js.map +1 -1
  63. package/lib/esm/IModelHost.d.ts +5 -3
  64. package/lib/esm/IModelHost.d.ts.map +1 -1
  65. package/lib/esm/IModelHost.js.map +1 -1
  66. package/lib/esm/NativeHost.js +1 -1
  67. package/lib/esm/NativeHost.js.map +1 -1
  68. package/lib/esm/test/TestUtils.d.ts +17 -2
  69. package/lib/esm/test/TestUtils.d.ts.map +1 -1
  70. package/lib/esm/test/TestUtils.js +21 -2
  71. package/lib/esm/test/TestUtils.js.map +1 -1
  72. package/lib/esm/test/annotations/TextAnnotation.test.js +81 -16
  73. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  74. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +4 -2
  75. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  76. package/lib/esm/test/ecdb/ECDb.test.js +1 -1
  77. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  78. package/lib/esm/test/ecdb/ECSqlStatement.test.js +8 -2
  79. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  80. package/lib/esm/test/hubaccess/CodeSwap.test.d.ts +2 -0
  81. package/lib/esm/test/hubaccess/CodeSwap.test.d.ts.map +1 -0
  82. package/lib/esm/test/hubaccess/CodeSwap.test.js +431 -0
  83. package/lib/esm/test/hubaccess/CodeSwap.test.js.map +1 -0
  84. package/lib/esm/test/imodel/IModel.test.js +10 -2
  85. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  86. package/lib/esm/test/standalone/ChangeElementParentModel.test.d.ts +2 -0
  87. package/lib/esm/test/standalone/ChangeElementParentModel.test.d.ts.map +1 -0
  88. package/lib/esm/test/standalone/ChangeElementParentModel.test.js +460 -0
  89. package/lib/esm/test/standalone/ChangeElementParentModel.test.js.map +1 -0
  90. package/lib/esm/test/standalone/ChangesetReader.test.js +3 -0
  91. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  92. package/lib/esm/test/standalone/CloudSqlite.test.d.ts +2 -0
  93. package/lib/esm/test/standalone/CloudSqlite.test.d.ts.map +1 -0
  94. package/lib/esm/test/standalone/CloudSqlite.test.js +43 -0
  95. package/lib/esm/test/standalone/CloudSqlite.test.js.map +1 -0
  96. package/lib/esm/test/standalone/IModelWrite.test.d.ts.map +1 -1
  97. package/lib/esm/test/standalone/IModelWrite.test.js +2 -33
  98. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  99. package/lib/esm/test/standalone/ITwinWorkspace.test.js +118 -1
  100. package/lib/esm/test/standalone/ITwinWorkspace.test.js.map +1 -1
  101. package/lib/esm/test/standalone/Workspace.test.js +2 -2
  102. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  103. package/lib/esm/workspace/SettingsEditor.d.ts +4 -9
  104. package/lib/esm/workspace/SettingsEditor.d.ts.map +1 -1
  105. package/lib/esm/workspace/SettingsEditor.js +31 -15
  106. package/lib/esm/workspace/SettingsEditor.js.map +1 -1
  107. package/package.json +16 -16
  108. package/lib/esm/test/misc/GeoServices.test.d.ts +0 -2
  109. package/lib/esm/test/misc/GeoServices.test.d.ts.map +0 -1
  110. package/lib/esm/test/misc/GeoServices.test.js +0 -918
  111. package/lib/esm/test/misc/GeoServices.test.js.map +0 -1
@@ -1,918 +0,0 @@
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 { assert } from "chai";
6
- import { Helmert2DWithZOffset, } from "@itwin/core-common";
7
- import { IModelNative } from "../../internal/NativePlatform";
8
- import { Geometry, Point3d, Range2d } from "@itwin/core-geometry";
9
- import { GeoCoordConfig } from "../../GeoCoordConfig";
10
- import { getAvailableCoordinateReferenceSystems, getAvailableCRSUnits } from "../../GeographicCRSServices";
11
- // spell-checker: disable
12
- describe("GeoServices", () => {
13
- before(() => {
14
- GeoCoordConfig.loadDefaultDatabases();
15
- });
16
- const completionTest = async (incompleteGCS, completeCRS) => {
17
- const requestProps = { format: "JSON", geographicCRSDef: JSON.stringify(incompleteGCS) };
18
- const response = IModelNative.platform.GeoServices.getGeographicCRSInterpretation(requestProps);
19
- assert.isTrue(response.status === 0);
20
- assert.isTrue(response.geographicCRS !== undefined);
21
- if (response.geographicCRS !== undefined) {
22
- assert.isTrue(response.geographicCRS.horizontalCRS !== undefined && completeCRS.horizontalCRS !== undefined);
23
- assert.isTrue(response.geographicCRS.horizontalCRS.id === completeCRS.horizontalCRS.id);
24
- assert.isTrue(response.geographicCRS.horizontalCRS.projection !== undefined && completeCRS.horizontalCRS.projection !== undefined);
25
- assert.isTrue(response.geographicCRS.horizontalCRS.projection.method === completeCRS.horizontalCRS.projection.method);
26
- if (completeCRS.horizontalCRS.projection.falseEasting !== undefined) {
27
- assert.isTrue(response.geographicCRS.horizontalCRS.projection.falseEasting !== undefined);
28
- assert.isTrue(Math.abs(response.geographicCRS.horizontalCRS.projection.falseEasting - completeCRS.horizontalCRS.projection.falseEasting) < Geometry.smallMetricDistance);
29
- }
30
- if (completeCRS.horizontalCRS.projection.falseNorthing !== undefined) {
31
- assert.isTrue(response.geographicCRS.horizontalCRS.projection.falseNorthing !== undefined);
32
- assert.isTrue(Math.abs(response.geographicCRS.horizontalCRS.projection.falseNorthing - completeCRS.horizontalCRS.projection.falseNorthing) < Geometry.smallMetricDistance);
33
- }
34
- assert.isTrue(response.geographicCRS.horizontalCRS.datum !== undefined && completeCRS.horizontalCRS.datum !== undefined);
35
- assert.isTrue(response.geographicCRS.horizontalCRS.datum.id === completeCRS.horizontalCRS.datum.id);
36
- assert.isTrue(response.geographicCRS.horizontalCRS.datum.ellipsoid !== undefined && completeCRS.horizontalCRS.datum.ellipsoid !== undefined);
37
- assert.isTrue(response.geographicCRS.horizontalCRS.datum.ellipsoid.id === completeCRS.horizontalCRS.datum.ellipsoid.id);
38
- if (response.geographicCRS.additionalTransform !== undefined) {
39
- assert.isTrue(completeCRS.additionalTransform !== undefined);
40
- assert.isTrue(response.geographicCRS.additionalTransform.helmert2DWithZOffset !== undefined);
41
- assert.isTrue(completeCRS.additionalTransform.helmert2DWithZOffset !== undefined);
42
- assert.isTrue(Math.abs(response.geographicCRS.additionalTransform.helmert2DWithZOffset.rotDeg - completeCRS.additionalTransform.helmert2DWithZOffset.rotDeg) < Geometry.smallAngleDegrees);
43
- assert.isTrue(Math.abs(response.geographicCRS.additionalTransform.helmert2DWithZOffset.translationX - completeCRS.additionalTransform.helmert2DWithZOffset.translationX) < Geometry.smallMetricDistance);
44
- assert.isTrue(Math.abs(response.geographicCRS.additionalTransform.helmert2DWithZOffset.translationY - completeCRS.additionalTransform.helmert2DWithZOffset.translationY) < Geometry.smallMetricDistance);
45
- assert.isTrue(Math.abs(response.geographicCRS.additionalTransform.helmert2DWithZOffset.translationZ - completeCRS.additionalTransform.helmert2DWithZOffset.translationZ) < Geometry.smallMetricDistance);
46
- assert.isTrue(Math.abs(response.geographicCRS.additionalTransform.helmert2DWithZOffset.scale - completeCRS.additionalTransform.helmert2DWithZOffset.scale) < Geometry.smallFraction);
47
- }
48
- assert.isTrue(response.geographicCRS.verticalCRS !== undefined && completeCRS.verticalCRS !== undefined);
49
- assert.isTrue(response.geographicCRS.verticalCRS.id === completeCRS.verticalCRS.id);
50
- }
51
- };
52
- describe("Interpret to completion an incomplete GeographicCRS", async () => {
53
- it("should be able to interpret to completion britishNationalGridOld", async () => {
54
- const britishNationalGridOld = {
55
- horizontalCRS: {
56
- datum: {
57
- deprecated: true,
58
- description: "OSGB36 - Use OSGB-7P-2. Consider OSGB/OSTN15 instead",
59
- ellipsoid: {
60
- description: "Airy 1830",
61
- equatorialRadius: 6377563.396,
62
- id: "EPSG:7001",
63
- polarRadius: 6356256.909237,
64
- source: "EPSG, Version 6 [EPSG]",
65
- },
66
- ellipsoidId: "EPSG:7001",
67
- id: "EPSG:6277",
68
- source: "EPSG V6.12 operation EPSG:1314 [EPSG]",
69
- transforms: [
70
- {
71
- method: "PositionalVector",
72
- positionalVector: {
73
- delta: {
74
- x: 446.448,
75
- y: -125.157,
76
- z: 542.06,
77
- },
78
- rotation: {
79
- x: 0.15,
80
- y: 0.247,
81
- z: 0.842,
82
- },
83
- scalePPM: -20.489,
84
- },
85
- sourceEllipsoid: {
86
- equatorialRadius: 6377563.396,
87
- id: "EPSG:7001",
88
- polarRadius: 6356256.909237,
89
- },
90
- targetEllipsoid: {
91
- equatorialRadius: 6378137,
92
- id: "WGS84",
93
- polarRadius: 6356752.3142,
94
- },
95
- }
96
- ],
97
- },
98
- datumId: "EPSG:6277",
99
- deprecated: true,
100
- description: "Use other variant - OSGB British National Grid",
101
- extent: {
102
- northEast: {
103
- latitude: 60.84,
104
- longitude: 1.78,
105
- },
106
- southWest: {
107
- latitude: 49.96,
108
- longitude: -7.56,
109
- },
110
- },
111
- id: "EPSG:27700",
112
- projection: {
113
- centralMeridian: -2,
114
- falseEasting: 400000,
115
- falseNorthing: -100000,
116
- latitudeOfOrigin: 49,
117
- method: "TransverseMercator",
118
- scaleFactor: 0.999601272737422,
119
- },
120
- source: "EPSG",
121
- unit: "Meter",
122
- },
123
- verticalCRS: {
124
- id: "ELLIPSOID",
125
- },
126
- };
127
- await completionTest({ horizontalCRS: { id: "EPSG:27700" }, verticalCRS: { id: "ELLIPSOID" } }, britishNationalGridOld);
128
- });
129
- it("should be able to interpret to completion EWRGCS", async () => {
130
- const EWRGCS = {
131
- horizontalCRS: {
132
- id: "EPSG:27700",
133
- description: "OSGB 1936 / British National Grid",
134
- source: "EPSG V6 [Large and medium scale topographic mapping and engin]",
135
- datumId: "EPSG:6277",
136
- datum: {
137
- id: "EPSG:6277",
138
- description: "OSGB36 - Use OSGB-7P-2. Consider OSGB/OSTN15 instead",
139
- deprecated: true,
140
- source: "EPSG V6.12 operation EPSG:1314 [EPSG]",
141
- ellipsoidId: "EPSG:7001",
142
- ellipsoid: {
143
- equatorialRadius: 6377563.396,
144
- polarRadius: 6356256.909237,
145
- id: "EPSG:7001",
146
- description: "Airy 1830",
147
- source: "EPSG, Version 6 [EPSG]",
148
- },
149
- transforms: [
150
- {
151
- method: "PositionalVector",
152
- sourceEllipsoid: {
153
- equatorialRadius: 6377563.396,
154
- polarRadius: 6356256.909237,
155
- id: "EPSG:7001",
156
- },
157
- targetEllipsoid: {
158
- equatorialRadius: 6378137,
159
- polarRadius: 6356752.3142,
160
- id: "WGS84",
161
- },
162
- positionalVector: {
163
- delta: {
164
- x: 446.448,
165
- y: -125.157,
166
- z: 542.06,
167
- },
168
- rotation: {
169
- x: 0.15,
170
- y: 0.247,
171
- z: 0.842,
172
- },
173
- scalePPM: -20.489,
174
- },
175
- }
176
- ],
177
- },
178
- unit: "Meter",
179
- projection: {
180
- method: "TransverseMercator",
181
- falseEasting: 400000,
182
- falseNorthing: -100000,
183
- centralMeridian: -2,
184
- latitudeOfOrigin: 49,
185
- scaleFactor: 0.999601272737422,
186
- },
187
- extent: {
188
- southWest: {
189
- latitude: 49.96,
190
- longitude: -7.56,
191
- },
192
- northEast: {
193
- latitude: 60.84,
194
- longitude: 1.78,
195
- },
196
- },
197
- },
198
- verticalCRS: {
199
- id: "ELLIPSOID",
200
- },
201
- additionalTransform: {
202
- helmert2DWithZOffset: {
203
- translationX: 284597.3343,
204
- translationY: 79859.4651,
205
- translationZ: 0,
206
- rotDeg: 0.5263624458992088,
207
- scale: 0.9996703340508721,
208
- },
209
- },
210
- };
211
- await completionTest({ horizontalCRS: { id: "EPSG:27700" }, verticalCRS: { id: "ELLIPSOID" }, additionalTransform: { helmert2DWithZOffset: { translationX: 284597.3343, translationY: 79859.4651, translationZ: 0, rotDeg: 0.5263624458992088, scale: 0.9996703340508721 } } }, EWRGCS);
212
- });
213
- it("should be able to interpret to completion UTM27Z10", async () => {
214
- const UTM27Z10 = {
215
- horizontalCRS: {
216
- datum: {
217
- description: "North American Datum of 1927 (US48, AK, HI, and Canada)",
218
- ellipsoid: {
219
- description: "Clarke 1866, Benoit Ratio",
220
- epsg: 7008,
221
- equatorialRadius: 6378206.4,
222
- id: "CLRK66",
223
- polarRadius: 6356583.8,
224
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
225
- },
226
- ellipsoidId: "CLRK66",
227
- epsg: 6267,
228
- id: "NAD27",
229
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
230
- transforms: [
231
- {
232
- gridFile: {
233
- files: [
234
- {
235
- direction: "Direct",
236
- fileName: "./Usa/Nadcon/conus.l?s",
237
- format: "NADCON",
238
- },
239
- {
240
- direction: "Direct",
241
- fileName: "./Usa/Nadcon/alaska.l?s",
242
- format: "NADCON",
243
- },
244
- {
245
- direction: "Direct",
246
- fileName: "./Usa/Nadcon/prvi.l?s",
247
- format: "NADCON",
248
- },
249
- {
250
- direction: "Direct",
251
- fileName: "./Usa/Nadcon/hawaii.l?s",
252
- format: "NADCON",
253
- },
254
- {
255
- direction: "Direct",
256
- fileName: "./Usa/Nadcon/stgeorge.l?s",
257
- format: "NADCON",
258
- },
259
- {
260
- direction: "Direct",
261
- fileName: "./Usa/Nadcon/stlrnc.l?s",
262
- format: "NADCON",
263
- },
264
- {
265
- direction: "Direct",
266
- fileName: "./Usa/Nadcon/stpaul.l?s",
267
- format: "NADCON",
268
- }
269
- ],
270
- },
271
- method: "GridFiles",
272
- sourceEllipsoid: {
273
- equatorialRadius: 6378206.4,
274
- id: "CLRK66",
275
- polarRadius: 6356583.8,
276
- },
277
- targetEllipsoid: {
278
- equatorialRadius: 6378137,
279
- id: "GRS1980",
280
- polarRadius: 6356752.314140348,
281
- },
282
- }
283
- ],
284
- },
285
- datumId: "NAD27",
286
- description: "UTM with NAD27 datum, Zone 10, Meter; Central Meridian 123d W",
287
- epsg: 26710,
288
- extent: {
289
- northEast: {
290
- latitude: 84,
291
- longitude: -119.5,
292
- },
293
- southWest: {
294
- latitude: -1,
295
- longitude: -126.5,
296
- },
297
- },
298
- id: "UTM27-10",
299
- projection: {
300
- hemisphere: "North",
301
- method: "UniversalTransverseMercator",
302
- zoneNumber: 10,
303
- },
304
- source: "Snyder, J.P, 1987, Map Projections - A Working Manual",
305
- unit: "Meter",
306
- },
307
- verticalCRS: {
308
- id: "NGVD29",
309
- },
310
- };
311
- await completionTest({ horizontalCRS: { id: "UTM27-10" }, verticalCRS: { id: "NGVD29" } }, UTM27Z10);
312
- });
313
- it("should be able to interpret to completion UTM27Z10B", async () => {
314
- const UTM27Z10B = {
315
- horizontalCRS: {
316
- datum: {
317
- description: "North American Datum of 1927 (US48, AK, HI, and Canada)",
318
- ellipsoid: {
319
- description: "Clarke 1866, Benoit Ratio",
320
- epsg: 7008,
321
- equatorialRadius: 6378206.4,
322
- id: "CLRK66",
323
- polarRadius: 6356583.8,
324
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
325
- },
326
- ellipsoidId: "CLRK66",
327
- epsg: 6267,
328
- id: "NAD27",
329
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
330
- transforms: [
331
- {
332
- gridFile: {
333
- files: [
334
- {
335
- direction: "Direct",
336
- fileName: "./Usa/Nadcon/conus.l?s",
337
- format: "NADCON",
338
- },
339
- {
340
- direction: "Direct",
341
- fileName: "./Usa/Nadcon/alaska.l?s",
342
- format: "NADCON",
343
- },
344
- {
345
- direction: "Direct",
346
- fileName: "./Usa/Nadcon/prvi.l?s",
347
- format: "NADCON",
348
- },
349
- {
350
- direction: "Direct",
351
- fileName: "./Usa/Nadcon/hawaii.l?s",
352
- format: "NADCON",
353
- },
354
- {
355
- direction: "Direct",
356
- fileName: "./Usa/Nadcon/stgeorge.l?s",
357
- format: "NADCON",
358
- },
359
- {
360
- direction: "Direct",
361
- fileName: "./Usa/Nadcon/stlrnc.l?s",
362
- format: "NADCON",
363
- },
364
- {
365
- direction: "Direct",
366
- fileName: "./Usa/Nadcon/stpaul.l?s",
367
- format: "NADCON",
368
- },
369
- ],
370
- },
371
- method: "GridFiles",
372
- sourceEllipsoid: {
373
- equatorialRadius: 6378206.4,
374
- id: "CLRK66",
375
- polarRadius: 6356583.8,
376
- },
377
- targetEllipsoid: {
378
- equatorialRadius: 6378137,
379
- id: "GRS1980",
380
- polarRadius: 6356752.314140348,
381
- },
382
- },
383
- ],
384
- },
385
- datumId: "NAD27",
386
- description: "NAD27 / UTM zone 10N",
387
- epsg: 26710,
388
- extent: {
389
- northEast: {
390
- latitude: 77,
391
- longitude: -120,
392
- },
393
- southWest: {
394
- latitude: 34.4,
395
- longitude: -126,
396
- },
397
- },
398
- id: "EPSG:26710",
399
- projection: {
400
- centralMeridian: -123,
401
- falseEasting: 500000,
402
- falseNorthing: 0,
403
- latitudeOfOrigin: 0,
404
- method: "TransverseMercator",
405
- scaleFactor: 0.9996,
406
- },
407
- source: "EPSG V6 [Large and medium scale topographic mapping and engin]",
408
- unit: "Meter",
409
- },
410
- verticalCRS: {
411
- id: "NGVD29",
412
- },
413
- };
414
- await completionTest({ horizontalCRS: { epsg: 26710 }, verticalCRS: { id: "NGVD29" } }, UTM27Z10B);
415
- });
416
- });
417
- describe("Interpretation of WKT GeographicCRS", async () => {
418
- const interpretWKTTest = async (testWKT, completeCRS) => {
419
- const requestProps = { format: "WKT", geographicCRSDef: testWKT };
420
- const response = IModelNative.platform.GeoServices.getGeographicCRSInterpretation(requestProps);
421
- assert.isTrue(response.status === 0);
422
- assert.isTrue(response.geographicCRS !== undefined);
423
- if (response.geographicCRS !== undefined) {
424
- assert.isTrue(response.geographicCRS.horizontalCRS !== undefined && completeCRS.horizontalCRS !== undefined);
425
- assert.isTrue(response.geographicCRS.horizontalCRS.id === completeCRS.horizontalCRS.id);
426
- assert.isTrue(response.geographicCRS.horizontalCRS.projection !== undefined && completeCRS.horizontalCRS.projection !== undefined);
427
- assert.isTrue(response.geographicCRS.horizontalCRS.projection.method === completeCRS.horizontalCRS.projection.method);
428
- if (completeCRS.horizontalCRS.projection.falseEasting !== undefined) {
429
- assert.isTrue(response.geographicCRS.horizontalCRS.projection.falseEasting !== undefined);
430
- assert.isTrue(Math.abs(response.geographicCRS.horizontalCRS.projection.falseEasting - completeCRS.horizontalCRS.projection.falseEasting) < Geometry.smallMetricDistance);
431
- }
432
- if (completeCRS.horizontalCRS.projection.falseNorthing !== undefined) {
433
- assert.isTrue(response.geographicCRS.horizontalCRS.projection.falseNorthing !== undefined);
434
- assert.isTrue(Math.abs(response.geographicCRS.horizontalCRS.projection.falseNorthing - completeCRS.horizontalCRS.projection.falseNorthing) < Geometry.smallMetricDistance);
435
- }
436
- assert.isTrue(response.geographicCRS.horizontalCRS.datum !== undefined && completeCRS.horizontalCRS.datum !== undefined);
437
- assert.isTrue(response.geographicCRS.horizontalCRS.datum.id === completeCRS.horizontalCRS.datum.id);
438
- assert.isTrue(response.geographicCRS.horizontalCRS.datum.ellipsoid !== undefined && completeCRS.horizontalCRS.datum.ellipsoid !== undefined);
439
- assert.isTrue(response.geographicCRS.horizontalCRS.datum.ellipsoid.id === completeCRS.horizontalCRS.datum.ellipsoid.id);
440
- assert.isTrue(response.geographicCRS.verticalCRS !== undefined && completeCRS.verticalCRS !== undefined);
441
- assert.isTrue(response.geographicCRS.verticalCRS.id === completeCRS.verticalCRS.id);
442
- // WKTs cannot define an additional transform
443
- assert.isTrue(response.geographicCRS.additionalTransform === undefined);
444
- }
445
- };
446
- it("should be able to interpret airportGrid2007 WKT", async () => {
447
- const airportGrid2007 = {
448
- horizontalCRS: {
449
- datum: {
450
- description: "Heathrow T5 Datum",
451
- ellipsoid: {
452
- description: "Airy, 1830",
453
- epsg: 7001,
454
- equatorialRadius: 6377563.396,
455
- id: "AIRY30",
456
- polarRadius: 6356256.909,
457
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
458
- },
459
- ellipsoidId: "AIRY30",
460
- id: "HeathrowT5",
461
- source: "Bentley Client",
462
- transforms: [
463
- {
464
- method: "PositionalVector",
465
- positionalVector: {
466
- delta: {
467
- x: 358.398212181898,
468
- y: -213.702844870731,
469
- z: 495.318319769716,
470
- },
471
- rotation: {
472
- x: 668.806139320047,
473
- y: -4.72664217602752,
474
- z: 719.671097181396,
475
- },
476
- scalePPM: -6.26386076385543,
477
- },
478
- sourceEllipsoid: {
479
- equatorialRadius: 6377563.396,
480
- id: "AIRY30",
481
- polarRadius: 6356256.909,
482
- },
483
- targetEllipsoid: {
484
- equatorialRadius: 6378137,
485
- id: "WGS84",
486
- polarRadius: 6356752.3142,
487
- },
488
- },
489
- ],
490
- },
491
- datumId: "HeathrowT5",
492
- description: "AirportGrid2007",
493
- id: "AirportGrid2007",
494
- projection: {
495
- centralMeridian: -0.41832591666666674,
496
- falseEasting: 7334.81,
497
- falseNorthing: 5637.423,
498
- latitudeOfOrigin: 51.47011065555556,
499
- method: "TransverseMercator",
500
- scaleFactor: 0.999995,
501
- },
502
- source: "WKT",
503
- unit: "Meter",
504
- },
505
- verticalCRS: {
506
- id: "ELLIPSOID",
507
- },
508
- };
509
- await interpretWKTTest('PROJCS["AirportGrid2007", GEOGCS["HeathrowT5.LL",DATUM["Heathrow T5", SPHEROID["AIRY30",6377563.396,299.32496127],358.398,-213.7028,495.3183,-668.80613932004700,4.72664217602752,-719.67109718139600,-6.26386076385543],PRIMEM["Greenwich",0],UNIT["Decimal Degree",0.017453292519943295]],PROJECTION["Transverse Mercator"],PARAMETER["latitude_of_origin",51.470110655555558],PARAMETER["central_meridian",-0.41832591666666669],PARAMETER["scale_factor",0.999995],PARAMETER["false_easting",7334.810],PARAMETER["false_northing",5637.423],UNIT["Meter",1.00000000000000]]', airportGrid2007);
510
- });
511
- it("should be able to interpret denmarkED50 WKT", async () => {
512
- const denmarkED50 = {
513
- horizontalCRS: {
514
- datum: {
515
- description: "European 1950, Denmark, for System 34",
516
- ellipsoid: {
517
- description: "Hayford, 1924 (aka 1909); same as International 1924",
518
- epsg: 7022,
519
- equatorialRadius: 6378388,
520
- id: "HAYFORD",
521
- polarRadius: 6356911.9461279465,
522
- source: "Snyder, J.P., 1987, Map Projections - A Working Manual",
523
- },
524
- ellipsoidId: "HAYFORD",
525
- id: "ED50-DK34",
526
- source: "KMSTrans, by Kort-og Matrikelstyrelsen (Nov 1999)",
527
- transforms: [
528
- {
529
- method: "PositionalVector",
530
- positionalVector: {
531
- delta: {
532
- x: -81.0703,
533
- y: -89.3603,
534
- z: -115.7526,
535
- },
536
- rotation: {
537
- x: 0.48488,
538
- y: 0.02436,
539
- z: 0.41321,
540
- },
541
- scalePPM: -0.540645,
542
- },
543
- sourceEllipsoid: {
544
- equatorialRadius: 6378388,
545
- id: "HAYFORD",
546
- polarRadius: 6356911.9461279465,
547
- },
548
- targetEllipsoid: {
549
- equatorialRadius: 6378137,
550
- id: "WGS84",
551
- polarRadius: 6356752.3142,
552
- },
553
- },
554
- ],
555
- },
556
- datumId: "ED50-DK34",
557
- description: "DummyName",
558
- extent: {
559
- northEast: {
560
- latitude: 90,
561
- longitude: 180,
562
- },
563
- southWest: {
564
- latitude: -90,
565
- longitude: -180,
566
- },
567
- },
568
- id: "DummyName",
569
- projection: {
570
- method: "None",
571
- },
572
- source: "Extracted from WKT string; description field carries WKT name.",
573
- unit: "Degree",
574
- },
575
- verticalCRS: {
576
- id: "ELLIPSOID",
577
- },
578
- };
579
- await interpretWKTTest('GEOGCS[ "DummyName", DATUM ["European 1950 (Denmark)", SPHEROID ["International 1924", 6378388, 297],-81.0703, -89.3603, -115.7526, .48488, .02436, .41321, -.540645], PRIMEM [ "Greenwich", 0.000000 ], UNIT ["Decimal Degree", 0.01745329251994330]]', denmarkED50);
580
- });
581
- it("should be able to interpret californiaStateZone2 WKT", async () => {
582
- const californiaStateZone2 = {
583
- horizontalCRS: {
584
- datum: {
585
- description: "North American Datum of 1983",
586
- ellipsoid: {
587
- description: "Geodetic Reference System of 1980",
588
- epsg: 7019,
589
- equatorialRadius: 6378137,
590
- id: "GRS1980",
591
- polarRadius: 6356752.314140348,
592
- source: "Stem, L.E., Jan 1989, State Plane Coordinate System of 1983",
593
- },
594
- ellipsoidId: "GRS1980",
595
- epsg: 6269,
596
- id: "NAD83",
597
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
598
- transforms: [
599
- {
600
- method: "None",
601
- },
602
- ],
603
- },
604
- datumId: "NAD83",
605
- description: "NAD_1983_StatePlane_California_II_FIPS_0402_Feet",
606
- id: "NAD_1983_StatePlane_Cal",
607
- projection: {
608
- falseEasting: 6561666.666666666,
609
- falseNorthing: 1640416.666666667,
610
- latitudeOfOrigin: 37.66666666666666,
611
- longitudeOfOrigin: -122,
612
- method: "LambertConformalConicTwoParallels",
613
- standardParallel1: 38.33333333333334,
614
- standardParallel2: 39.83333333333334,
615
- },
616
- source: "WKT",
617
- unit: "USSurveyFoot",
618
- },
619
- verticalCRS: {
620
- id: "NAVD88",
621
- },
622
- };
623
- await interpretWKTTest('PROJCS["NAD_1983_StatePlane_California_II_FIPS_0402_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],PARAMETER["Central_Meridian",-122],PARAMETER["Standard_Parallel_1",38.33333333333334],PARAMETER["Standard_Parallel_2",39.83333333333334],PARAMETER["Latitude_Of_Origin",37.66666666666666],UNIT["Foot_US",0.30480060960121924]]', californiaStateZone2);
624
- });
625
- it("should be able to interpret utm84Zone34S WKT", async () => {
626
- const utm84Zone34S = {
627
- horizontalCRS: {
628
- datum: {
629
- description: "World Geodetic System of 1984",
630
- ellipsoid: {
631
- description: "World Geodetic System of 1984, GEM 10C",
632
- epsg: 7030,
633
- equatorialRadius: 6378137,
634
- id: "WGS84",
635
- polarRadius: 6356752.3142,
636
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
637
- },
638
- ellipsoidId: "WGS84",
639
- epsg: 6326,
640
- id: "WGS84",
641
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
642
- transforms: [
643
- {
644
- method: "None",
645
- },
646
- ],
647
- },
648
- datumId: "WGS84",
649
- description: "WGS 84 / UTM zone 34S",
650
- id: "WGS 84 / UTM zone 34S",
651
- projection: {
652
- centralMeridian: 20.999999999999982,
653
- falseEasting: 500000,
654
- falseNorthing: 10000000,
655
- latitudeOfOrigin: 0,
656
- method: "TransverseMercator",
657
- scaleFactor: 0.9996,
658
- },
659
- source: "WKT",
660
- unit: "Meter",
661
- },
662
- verticalCRS: {
663
- id: "ELLIPSOID",
664
- },
665
- };
666
- await interpretWKTTest('PROJCS["WGS 84 / UTM zone 34S", GEOGCS [ "WGS 84", DATUM ["World Geodetic System 1984 (EPSG ID 6326)", SPHEROID ["WGS 84 (EPSG ID 7030)", 6378137, 298.257223563]], PRIMEM [ "Greenwich", 0.000000 ], UNIT ["Decimal Degree", 0.01745329251994328]], PROJECTION ["UTM zone 34S (EPSG OP 16134)"], PARAMETER ["Latitude_Of_Origin", 0], PARAMETER ["Central_Meridian", 21], PARAMETER ["Scale_Factor", .9996], PARAMETER ["False_Easting", 500000], PARAMETER ["False_Northing", 10000000], UNIT ["Meter", 1]]', utm84Zone34S);
667
- });
668
- it("should be able to interpret utm84Zone32NGeoid WKT", async () => {
669
- const utm84Zone32NGeoid = {
670
- horizontalCRS: {
671
- datum: {
672
- description: "World Geodetic System of 1984",
673
- ellipsoid: {
674
- description: "World Geodetic System of 1984, GEM 10C",
675
- epsg: 7030,
676
- equatorialRadius: 6378137,
677
- id: "WGS84",
678
- polarRadius: 6356752.3142,
679
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
680
- },
681
- ellipsoidId: "WGS84",
682
- epsg: 6326,
683
- id: "WGS84",
684
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
685
- transforms: [
686
- {
687
- method: "None",
688
- },
689
- ],
690
- },
691
- datumId: "WGS84",
692
- description: "WGS 84 / UTM zone32N",
693
- id: "WGS 84 / UTM zone32N",
694
- projection: {
695
- centralMeridian: 9,
696
- falseEasting: 500000,
697
- falseNorthing: 0,
698
- latitudeOfOrigin: 0,
699
- method: "TransverseMercator",
700
- scaleFactor: 0.9996,
701
- },
702
- source: "WKT",
703
- unit: "Meter",
704
- },
705
- verticalCRS: {
706
- id: "GEOID",
707
- },
708
- };
709
- await interpretWKTTest('COMPD_CS["WGS 84 / UTM zone 32N + EGM96 geoid height",PROJCS["WGS 84 / UTM zone32N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",9],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32632"]],VERT_CS["EGM96 geoid height",VERT_DATUM["EGM96 geoid",2005,EXTENSION["PROJ4_GRIDS","egm96_15.gtx"],AUTHORITY["EPSG","5171"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Up",UP],AUTHORITY["EPSG","5773"]]]', utm84Zone32NGeoid);
710
- });
711
- it("should be able to interpret utm84Zone18NGeoid WKT", async () => {
712
- const utm84Zone18NGeoid = {
713
- horizontalCRS: {
714
- datum: {
715
- description: "World Geodetic System of 1984",
716
- ellipsoid: {
717
- description: "World Geodetic System of 1984, GEM 10C",
718
- epsg: 7030,
719
- equatorialRadius: 6378137,
720
- id: "WGS84",
721
- polarRadius: 6356752.3142,
722
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
723
- },
724
- ellipsoidId: "WGS84",
725
- epsg: 6326,
726
- id: "WGS84",
727
- source: "US Defense Mapping Agency, TR-8350.2-B, December 1987",
728
- transforms: [
729
- {
730
- method: "None",
731
- },
732
- ],
733
- },
734
- datumId: "WGS84",
735
- description: "UTM84-18N",
736
- id: "UTM84-18N",
737
- projection: {
738
- hemisphere: "North",
739
- method: "UniversalTransverseMercator",
740
- zoneNumber: 18,
741
- },
742
- source: "WKT",
743
- unit: "Meter",
744
- },
745
- verticalCRS: {
746
- id: "GEOID",
747
- },
748
- };
749
- await interpretWKTTest('COMPD_CS["UTM84-18N",PROJCS["UTM84-18N",GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Universal Transverse Mercator System"],PARAMETER["UTM Zone Number (1 - 60)",18.0],PARAMETER["Hemisphere, North or South",1.0],UNIT["Meter",1.00000000000000]],VERT_CS["Geoid Height",VERT_DATUM["EGM96 geoid",2005],UNIT["METER",1.000000]]]', utm84Zone18NGeoid);
750
- });
751
- });
752
- describe("Verify list of CRS", async () => {
753
- const validationRange = 50;
754
- const validationRangeSmall = 10;
755
- const validateCRSList = async (options) => {
756
- const { expectedCount, allowedRange, extent, includeWorld } = options;
757
- const listOfCRS = await getAvailableCoordinateReferenceSystems({ extent, includeWorld });
758
- // Check fields of returned coordinate reference systems
759
- const extentRange = Range2d.fromJSON(extent);
760
- for (const crs of listOfCRS) {
761
- // Validate extent
762
- if (extent !== undefined) {
763
- const crsExtentRange = Range2d.fromJSON(crs.crsExtent);
764
- const intersects = extentRange.intersectsRange(crsExtentRange);
765
- assert.isTrue(intersects);
766
- }
767
- // These fields should always be present
768
- assert.isTrue(crs.name !== undefined);
769
- assert.isTrue(crs.description !== undefined);
770
- assert.isTrue(crs.deprecated === true || crs.deprecated === false);
771
- }
772
- assert.isTrue(listOfCRS.length > expectedCount - allowedRange && listOfCRS.length < expectedCount + allowedRange);
773
- };
774
- const validateExtent = (expectedExtent, crsExtent) => {
775
- const crsExtentRange = Range2d.fromJSON(crsExtent);
776
- assert.equal(crsExtentRange.low.x, expectedExtent.low.x);
777
- assert.equal(crsExtentRange.low.y, expectedExtent.low.y);
778
- assert.equal(crsExtentRange.high.x, expectedExtent.high.x);
779
- assert.equal(crsExtentRange.high.y, expectedExtent.high.y);
780
- };
781
- it("should get all CRS", async () => {
782
- await validateCRSList({ expectedCount: 12_332, allowedRange: validationRange, includeWorld: true });
783
- });
784
- it("should get all CRS, excluding world crs", async () => {
785
- await validateCRSList({ expectedCount: 11_975, allowedRange: validationRange });
786
- });
787
- it("should return CRS that are in the specified range (1)", async () => {
788
- const extent = { low: { x: 60.1, y: 61.2 }, high: { x: 62.3, y: 63.4 } };
789
- await validateCRSList({ expectedCount: 82, allowedRange: validationRangeSmall, extent });
790
- await validateCRSList({ expectedCount: 439, allowedRange: validationRangeSmall, extent, includeWorld: true });
791
- });
792
- it("should return CRS that are in the specified range (2)", async () => {
793
- const extent = { low: { x: 0, y: 2 }, high: { x: 1, y: 3 } };
794
- await validateCRSList({ expectedCount: 67, allowedRange: validationRangeSmall, extent });
795
- await validateCRSList({ expectedCount: 424, allowedRange: validationRangeSmall, extent, includeWorld: true });
796
- });
797
- it("should return CRS that are in the specified range (3)", async () => {
798
- const extent = { low: { x: 0.3, y: 2.4 }, high: { x: 1.6, y: 3.77 } };
799
- await validateCRSList({ expectedCount: 62, allowedRange: validationRangeSmall, extent });
800
- await validateCRSList({ expectedCount: 419, allowedRange: validationRangeSmall, extent, includeWorld: true });
801
- });
802
- it("should retrieve the whole list of CRS and validate the properties for a few selected CRS.", async () => {
803
- const listOfCRS = await getAvailableCoordinateReferenceSystems({ includeWorld: true });
804
- let nbFound = 0;
805
- for (const crs of listOfCRS) {
806
- switch (crs.name) {
807
- case "3TM111-83":
808
- nbFound++;
809
- assert.equal(crs.description, "Use NAD83-AB/3TM-111 instead.");
810
- assert.equal(crs.deprecated, true);
811
- validateExtent(Range2d.fromJSON({ low: { x: -113, y: 48 }, high: { x: -109, y: 84 } }), crs.crsExtent);
812
- break;
813
- case "NAD27-CAN.MTM-1":
814
- nbFound++;
815
- assert.equal(crs.description, "NAD27 / MTM zone 1");
816
- assert.equal(crs.deprecated, false);
817
- validateExtent(Range2d.fromJSON({ low: { x: -54.5, y: 45 }, high: { x: -50.5, y: 55 } }), crs.crsExtent);
818
- break;
819
- case "AL83-EF":
820
- nbFound++;
821
- assert.equal(crs.description, "NAD83 Alabama State Plane, East Zone, US Foot");
822
- assert.equal(crs.deprecated, false);
823
- validateExtent(Range2d.fromJSON({ low: { x: -87.5, y: 30 }, high: { x: -84, y: 35.75 } }), crs.crsExtent);
824
- break;
825
- case "ME-E":
826
- nbFound++;
827
- assert.equal(crs.description, "NAD27 Maine State Plane, East Zone(1801), US Foot");
828
- assert.equal(crs.deprecated, false);
829
- validateExtent(Range2d.fromJSON({ low: { x: -71, y: 43.5 }, high: { x: -66, y: 48 } }), crs.crsExtent);
830
- break;
831
- // world CRS
832
- case "EPSG:4326":
833
- nbFound++;
834
- assert.equal(crs.description, "WGS 84");
835
- assert.equal(crs.deprecated, false);
836
- validateExtent(Range2d.fromJSON({ low: { x: -180, y: -90 }, high: { x: 180, y: 90 } }), crs.crsExtent);
837
- break;
838
- }
839
- }
840
- assert.equal(nbFound, 5);
841
- });
842
- it("check CRS units", () => {
843
- const expectedUnits = ["Meter", "Degree", "USSurveyFoot", "InternationalFoot"];
844
- const definitiveListOfUnits = getAvailableCRSUnits();
845
- assert.isAtLeast(definitiveListOfUnits.length, expectedUnits.length);
846
- for (const unit of expectedUnits) {
847
- assert.include(definitiveListOfUnits, unit);
848
- }
849
- });
850
- it("can filter by each CRS unit", async () => {
851
- const minExpectedCounts = new Map([
852
- ["Meter", 8000],
853
- ["Degree", 1000],
854
- ["USSurveyFoot", 100],
855
- ["InternationalFoot", 50],
856
- ]);
857
- const units = getAvailableCRSUnits();
858
- for (const unit of units) {
859
- const listOfCRS = await getAvailableCoordinateReferenceSystems({
860
- includeWorld: true,
861
- unit,
862
- });
863
- const minExpected = minExpectedCounts.get(unit) ?? 1;
864
- assert.isAtLeast(listOfCRS.length, minExpected, `Expected at least ${minExpected} CRS with unit "${unit}", got ${listOfCRS.length}`);
865
- for (const crs of listOfCRS) {
866
- assert.equal(crs.unit, unit, `CRS "${crs.name}" has unexpected unit "${crs.unit}" (expected "${unit}")`);
867
- }
868
- }
869
- });
870
- it("can filter by unit case-insensitively", async () => {
871
- const units = getAvailableCRSUnits();
872
- for (const unit of units) {
873
- const canonicalList = await getAvailableCoordinateReferenceSystems({
874
- includeWorld: true,
875
- unit,
876
- });
877
- const lowerCaseFilterList = await getAvailableCoordinateReferenceSystems({
878
- includeWorld: true,
879
- unit: unit.toLowerCase(),
880
- });
881
- assert.sameMembers(lowerCaseFilterList.map((crs) => crs.name), canonicalList.map((crs) => crs.name), `Expected lowercase unit filter to match canonical filter for "${unit}"`);
882
- }
883
- });
884
- });
885
- it("should not be able to interpret an invalid GeographicCRS", async () => {
886
- const interpretInvalidTest = async (formatCRS, testInvalid) => {
887
- const requestProps = { format: formatCRS, geographicCRSDef: testInvalid };
888
- const response = IModelNative.platform.GeoServices.getGeographicCRSInterpretation(requestProps);
889
- // At the moment return codes are not really error specific (we mostly return 32768) so we do not validate
890
- // actual error code for now.
891
- assert.isFalse(response.status === 0);
892
- };
893
- // WKT Without datum or projection clause
894
- await interpretInvalidTest("WKT", 'PROJCS["AirportGrid2007", GEOGCS["HeathrowT5.LL",PRIMEM["Greenwich",0],UNIT["Decimal Degree",0.017453292519943295]],UNIT["Meter",1.00000000000000]]');
895
- // Plain garbage
896
- await interpretInvalidTest("WKT", "Some invalid content");
897
- // Format is JSON but content is WKT
898
- await interpretInvalidTest("JSON", 'GEOGCS[ "Longitude / Latitude (ED 50 Denmark)", DATUM ["European 1950 (Denmark)", SPHEROID ["International 1924", 6378388, 297],-81.0703, -89.3603, -115.7526, .48488, .02436, .41321, -.540645], PRIMEM [ "Greenwich", 0.000000 ], UNIT ["Decimal Degree", 0.01745329251994330]]');
899
- // Vertical datum invalid for horizontal definition
900
- await interpretInvalidTest("JSON", '{ horizontalCRS: { id: "EPSG:27700" }, verticalCRS: { id: "NAVD29" } }');
901
- // No horizontal CRS
902
- await interpretInvalidTest("JSON", '{ verticalCRS: { id: "NAVD29" } }');
903
- // Unknown identifier
904
- await interpretInvalidTest("JSON", '{ horizontalCRS: { id: "UNKNOWN" }, verticalCRS: { id: "NAVD29" } }');
905
- });
906
- it("should return expected Transform from Helmert2DWithZOffset object", async () => {
907
- const helmertTransform = new Helmert2DWithZOffset({ translationX: 1, translationY: 1, translationZ: 1, rotDeg: 90, scale: 2 });
908
- const convertedTransform = helmertTransform.convertHelmertToTransform();
909
- const originExpected = Point3d.fromJSON({ x: 1, y: 1, z: 1 });
910
- assert(convertedTransform.origin.isAlmostEqual(originExpected));
911
- const expectedCoffs = [0, -2, 0, 2, 0, 0, 0, 0, 1];
912
- const actualCoffs = Array.from(convertedTransform.matrix.coffs);
913
- for (let i = 0; i < expectedCoffs.length; ++i) {
914
- assert(Math.abs(actualCoffs[i] - expectedCoffs[i]) < 1e-12, `Matrix coefficient at index ${i} differs: expected ${expectedCoffs[i]}, got ${actualCoffs[i]}`);
915
- }
916
- });
917
- });
918
- //# sourceMappingURL=GeoServices.test.js.map