@loaders.gl/tiles 5.0.0-alpha.6 → 5.0.0-alpha.8
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/README.md +26 -0
- package/dist/dist.dev.js +10015 -8172
- package/dist/dist.min.js +3 -4
- package/dist/index.cjs +1676 -477
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/spatial/format-spatial-reference.d.ts +1 -0
- package/dist/spatial/format-spatial-reference.d.ts.map +1 -1
- package/dist/spatial/format-spatial-reference.js +104 -46
- package/dist/spatial/format-spatial-reference.js.map +1 -1
- package/dist/spatial/get-spatial-coordinate-frame.d.ts +12 -1
- package/dist/spatial/get-spatial-coordinate-frame.d.ts.map +1 -1
- package/dist/spatial/get-spatial-coordinate-frame.js +105 -24
- package/dist/spatial/get-spatial-coordinate-frame.js.map +1 -1
- package/dist/spatial/normalize-crs-identifier.d.ts +15 -0
- package/dist/spatial/normalize-crs-identifier.d.ts.map +1 -0
- package/dist/spatial/normalize-crs-identifier.js +22 -0
- package/dist/spatial/normalize-crs-identifier.js.map +1 -0
- package/dist/spatial/spatial-coordinate-transformer.d.ts +4 -0
- package/dist/spatial/spatial-coordinate-transformer.d.ts.map +1 -1
- package/dist/spatial/spatial-coordinate-transformer.js +102 -18
- package/dist/spatial/spatial-coordinate-transformer.js.map +1 -1
- package/dist/spatial/spatial-resource-registry.js +3 -3
- package/dist/spatial/spatial-resource-registry.js.map +1 -1
- package/dist/spatial/tiles-3d-spatial-transformer.d.ts +32 -0
- package/dist/spatial/tiles-3d-spatial-transformer.d.ts.map +1 -0
- package/dist/spatial/tiles-3d-spatial-transformer.js +175 -0
- package/dist/spatial/tiles-3d-spatial-transformer.js.map +1 -0
- package/dist/tileset-3d/common/tile-3d-contracts.d.ts +63 -0
- package/dist/tileset-3d/common/tile-3d-contracts.d.ts.map +1 -0
- package/dist/tileset-3d/common/tile-3d-contracts.js +51 -0
- package/dist/tileset-3d/common/tile-3d-contracts.js.map +1 -0
- package/dist/tileset-3d/common/tile-3d.d.ts +33 -5
- package/dist/tileset-3d/common/tile-3d.d.ts.map +1 -1
- package/dist/tileset-3d/common/tile-3d.js +179 -29
- package/dist/tileset-3d/common/tile-3d.js.map +1 -1
- package/dist/tileset-3d/common/tileset-3d.d.ts +15 -25
- package/dist/tileset-3d/common/tileset-3d.d.ts.map +1 -1
- package/dist/tileset-3d/common/tileset-3d.js +35 -42
- package/dist/tileset-3d/common/tileset-3d.js.map +1 -1
- package/dist/tileset-3d/common/tileset-content-traversal.d.ts +37 -0
- package/dist/tileset-3d/common/tileset-content-traversal.d.ts.map +1 -0
- package/dist/tileset-3d/common/tileset-content-traversal.js +80 -0
- package/dist/tileset-3d/common/tileset-content-traversal.js.map +1 -0
- package/dist/tileset-3d/common/tileset-observability.d.ts +60 -0
- package/dist/tileset-3d/common/tileset-observability.d.ts.map +1 -0
- package/dist/tileset-3d/common/tileset-observability.js +39 -0
- package/dist/tileset-3d/common/tileset-observability.js.map +1 -0
- package/dist/tileset-3d/common/tileset-source.d.ts +11 -1
- package/dist/tileset-3d/common/tileset-source.d.ts.map +1 -1
- package/dist/tileset-3d/common/tileset-source.js.map +1 -1
- package/dist/tileset-3d/common/tileset-traverser.d.ts.map +1 -1
- package/dist/tileset-3d/common/tileset-traverser.js +4 -3
- package/dist/tileset-3d/common/tileset-traverser.js.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts +47 -1
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js +327 -30
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts +34 -0
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js +278 -14
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts +5 -3
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js +7 -4
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-source.d.ts +4 -2
- package/dist/tileset-3d/format-i3s/i3s-source.d.ts.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-source.js +60 -9
- package/dist/tileset-3d/format-i3s/i3s-source.js.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js +1 -1
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js.map +1 -1
- package/dist/tileset-3d/helpers/bounding-volume.d.ts +7 -3
- package/dist/tileset-3d/helpers/bounding-volume.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/bounding-volume.js +19 -61
- package/dist/tileset-3d/helpers/bounding-volume.js.map +1 -1
- package/dist/tileset-3d/helpers/frame-state.d.ts +5 -0
- package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/frame-state.js +11 -5
- package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
- package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts +17 -0
- package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts.map +1 -0
- package/dist/tileset-3d/helpers/s2-bounding-volume.js +20 -0
- package/dist/tileset-3d/helpers/s2-bounding-volume.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -12
- package/src/index.ts +18 -1
- package/src/spatial/format-spatial-reference.ts +127 -53
- package/src/spatial/get-spatial-coordinate-frame.ts +126 -31
- package/src/spatial/normalize-crs-identifier.ts +26 -0
- package/src/spatial/spatial-coordinate-transformer.ts +124 -24
- package/src/spatial/spatial-resource-registry.ts +3 -3
- package/src/spatial/tiles-3d-spatial-transformer.ts +206 -0
- package/src/tileset-3d/common/tile-3d-contracts.ts +115 -0
- package/src/tileset-3d/common/tile-3d.ts +208 -32
- package/src/tileset-3d/common/tileset-3d.ts +37 -61
- package/src/tileset-3d/common/tileset-content-traversal.ts +114 -0
- package/src/tileset-3d/common/tileset-observability.ts +100 -0
- package/src/tileset-3d/common/tileset-source.ts +19 -1
- package/src/tileset-3d/common/tileset-traverser.ts +4 -3
- package/src/tileset-3d/format-3d-tiles/implicit-tiling.ts +481 -34
- package/src/tileset-3d/format-3d-tiles/tiles-3d-source.ts +405 -14
- package/src/tileset-3d/format-3d-tiles/tileset-3d-traverser.ts +7 -4
- package/src/tileset-3d/format-i3s/i3s-source.ts +84 -13
- package/src/tileset-3d/format-i3s/i3s-tileset-traverser.ts +2 -1
- package/src/tileset-3d/helpers/bounding-volume.ts +29 -62
- package/src/tileset-3d/helpers/frame-state.ts +15 -7
- package/src/tileset-3d/helpers/s2-bounding-volume.ts +35 -0
- package/src/types.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-state.js","sourceRoot":"","sources":["../../../src/tileset-3d/helpers/frame-state.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,aAAa,EAAE,KAAK,EAAC,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"frame-state.js","sourceRoot":"","sources":["../../../src/tileset-3d/helpers/frame-state.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,OAAO,EAAC,MA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B,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjD,GAAG;SACA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;SAClB,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAC;SACrC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,gBAAgB,CACvB,QAAkB,EAClB,KAAyB,EACzB,MAAe,IAAI,OAAO,EAAE;IAE5B,MAAM,eAAe,GAAG,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC1D,OAAO,SAAS,CAAC,KAAK,CAAC,uBAAuB,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Serialized S2 cell metadata used by 3D Tiles bounding-volume extensions. */
|
|
2
|
+
export type S2VolumeInfo = {
|
|
3
|
+
/** S2 key or token. */
|
|
4
|
+
token: string;
|
|
5
|
+
/** Minimum height in meters. */
|
|
6
|
+
minimumHeight: number;
|
|
7
|
+
/** Maximum height in meters. */
|
|
8
|
+
maximumHeight: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Converts an S2 cell and its vertical range to the runtime oriented-box representation.
|
|
12
|
+
*
|
|
13
|
+
* @param s2VolumeInfo - S2 cell token and height range.
|
|
14
|
+
* @returns A twelve-component center/half-axis oriented bounding box.
|
|
15
|
+
*/
|
|
16
|
+
export declare function convertS2BoundingVolumeToOBB(s2VolumeInfo: S2VolumeInfo): number[];
|
|
17
|
+
//# sourceMappingURL=s2-bounding-volume.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s2-bounding-volume.d.ts","sourceRoot":"","sources":["../../../src/tileset-3d/helpers/s2-bounding-volume.ts"],"names":[],"mappings":"AAUA,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG;IACzB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,EAAE,CAQjF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
4
|
+
// TypeScript's legacy `node` resolution does not inspect package `exports`, but this public
|
|
5
|
+
// subpath is resolved by the package at runtime and avoids loading unrelated DGGS decoders.
|
|
6
|
+
// @ts-expect-error Conditional package subpath exports require a modern module resolver.
|
|
7
|
+
import { getS2Bounds } from '@math.gl/dggs/s2';
|
|
8
|
+
import { Ellipsoid, makeOBBFromRegion } from '@math.gl/geospatial';
|
|
9
|
+
/**
|
|
10
|
+
* Converts an S2 cell and its vertical range to the runtime oriented-box representation.
|
|
11
|
+
*
|
|
12
|
+
* @param s2VolumeInfo - S2 cell token and height range.
|
|
13
|
+
* @returns A twelve-component center/half-axis oriented bounding box.
|
|
14
|
+
*/
|
|
15
|
+
export function convertS2BoundingVolumeToOBB(s2VolumeInfo) {
|
|
16
|
+
const [[west, south], [east, north]] = getS2Bounds(s2VolumeInfo.token);
|
|
17
|
+
const orientedBoundingBox = makeOBBFromRegion([west, south, east, north, s2VolumeInfo.minimumHeight, s2VolumeInfo.maximumHeight], Ellipsoid.WGS84, { units: 'degrees' });
|
|
18
|
+
return [...orientedBoundingBox.center, ...orientedBoundingBox.halfAxes];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=s2-bounding-volume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s2-bounding-volume.js","sourceRoot":"","sources":["../../../src/tileset-3d/helpers/s2-bounding-volume.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,gCAAgC;AAEhC,4FAA4F;AAC5F,4FAA4F;AAC5F,yFAAyF;AACzF,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAYjE;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,YAA0B;IACrE,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,mBAAmB,GAAG,iBAAiB,CAC3C,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,aAAa,EAAE,YAAY,CAAC,aAAa,CAAC,EAClF,SAAS,CAAC,KAAK,EACf,EAAC,KAAK,EAAE,SAAS,EAAC,CACnB,CAAC;IACF,OAAO,CAAC,GAAG,mBAAmB,CAAC,MAAM,EAAE,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export type GeospatialViewport = Viewport & {
|
|
|
39
39
|
cameraDirection: [number, number, number];
|
|
40
40
|
/** @todo This field is not represented in Deck.gl viewports. Can be removed in the next version */
|
|
41
41
|
cameraUp: [number, number, number];
|
|
42
|
+
/** Camera target offset in meters from longitude/latitude, including elevation. */
|
|
43
|
+
position?: number[];
|
|
42
44
|
longitude: number;
|
|
43
45
|
latitude: number;
|
|
44
46
|
bearing: number;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,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,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tiles",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.8",
|
|
4
4
|
"description": "Common components for different tiles loaders.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,16 +42,15 @@
|
|
|
42
42
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@loaders.gl/loader-utils": "5.0.0-alpha.
|
|
46
|
-
"@loaders.gl/schema": "5.0.0-alpha.
|
|
47
|
-
"@math.gl/core": "5.0.0-alpha.
|
|
48
|
-
"@math.gl/crs": "5.0.0-alpha.
|
|
49
|
-
"@math.gl/culling": "5.0.0-alpha.
|
|
50
|
-
"@math.gl/
|
|
51
|
-
"@math.gl/
|
|
52
|
-
"@math.gl/geospatial": "5.0.0-alpha.
|
|
53
|
-
"@math.gl/proj4": "5.0.0-alpha.
|
|
54
|
-
"@math.gl/web-mercator": "5.0.0-alpha.5",
|
|
45
|
+
"@loaders.gl/loader-utils": "5.0.0-alpha.8",
|
|
46
|
+
"@loaders.gl/schema": "5.0.0-alpha.8",
|
|
47
|
+
"@math.gl/core": "5.0.0-alpha.11",
|
|
48
|
+
"@math.gl/crs": "5.0.0-alpha.11",
|
|
49
|
+
"@math.gl/culling": "5.0.0-alpha.11",
|
|
50
|
+
"@math.gl/dggs": "5.0.0-alpha.11",
|
|
51
|
+
"@math.gl/geoid": "5.0.0-alpha.11",
|
|
52
|
+
"@math.gl/geospatial": "5.0.0-alpha.11",
|
|
53
|
+
"@math.gl/proj4": "5.0.0-alpha.11",
|
|
55
54
|
"@probe.gl/stats": "^4.1.1"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
@@ -60,5 +59,5 @@
|
|
|
60
59
|
"peerDependencies": {
|
|
61
60
|
"@loaders.gl/core": "~5.0.0-alpha.0"
|
|
62
61
|
},
|
|
63
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "bdc4536ea5b7d074ea362e372704cbdb180126cc"
|
|
64
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
export type {Tileset3DProps} from './tileset-3d/common/tileset-3d';
|
|
6
6
|
export type {FoveatedInterpolationCallback} from './tileset-3d/helpers/tiles-3d-request-priority';
|
|
7
7
|
export {Tileset3D} from './tileset-3d/common/tileset-3d';
|
|
8
|
+
export {getTileset3DTraversalSnapshot} from './tileset-3d/common/tileset-observability';
|
|
9
|
+
export type {Tileset3DTraversalSnapshot} from './tileset-3d/common/tileset-observability';
|
|
10
|
+
export {traverseTilesetContents} from './tileset-3d/common/tileset-content-traversal';
|
|
11
|
+
export type {
|
|
12
|
+
TilesetContentTraversalItem,
|
|
13
|
+
TraverseTilesetContentsOptions
|
|
14
|
+
} from './tileset-3d/common/tileset-content-traversal';
|
|
8
15
|
export type {
|
|
9
16
|
TileContentLoadResult,
|
|
10
17
|
TileChildrenLoadResult,
|
|
@@ -21,6 +28,12 @@ export {isTileset3DSource} from './tileset-3d/common/tileset-source';
|
|
|
21
28
|
export type {IndexedArchiveTilesetSourceOptions} from './tileset-3d/common/indexed-archive-tileset-source';
|
|
22
29
|
export {IndexedArchiveTilesetSource} from './tileset-3d/common/indexed-archive-tileset-source';
|
|
23
30
|
export {Tile3D} from './tileset-3d/common/tile-3d';
|
|
31
|
+
export type {
|
|
32
|
+
Tile3DContent,
|
|
33
|
+
Tile3DFeatureIdSet,
|
|
34
|
+
Tile3DMetadataContext,
|
|
35
|
+
Tile3DBoundingVolume
|
|
36
|
+
} from './tileset-3d/common/tile-3d-contracts';
|
|
24
37
|
export type {TileChildrenState} from './tileset-3d/common/tile-3d';
|
|
25
38
|
export {Tiles3DSource} from './tileset-3d/format-3d-tiles/tiles-3d-source';
|
|
26
39
|
export type {ImplicitTilingStats} from './tileset-3d/format-3d-tiles/tiles-3d-source';
|
|
@@ -101,6 +114,8 @@ export {PointCloudTileset} from './point-cloud/point-cloud-tileset';
|
|
|
101
114
|
export {PointCloudTile} from './point-cloud/point-cloud-tile';
|
|
102
115
|
export {createBoundingVolume} from './tileset-3d/helpers/bounding-volume';
|
|
103
116
|
export {calculateTransformProps} from './tileset-3d/helpers/transform-utils';
|
|
117
|
+
export {convertS2BoundingVolumeToOBB} from './tileset-3d/helpers/s2-bounding-volume';
|
|
118
|
+
export type {S2VolumeInfo} from './tileset-3d/helpers/s2-bounding-volume';
|
|
104
119
|
|
|
105
120
|
export type {
|
|
106
121
|
CreateTilesetSpatialReferenceOptions,
|
|
@@ -128,6 +143,8 @@ export {
|
|
|
128
143
|
} from './spatial/format-spatial-reference';
|
|
129
144
|
export {SpatialCoordinateTransformer} from './spatial/spatial-coordinate-transformer';
|
|
130
145
|
export {getSpatialCoordinateFrame} from './spatial/spatial-coordinate-transformer';
|
|
146
|
+
export {Tiles3DSpatialTransformer} from './spatial/tiles-3d-spatial-transformer';
|
|
147
|
+
export type {Tiles3DSpatialBoundingVolume} from './spatial/tiles-3d-spatial-transformer';
|
|
131
148
|
export type {
|
|
132
149
|
I3SSpatialBounds,
|
|
133
150
|
I3SSpatialObb,
|
|
@@ -143,7 +160,7 @@ export {
|
|
|
143
160
|
} from './spatial/spatial-resource-registry';
|
|
144
161
|
|
|
145
162
|
export {getFrameState} from './tileset-3d/helpers/frame-state';
|
|
146
|
-
export type {GetFrameStateOptions} from './tileset-3d/helpers/frame-state';
|
|
163
|
+
export type {FrameState, GetFrameStateOptions} from './tileset-3d/helpers/frame-state';
|
|
147
164
|
export {getLodStatus} from './tileset-3d/helpers/i3s-lod';
|
|
148
165
|
|
|
149
166
|
export {
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import type {ReadonlyCRSDefinition} from '@math.gl/crs';
|
|
6
6
|
import {getI3SLinearUnitScale, getI3SVerticalUnitScale} from './i3s-elevation';
|
|
7
|
+
import {
|
|
8
|
+
getKnownCrsIdentifierCoordinateFrame,
|
|
9
|
+
getSpatialCoordinateFrame
|
|
10
|
+
} from './get-spatial-coordinate-frame';
|
|
7
11
|
import {createTilesetSpatialReference} from './spatial-types';
|
|
8
12
|
import type {TilesetElevationMode, TilesetSpatialReference} from './spatial-types';
|
|
9
13
|
|
|
@@ -40,6 +44,7 @@ type Tiles3DLike = {
|
|
|
40
44
|
schemaUri?: string;
|
|
41
45
|
metadata?: {class?: string; properties?: Record<string, unknown>};
|
|
42
46
|
root?: {boundingVolume?: {region?: unknown}};
|
|
47
|
+
extensions?: Record<string, unknown>;
|
|
43
48
|
};
|
|
44
49
|
|
|
45
50
|
/**
|
|
@@ -68,8 +73,10 @@ export function getI3SSpatialReference(layer: I3SLayerLike): TilesetSpatialRefer
|
|
|
68
73
|
const sourceIdentifier = getCrsIdentifier(spatialReference);
|
|
69
74
|
const coordinateFrame =
|
|
70
75
|
sourceIdentifier === undefined
|
|
71
|
-
?
|
|
72
|
-
|
|
76
|
+
? sourceCrs
|
|
77
|
+
? getSpatialCoordinateFrame(sourceCrs)
|
|
78
|
+
: 'unknown'
|
|
79
|
+
: getSpatialCoordinateFrame(`EPSG:${sourceIdentifier}`);
|
|
73
80
|
const units = getI3SCoordinateUnits(coordinateFrame, verticalUnit, layer.ZFactor);
|
|
74
81
|
const warnings: string[] = [];
|
|
75
82
|
const elevationMode = getI3SElevationMode(layer.elevationInfo?.mode);
|
|
@@ -159,6 +166,10 @@ function getI3SElevationMode(mode: string | undefined): TilesetElevationMode | u
|
|
|
159
166
|
* @returns Normalized source spatial metadata.
|
|
160
167
|
*/
|
|
161
168
|
export function get3DTilesSpatialReference(tileset: Tiles3DLike): TilesetSpatialReference {
|
|
169
|
+
const draftSpatialReference = getDraft3DTilesSpatialReference(tileset);
|
|
170
|
+
if (draftSpatialReference) {
|
|
171
|
+
return draftSpatialReference;
|
|
172
|
+
}
|
|
162
173
|
const geocentricCrs = getTilesetSemanticValue(tileset, 'TILESET_CRS_GEOCENTRIC');
|
|
163
174
|
const coordinateEpoch = getTilesetSemanticValue(tileset, 'TILESET_CRS_COORDINATE_EPOCH');
|
|
164
175
|
const warnings: string[] = [];
|
|
@@ -202,6 +213,120 @@ export function get3DTilesSpatialReference(tileset: Tiles3DLike): TilesetSpatial
|
|
|
202
213
|
});
|
|
203
214
|
}
|
|
204
215
|
|
|
216
|
+
/** Resolves the draft glTF EXT_geospatial_crs WKID or WKT2 declaration. */
|
|
217
|
+
function getDraft3DTilesSpatialReference(
|
|
218
|
+
tileset: Tiles3DLike
|
|
219
|
+
): TilesetSpatialReference | undefined {
|
|
220
|
+
const extension = tileset.extensions?.EXT_geospatial_crs as
|
|
221
|
+
| {format?: unknown; extensions?: Record<string, unknown>}
|
|
222
|
+
| undefined;
|
|
223
|
+
if (!extension) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
const warnings: string[] = [];
|
|
227
|
+
let sourceCrs: ReadonlyCRSDefinition | undefined;
|
|
228
|
+
let verticalCrs: ReadonlyCRSDefinition | undefined;
|
|
229
|
+
let epoch: number | undefined;
|
|
230
|
+
let representation: 'identifier' | 'wkt' | undefined;
|
|
231
|
+
if (extension.format === 'wkid') {
|
|
232
|
+
const wkidExtension = extension.extensions?.EXT_geospatial_crs_wkid as
|
|
233
|
+
| {authority?: unknown; wkid?: unknown; vcsWkid?: unknown; epoch?: unknown}
|
|
234
|
+
| undefined;
|
|
235
|
+
if (typeof wkidExtension?.authority === 'string' && Number.isInteger(wkidExtension.wkid)) {
|
|
236
|
+
sourceCrs = `${wkidExtension.authority}:${wkidExtension.wkid}`;
|
|
237
|
+
representation = 'identifier';
|
|
238
|
+
if (Number.isInteger(wkidExtension.vcsWkid)) {
|
|
239
|
+
verticalCrs = `${wkidExtension.authority}:${wkidExtension.vcsWkid}`;
|
|
240
|
+
}
|
|
241
|
+
epoch = parseCoordinateEpoch(wkidExtension.epoch);
|
|
242
|
+
if (wkidExtension.epoch !== undefined && epoch === undefined) {
|
|
243
|
+
warnings.push('EXT_geospatial_crs_wkid epoch is not a finite decimal year');
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
warnings.push('EXT_geospatial_crs_wkid requires string authority and integer wkid');
|
|
247
|
+
}
|
|
248
|
+
} else if (extension.format === 'wkt2') {
|
|
249
|
+
const wktExtension = extension.extensions?.EXT_geospatial_crs_wkt2 as
|
|
250
|
+
| {wkt2?: unknown}
|
|
251
|
+
| undefined;
|
|
252
|
+
if (typeof wktExtension?.wkt2 === 'string' && wktExtension.wkt2.trim()) {
|
|
253
|
+
sourceCrs = wktExtension.wkt2;
|
|
254
|
+
representation = 'wkt';
|
|
255
|
+
} else {
|
|
256
|
+
warnings.push('EXT_geospatial_crs_wkt2 requires a nonempty wkt2 string');
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
warnings.push(`Unsupported EXT_geospatial_crs format ${String(extension.format)}`);
|
|
260
|
+
}
|
|
261
|
+
const coordinateFrame =
|
|
262
|
+
representation === 'wkt'
|
|
263
|
+
? getSpatialCoordinateFrame(sourceCrs as string)
|
|
264
|
+
: getKnownCrsIdentifierCoordinateFrame(sourceCrs) || 'unknown';
|
|
265
|
+
const verticalSemantics = getDraftVerticalCrsSemantics(verticalCrs);
|
|
266
|
+
if (verticalCrs && !verticalSemantics) {
|
|
267
|
+
warnings.push(
|
|
268
|
+
`Unsupported vertical CRS ${String(verticalCrs)}; vertical unit and height reference are unknown`
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
const verticalUnit = verticalCrs ? verticalSemantics?.unit : 'meter';
|
|
272
|
+
return createTilesetSpatialReference({
|
|
273
|
+
sourceCrs,
|
|
274
|
+
sourceCrsState: sourceCrs ? 'explicit' : 'unknown',
|
|
275
|
+
sourceCrsRepresentation: representation,
|
|
276
|
+
verticalCrs,
|
|
277
|
+
coordinateEpoch: epoch,
|
|
278
|
+
units:
|
|
279
|
+
coordinateFrame === 'geocentric'
|
|
280
|
+
? ['meter', 'meter', 'meter']
|
|
281
|
+
: coordinateFrame === 'geographic' && verticalUnit
|
|
282
|
+
? ['degree', 'degree', verticalUnit]
|
|
283
|
+
: undefined,
|
|
284
|
+
verticalUnitScale: verticalCrs ? (verticalSemantics?.verticalUnitScale ?? Number.NaN) : 1,
|
|
285
|
+
heightReference: verticalCrs
|
|
286
|
+
? (verticalSemantics?.heightReference ?? 'unknown')
|
|
287
|
+
: sourceCrs
|
|
288
|
+
? 'ellipsoidal'
|
|
289
|
+
: 'unknown',
|
|
290
|
+
coordinateFrame,
|
|
291
|
+
axisOrder: sourceCrs ? 'xyz' : 'unknown',
|
|
292
|
+
provenance: 'metadata',
|
|
293
|
+
warnings
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Known vertical CRS semantics needed to interpret draft 3D Tiles height values. */
|
|
298
|
+
type DraftVerticalCrsSemantics = {
|
|
299
|
+
unit: string;
|
|
300
|
+
verticalUnitScale: number;
|
|
301
|
+
heightReference: 'orthometric';
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/** Resolves vertical units and height interpretation for known EPSG vertical CRSs. */
|
|
305
|
+
function getDraftVerticalCrsSemantics(
|
|
306
|
+
verticalCrs: ReadonlyCRSDefinition | undefined
|
|
307
|
+
): DraftVerticalCrsSemantics | undefined {
|
|
308
|
+
if (typeof verticalCrs !== 'string') {
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
const epsgMatch = /^EPSG:(\d+)$/i.exec(verticalCrs);
|
|
312
|
+
if (!epsgMatch) {
|
|
313
|
+
return undefined;
|
|
314
|
+
}
|
|
315
|
+
switch (Number(epsgMatch[1])) {
|
|
316
|
+
case 5702: // NGVD29 height (ftUS)
|
|
317
|
+
case 6360: // NAVD88 height (ftUS)
|
|
318
|
+
return {
|
|
319
|
+
unit: 'us-foot',
|
|
320
|
+
verticalUnitScale: 1200 / 3937,
|
|
321
|
+
heightReference: 'orthometric'
|
|
322
|
+
};
|
|
323
|
+
case 5703: // NAVD88 height
|
|
324
|
+
return {unit: 'meter', verticalUnitScale: 1, heightReference: 'orthometric'};
|
|
325
|
+
default:
|
|
326
|
+
return undefined;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
205
330
|
/** Parse the 3D Tiles decimal-year string while tolerating legacy numeric producer output. */
|
|
206
331
|
function parseCoordinateEpoch(value: unknown): number | undefined {
|
|
207
332
|
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
@@ -238,57 +363,6 @@ function getCrsIdentifier(spatialReference?: I3SSpatialReferenceLike): number |
|
|
|
238
363
|
return spatialReference?.latestWkid ?? spatialReference?.wkid;
|
|
239
364
|
}
|
|
240
365
|
|
|
241
|
-
/** Classify common EPSG identifiers used by I3S into their coordinate frames. */
|
|
242
|
-
function getIdentifierCoordinateFrame(
|
|
243
|
-
identifier: number
|
|
244
|
-
): TilesetSpatialReference['coordinateFrame'] {
|
|
245
|
-
if (identifier === 4978) {
|
|
246
|
-
return 'geocentric';
|
|
247
|
-
}
|
|
248
|
-
if (identifier === 4326 || identifier === 4490 || identifier === 4979) {
|
|
249
|
-
return 'geographic';
|
|
250
|
-
}
|
|
251
|
-
return 'projected';
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Classify a WKT root coordinate system without guessing when the declaration is ambiguous.
|
|
256
|
-
*
|
|
257
|
-
* WKT2 uses `GEODCRS` for both geographic and geocentric systems, so its `CS` declaration is
|
|
258
|
-
* inspected before assigning a frame.
|
|
259
|
-
*/
|
|
260
|
-
function getWktCoordinateFrame(wkt?: string): TilesetSpatialReference['coordinateFrame'] {
|
|
261
|
-
if (!wkt) {
|
|
262
|
-
return 'unknown';
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const normalizedWkt = wkt.trim().toUpperCase();
|
|
266
|
-
const rootKeyword = normalizedWkt.match(/^([A-Z][A-Z0-9_]*)\s*[\[(]/)?.[1];
|
|
267
|
-
if (rootKeyword === 'GEOCCS') {
|
|
268
|
-
return 'geocentric';
|
|
269
|
-
}
|
|
270
|
-
if (
|
|
271
|
-
rootKeyword === 'GEOGCS' ||
|
|
272
|
-
rootKeyword === 'GEOGRAPHICCRS' ||
|
|
273
|
-
rootKeyword === 'GEOGRAPHIC2DCRS' ||
|
|
274
|
-
rootKeyword === 'GEOGRAPHIC3DCRS'
|
|
275
|
-
) {
|
|
276
|
-
return 'geographic';
|
|
277
|
-
}
|
|
278
|
-
if (rootKeyword === 'PROJCS' || rootKeyword === 'PROJCRS' || rootKeyword === 'PROJECTEDCRS') {
|
|
279
|
-
return 'projected';
|
|
280
|
-
}
|
|
281
|
-
if (rootKeyword === 'GEODCRS' || rootKeyword === 'GEODETICCRS') {
|
|
282
|
-
if (/\bCS\s*[\[(]\s*CARTESIAN\s*,\s*3\b/.test(normalizedWkt)) {
|
|
283
|
-
return 'geocentric';
|
|
284
|
-
}
|
|
285
|
-
if (/\bCS\s*[\[(]\s*ELLIPSOIDAL\s*,\s*[23]\b/.test(normalizedWkt)) {
|
|
286
|
-
return 'geographic';
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return 'unknown';
|
|
290
|
-
}
|
|
291
|
-
|
|
292
366
|
/** Resolve a tileset-wide structured metadata property by its standard semantic. */
|
|
293
367
|
function getTilesetSemanticValue(tileset: Tiles3DLike, semantic: string): unknown {
|
|
294
368
|
const classIdentifier = tileset.metadata?.class;
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
5
|
+
import {
|
|
6
|
+
inferCRSRepresentation,
|
|
7
|
+
parsePROJString,
|
|
8
|
+
parseWKTCRS,
|
|
9
|
+
type ReadonlyCRSDefinition,
|
|
10
|
+
type SpatialReferenceCoordinateFrame,
|
|
11
|
+
type WKTCRSNode
|
|
12
|
+
} from '@math.gl/crs';
|
|
13
|
+
import {
|
|
14
|
+
normalizeCrsIdentifier,
|
|
15
|
+
WGS84_GEOCENTRIC_CRS,
|
|
16
|
+
WGS84_GEOGRAPHIC_CRS
|
|
17
|
+
} from './normalize-crs-identifier';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Classify a CRS definition into the broad coordinate frame used by 3D format adapters.
|
|
@@ -26,25 +26,14 @@ export function getSpatialCoordinateFrame(
|
|
|
26
26
|
definition: ReadonlyCRSDefinition
|
|
27
27
|
): SpatialReferenceCoordinateFrame {
|
|
28
28
|
if (typeof definition === 'string') {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
return
|
|
29
|
+
const representation = inferCRSRepresentation(definition);
|
|
30
|
+
if (representation === 'wkt') {
|
|
31
|
+
return getWktCoordinateFrame(definition);
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
normalized === 'EPSG:4490' ||
|
|
36
|
-
normalized === 'EPSG:4979' ||
|
|
37
|
-
normalized === 'OGC:CRS84' ||
|
|
38
|
-
normalized.includes('+PROJ=LONGLAT') ||
|
|
39
|
-
normalized.includes('+PROJ=LATLONG') ||
|
|
40
|
-
/^(?:GEOGCS|GEOGCRS|GEOGRAPHICCRS|GEOGRAPHIC2DCRS|GEOGRAPHIC3DCRS)\s*[\[(]/.test(normalized)
|
|
41
|
-
) {
|
|
42
|
-
return 'geographic';
|
|
33
|
+
if (representation === 'proj-string') {
|
|
34
|
+
return getProjStringCoordinateFrame(definition);
|
|
43
35
|
}
|
|
44
|
-
|
|
45
|
-
return /CS\s*[\[(]\s*CARTESIAN/.test(normalized) ? 'geocentric' : 'geographic';
|
|
46
|
-
}
|
|
47
|
-
return 'projected';
|
|
36
|
+
return getKnownCrsIdentifierCoordinateFrame(definition) || 'projected';
|
|
48
37
|
}
|
|
49
38
|
|
|
50
39
|
const projJsonDefinition = definition as {
|
|
@@ -70,5 +59,111 @@ export function getSpatialCoordinateFrame(
|
|
|
70
59
|
? 'geocentric'
|
|
71
60
|
: 'geographic';
|
|
72
61
|
}
|
|
73
|
-
return '
|
|
62
|
+
return 'unknown';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Classifies authority identifiers for which the tiles runtime has explicit frame knowledge.
|
|
67
|
+
*
|
|
68
|
+
* Unlike {@link getSpatialCoordinateFrame}, this function does not assume that an unrecognized
|
|
69
|
+
* authority identifier is projected. Draft formats use this strict result to avoid inventing
|
|
70
|
+
* semantics for unknown authorities or registry codes.
|
|
71
|
+
*
|
|
72
|
+
* @param definition - Serialized CRS identifier.
|
|
73
|
+
* @returns A known frame, or `undefined` when registry semantics are unavailable.
|
|
74
|
+
*/
|
|
75
|
+
export function getKnownCrsIdentifierCoordinateFrame(
|
|
76
|
+
definition: ReadonlyCRSDefinition | undefined
|
|
77
|
+
): SpatialReferenceCoordinateFrame | undefined {
|
|
78
|
+
if (typeof definition !== 'string') {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const normalized = normalizeCrsIdentifier(definition);
|
|
82
|
+
if (normalized === WGS84_GEOCENTRIC_CRS) {
|
|
83
|
+
return 'geocentric';
|
|
84
|
+
}
|
|
85
|
+
if (normalized === WGS84_GEOGRAPHIC_CRS || normalized === 'OGC:CRS84') {
|
|
86
|
+
return 'geographic';
|
|
87
|
+
}
|
|
88
|
+
const epsgMatch = /^EPSG:(\d+)$/.exec(normalized);
|
|
89
|
+
if (!epsgMatch) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const identifier = Number(epsgMatch[1]);
|
|
93
|
+
if (identifier === 7789) {
|
|
94
|
+
return 'geocentric';
|
|
95
|
+
}
|
|
96
|
+
if (identifier === 4490 || identifier === 4979) {
|
|
97
|
+
return 'geographic';
|
|
98
|
+
}
|
|
99
|
+
if (
|
|
100
|
+
identifier === 3857 ||
|
|
101
|
+
(identifier >= 32601 && identifier <= 32660) ||
|
|
102
|
+
(identifier >= 32701 && identifier <= 32760)
|
|
103
|
+
) {
|
|
104
|
+
return 'projected';
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Classifies a WKT definition using the syntax tree parsed by `@math.gl/crs`. */
|
|
110
|
+
function getWktCoordinateFrame(definition: string): SpatialReferenceCoordinateFrame {
|
|
111
|
+
let root: WKTCRSNode;
|
|
112
|
+
try {
|
|
113
|
+
root = parseWKTCRS(definition).root;
|
|
114
|
+
} catch {
|
|
115
|
+
return 'unknown';
|
|
116
|
+
}
|
|
117
|
+
switch (root.keyword.toUpperCase()) {
|
|
118
|
+
case 'GEOCCS':
|
|
119
|
+
return 'geocentric';
|
|
120
|
+
case 'GEOGCS':
|
|
121
|
+
case 'GEOGCRS':
|
|
122
|
+
case 'GEOGRAPHICCRS':
|
|
123
|
+
case 'GEOGRAPHIC2DCRS':
|
|
124
|
+
case 'GEOGRAPHIC3DCRS':
|
|
125
|
+
return 'geographic';
|
|
126
|
+
case 'PROJCS':
|
|
127
|
+
case 'PROJCRS':
|
|
128
|
+
case 'PROJECTEDCRS':
|
|
129
|
+
return 'projected';
|
|
130
|
+
case 'GEODCRS':
|
|
131
|
+
case 'GEODETICCRS': {
|
|
132
|
+
const coordinateSystem = root.values.find(
|
|
133
|
+
(value): value is WKTCRSNode =>
|
|
134
|
+
value.type === 'node' && value.keyword.toUpperCase() === 'CS'
|
|
135
|
+
);
|
|
136
|
+
const subtype = coordinateSystem?.values[0];
|
|
137
|
+
if (subtype?.type !== 'enumeration' && subtype?.type !== 'string') {
|
|
138
|
+
return 'unknown';
|
|
139
|
+
}
|
|
140
|
+
return subtype.value.toUpperCase() === 'CARTESIAN'
|
|
141
|
+
? 'geocentric'
|
|
142
|
+
: subtype.value.toUpperCase() === 'ELLIPSOIDAL'
|
|
143
|
+
? 'geographic'
|
|
144
|
+
: 'unknown';
|
|
145
|
+
}
|
|
146
|
+
default:
|
|
147
|
+
return 'unknown';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Classifies a PROJ string using the syntax tree parsed by `@math.gl/crs`. */
|
|
152
|
+
function getProjStringCoordinateFrame(definition: string): SpatialReferenceCoordinateFrame {
|
|
153
|
+
try {
|
|
154
|
+
const projection = parsePROJString(definition).parameters.find(
|
|
155
|
+
parameter => parameter.name.toLowerCase() === 'proj'
|
|
156
|
+
)?.value;
|
|
157
|
+
switch (projection?.toLowerCase()) {
|
|
158
|
+
case 'longlat':
|
|
159
|
+
case 'latlong':
|
|
160
|
+
return 'geographic';
|
|
161
|
+
case 'geocent':
|
|
162
|
+
return 'geocentric';
|
|
163
|
+
default:
|
|
164
|
+
return projection ? 'projected' : 'unknown';
|
|
165
|
+
}
|
|
166
|
+
} catch {
|
|
167
|
+
return 'unknown';
|
|
168
|
+
}
|
|
74
169
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/** Compact identifier for conventional WGS84 longitude/latitude coordinates. */
|
|
6
|
+
export const WGS84_GEOGRAPHIC_CRS = 'EPSG:4326';
|
|
7
|
+
|
|
8
|
+
/** Compact identifier for WGS84 Earth-centered, Earth-fixed coordinates. */
|
|
9
|
+
export const WGS84_GEOCENTRIC_CRS = 'EPSG:4978';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes common OGC URL and URN CRS spellings to compact authority identifiers.
|
|
13
|
+
*
|
|
14
|
+
* This intentionally performs syntax normalization only. Authority lookup and semantic
|
|
15
|
+
* equivalence remain outside the scope of `@math.gl/crs` and the tiles runtime.
|
|
16
|
+
*
|
|
17
|
+
* @param identifier - Serialized CRS identifier.
|
|
18
|
+
* @returns Uppercase compact identifier when an OGC spelling is recognized.
|
|
19
|
+
*/
|
|
20
|
+
export function normalizeCrsIdentifier(identifier: string): string {
|
|
21
|
+
const normalizedIdentifier = identifier.trim().toUpperCase();
|
|
22
|
+
const ogcMatch = normalizedIdentifier.match(
|
|
23
|
+
/(?:\/DEF\/CRS\/|URN:OGC:DEF:CRS:)([A-Z0-9_-]+)(?:\/|::)(?:[^/:]*[/:])?([A-Z0-9_.-]+)$/
|
|
24
|
+
);
|
|
25
|
+
return ogcMatch ? `${ogcMatch[1]}:${ogcMatch[2]}` : normalizedIdentifier;
|
|
26
|
+
}
|