@loaders.gl/tile-converter 5.0.0-alpha.1 → 5.0.0-alpha.11

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 (141) hide show
  1. package/LICENSE +14 -3
  2. package/README.md +497 -0
  3. package/dist/converter.min.cjs +210 -282
  4. package/dist/i3s-server/bin/i3s-server.min.cjs +106 -341
  5. package/dist/index.cjs +38586 -0
  6. package/dist/index.js +38557 -0
  7. package/dist/v5/adapters.cjs +3548 -0
  8. package/dist/v5/adapters.d.ts +33 -0
  9. package/dist/v5/adapters.js +3537 -0
  10. package/dist/v5/browser-sink.d.ts +37 -0
  11. package/dist/v5/browser-source.d.ts +38 -0
  12. package/dist/v5/browser-tileset-source.d.ts +70 -0
  13. package/dist/v5/browser.cjs +76 -0
  14. package/dist/v5/browser.d.ts +44 -0
  15. package/dist/v5/browser.js +75 -0
  16. package/dist/v5/conversion-api.d.ts +122 -0
  17. package/dist/v5/conversion-archive.d.ts +32 -0
  18. package/dist/v5/core.cjs +917 -0
  19. package/dist/v5/core.d.ts +16 -0
  20. package/dist/v5/core.js +899 -0
  21. package/dist/v5/feature-arrow.d.ts +36 -0
  22. package/dist/v5/i3s-mesh-conversion.d.ts +32 -0
  23. package/dist/v5/i3s-mesh-sink.d.ts +25 -0
  24. package/dist/v5/i3s-mesh-source-features.d.ts +13 -0
  25. package/dist/v5/i3s-mesh-source-material.d.ts +5 -0
  26. package/dist/v5/i3s-mesh-source.d.ts +30 -0
  27. package/dist/v5/index.cjs +73 -0
  28. package/dist/v5/index.d.ts +40 -0
  29. package/dist/v5/index.js +75 -0
  30. package/dist/v5/mesh-conversion.d.ts +71 -0
  31. package/dist/v5/mesh-draco.d.ts +8 -0
  32. package/dist/v5/mesh-features.d.ts +9 -0
  33. package/dist/v5/mesh-source-features.d.ts +21 -0
  34. package/dist/v5/mesh-source-texture.d.ts +6 -0
  35. package/dist/v5/mesh-source.d.ts +41 -0
  36. package/dist/v5/mesh-tileset-archive.d.ts +18 -0
  37. package/dist/v5/mesh-tileset-sink.d.ts +51 -0
  38. package/dist/v5/mesh.d.ts +86 -0
  39. package/dist/v5/point-cloud-conversion.d.ts +31 -0
  40. package/dist/v5/point-cloud-source-encoder.d.ts +46 -0
  41. package/dist/v5/point-cloud-source.d.ts +25 -0
  42. package/dist/v5/point-cloud-spatial.d.ts +22 -0
  43. package/dist/v5/point-cloud-tileset-sink.d.ts +28 -0
  44. package/dist/v5/point-cloud.d.ts +49 -0
  45. package/dist/v5/resource-fetcher.d.ts +18 -0
  46. package/dist/v5/resource-manifest.d.ts +58 -0
  47. package/dist/v5/spatial-conversion.d.ts +61 -0
  48. package/dist/v5/tileset-source.d.ts +21 -0
  49. package/package.json +52 -26
  50. package/src/common/README.md +5 -0
  51. package/src/index.ts +1 -2
  52. package/src/{3d-tiles-converter → v4/3d-tiles-converter}/3d-tiles-converter.ts +13 -2
  53. package/src/v4/3d-tiles-converter/helpers/validate-i3s-spatial-reference.ts +124 -0
  54. package/src/{deps-installer → v4/deps-installer}/deps-installer.ts +10 -7
  55. package/src/{i3s-converter → v4/i3s-converter}/helpers/batch-ids-extensions.ts +1 -1
  56. package/src/v4/i3s-converter/helpers/encode-string-attribute.ts +23 -0
  57. package/src/{i3s-converter → v4/i3s-converter}/helpers/geometry-converter.ts +30 -55
  58. package/src/{i3s-converter → v4/i3s-converter}/helpers/gltf-attributes.ts +5 -4
  59. package/src/{i3s-converter → v4/i3s-converter}/helpers/load-3d-tiles.ts +5 -9
  60. package/src/{i3s-converter → v4/i3s-converter}/i3s-converter.ts +6 -7
  61. package/src/{i3s-server → v4/i3s-server}/README.md +2 -2
  62. package/src/{i3s-server → v4/i3s-server}/routes/slpk-router.ts +1 -0
  63. package/src/v4/index.ts +2 -0
  64. package/src/{lib → v4/lib}/utils/compress-util.ts +8 -7
  65. package/src/v5/adapters.ts +75 -0
  66. package/src/v5/browser-sink.ts +130 -0
  67. package/src/v5/browser-source.ts +155 -0
  68. package/src/v5/browser-tileset-source.ts +328 -0
  69. package/src/v5/browser.ts +139 -0
  70. package/src/v5/conversion-api.ts +287 -0
  71. package/src/v5/conversion-archive.ts +85 -0
  72. package/src/v5/core.ts +61 -0
  73. package/src/v5/feature-arrow.ts +429 -0
  74. package/src/v5/i3s-mesh-conversion.ts +192 -0
  75. package/src/v5/i3s-mesh-sink.ts +351 -0
  76. package/src/v5/i3s-mesh-source-features.ts +279 -0
  77. package/src/v5/i3s-mesh-source-material.ts +157 -0
  78. package/src/v5/i3s-mesh-source.ts +227 -0
  79. package/src/v5/index.ts +131 -0
  80. package/src/v5/mesh-conversion.ts +230 -0
  81. package/src/v5/mesh-draco.ts +182 -0
  82. package/src/v5/mesh-features.ts +319 -0
  83. package/src/v5/mesh-source-features.ts +263 -0
  84. package/src/v5/mesh-source-texture.ts +169 -0
  85. package/src/v5/mesh-source.ts +422 -0
  86. package/src/v5/mesh-tileset-archive.ts +50 -0
  87. package/src/v5/mesh-tileset-sink.ts +324 -0
  88. package/src/v5/mesh.ts +526 -0
  89. package/src/v5/point-cloud-conversion.ts +88 -0
  90. package/src/v5/point-cloud-source-encoder.ts +116 -0
  91. package/src/v5/point-cloud-source.ts +84 -0
  92. package/src/v5/point-cloud-spatial.ts +280 -0
  93. package/src/v5/point-cloud-tileset-sink.ts +234 -0
  94. package/src/v5/point-cloud.ts +398 -0
  95. package/src/v5/resource-fetcher.ts +110 -0
  96. package/src/v5/resource-manifest.ts +213 -0
  97. package/src/v5/spatial-conversion.ts +389 -0
  98. package/src/v5/tileset-source.ts +54 -0
  99. /package/src/{3d-tiles-converter → v4/3d-tiles-converter}/helpers/3d-tiles-content-converter.ts +0 -0
  100. /package/src/{3d-tiles-converter → v4/3d-tiles-converter}/helpers/i3s-obb-to-3d-tiles-obb.ts +0 -0
  101. /package/src/{3d-tiles-converter → v4/3d-tiles-converter}/helpers/load-i3s.ts +0 -0
  102. /package/src/{3d-tiles-converter → v4/3d-tiles-converter}/helpers/texture-atlas.ts +0 -0
  103. /package/src/{3d-tiles-converter → v4/3d-tiles-converter}/json-templates/tileset.ts +0 -0
  104. /package/src/{constants.ts → v4/constants.ts} +0 -0
  105. /package/src/{converter-cli.ts → v4/converter-cli.ts} +0 -0
  106. /package/src/{i3s-converter → v4/i3s-converter}/helpers/attribute-metadata-info.ts +0 -0
  107. /package/src/{i3s-converter → v4/i3s-converter}/helpers/coordinate-converter.ts +0 -0
  108. /package/src/{i3s-converter → v4/i3s-converter}/helpers/create-scene-server-path.ts +0 -0
  109. /package/src/{i3s-converter → v4/i3s-converter}/helpers/feature-attributes.ts +0 -0
  110. /package/src/{i3s-converter → v4/i3s-converter}/helpers/geometry-attributes.ts +0 -0
  111. /package/src/{i3s-converter → v4/i3s-converter}/helpers/node-debug.ts +0 -0
  112. /package/src/{i3s-converter → v4/i3s-converter}/helpers/node-index-document.ts +0 -0
  113. /package/src/{i3s-converter → v4/i3s-converter}/helpers/node-pages.ts +0 -0
  114. /package/src/{i3s-converter → v4/i3s-converter}/helpers/preprocess-3d-tiles.ts +0 -0
  115. /package/src/{i3s-converter → v4/i3s-converter}/helpers/progress.ts +0 -0
  116. /package/src/{i3s-converter → v4/i3s-converter}/helpers/tileset-traversal.ts +0 -0
  117. /package/src/{i3s-converter → v4/i3s-converter}/json-templates/geometry-definitions.ts +0 -0
  118. /package/src/{i3s-converter → v4/i3s-converter}/json-templates/layers.ts +0 -0
  119. /package/src/{i3s-converter → v4/i3s-converter}/json-templates/metadata.ts +0 -0
  120. /package/src/{i3s-converter → v4/i3s-converter}/json-templates/node.ts +0 -0
  121. /package/src/{i3s-converter → v4/i3s-converter}/json-templates/scene-server.ts +0 -0
  122. /package/src/{i3s-converter → v4/i3s-converter}/json-templates/shared-resources.ts +0 -0
  123. /package/src/{i3s-converter → v4/i3s-converter}/json-templates/store.ts +0 -0
  124. /package/src/{i3s-converter → v4/i3s-converter}/types.ts +0 -0
  125. /package/src/{i3s-server → v4/i3s-server}/app.ts +0 -0
  126. /package/src/{i3s-server → v4/i3s-server}/bin/www.ts +0 -0
  127. /package/src/{i3s-server → v4/i3s-server}/certs/cert.pem +0 -0
  128. /package/src/{i3s-server → v4/i3s-server}/certs/key.pem +0 -0
  129. /package/src/{i3s-server → v4/i3s-server}/controllers/slpk-controller.ts +0 -0
  130. /package/src/{i3s-server → v4/i3s-server}/utils/create-scene-server.ts +0 -0
  131. /package/src/{i3s-server → v4/i3s-server}/utils/server-utils.ts +0 -0
  132. /package/src/{lib → v4/lib}/json-schemas/conversion-dump-json-schema.ts +0 -0
  133. /package/src/{lib → v4/lib}/utils/cli-utils.ts +0 -0
  134. /package/src/{lib → v4/lib}/utils/conversion-dump.ts +0 -0
  135. /package/src/{lib → v4/lib}/utils/file-utils.ts +0 -0
  136. /package/src/{lib → v4/lib}/utils/geometry-utils.ts +0 -0
  137. /package/src/{lib → v4/lib}/utils/lod-conversion-utils.ts +0 -0
  138. /package/src/{lib → v4/lib}/utils/queue.ts +0 -0
  139. /package/src/{lib → v4/lib}/utils/statistic-utils.ts +0 -0
  140. /package/src/{lib → v4/lib}/utils/write-queue.ts +0 -0
  141. /package/src/{pgm-loader.ts → v4/pgm-loader.ts} +0 -0
@@ -0,0 +1,86 @@
1
+ import { GLTFScenegraph } from '@loaders.gl/gltf';
2
+ import type { MeshAttribute, MeshGeometry } from '@loaders.gl/schema';
3
+ import { type MeshTileFeatures } from './mesh-features.js';
4
+ /** Explicit glTF wrapping and filtering for the selected base-color image. */
5
+ export interface MeshTileSampler {
6
+ /** Horizontal wrapping: CLAMP_TO_EDGE, MIRRORED_REPEAT, or REPEAT; omitted values use REPEAT. */
7
+ readonly wrapS?: 33071 | 33648 | 10497;
8
+ /** Vertical wrapping: CLAMP_TO_EDGE, MIRRORED_REPEAT, or REPEAT; omitted values use REPEAT. */
9
+ readonly wrapT?: 33071 | 33648 | 10497;
10
+ /** Magnification: NEAREST or LINEAR; omission leaves filtering to the renderer. */
11
+ readonly magFilter?: 9728 | 9729;
12
+ /** Minification: NEAREST, LINEAR, or a glTF mipmap filter; omission leaves filtering to the renderer. */
13
+ readonly minFilter?: 9728 | 9729 | 9984 | 9985 | 9986 | 9987;
14
+ }
15
+ /** Selected KHR_texture_transform controls for TEXCOORD_0. */
16
+ export interface MeshTileTextureTransform {
17
+ /** Finite UV translation; omitted values use [0, 0]. */
18
+ readonly offset?: readonly [number, number];
19
+ /** Finite counterclockwise rotation in radians around the UV origin; omission uses 0. */
20
+ readonly rotation?: number;
21
+ /** Finite UV scale; zero and negative values are allowed, and omission uses [1, 1]. */
22
+ readonly scale?: readonly [number, number];
23
+ }
24
+ /** One already encoded base-color image using TEXCOORD_0. */
25
+ export interface MeshTileTexture {
26
+ /** Encoded PNG/JPEG bytes; a typed array subview selects only its own bytes. */
27
+ readonly data: Uint8Array;
28
+ /** Declared image format, checked against the encoded header. */
29
+ readonly mimeType: 'image/png' | 'image/jpeg';
30
+ /** Optional wrapping/filtering; omission retains glTF's implicit sampler. */
31
+ readonly sampler?: MeshTileSampler;
32
+ /** Optional UV transform, preserved as a required KHR_texture_transform extension. */
33
+ readonly transform?: MeshTileTextureTransform;
34
+ }
35
+ /** One glTF metallic-roughness material, shared by every triangle in the mesh. */
36
+ export interface MeshTileMaterial {
37
+ /** Linear RGBA base-color multiplier; components must be finite in [0, 1]. */
38
+ readonly baseColorFactor?: readonly [number, number, number, number];
39
+ /** Optional embedded image, multiplied by baseColorFactor and COLOR_0; requires TEXCOORD_0. */
40
+ readonly baseColorTexture?: MeshTileTexture;
41
+ /** Metallic weight in [0, 1]; omitted values use the glTF default of 1. */
42
+ readonly metallicFactor?: number;
43
+ /** Roughness weight in [0, 1]; omitted values use the glTF default of 1. */
44
+ readonly roughnessFactor?: number;
45
+ /** Alpha interpretation; omitted values use OPAQUE. */
46
+ readonly alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND';
47
+ /** Finite nonnegative threshold, allowed only with MASK; omitted values use 0.5. */
48
+ readonly alphaCutoff?: number;
49
+ /** Whether both sides are rendered; omitted values use false. */
50
+ readonly doubleSided?: boolean;
51
+ }
52
+ /** Optional appearance for the single-mesh GLB profile. */
53
+ export interface MeshTileOptions {
54
+ /** One explicit Arrow feature table with a row index per triangle. */
55
+ readonly features?: MeshTileFeatures;
56
+ /** Explicitly selected material; other texture maps and material extensions are unsupported. */
57
+ readonly material?: MeshTileMaterial;
58
+ }
59
+ /**
60
+ * Encodes one triangle mesh as a self-contained glTF 2.0 GLB resource.
61
+ *
62
+ * POSITION and optional NORMAL must contain packed finite Float32 xyz triples. COLOR_0 accepts
63
+ * packed Float32 linear RGB/RGBA in [0, 1] or normalized Uint8/Uint16 colors per vertex.
64
+ * Normals must have unit length within 0.0001. TEXCOORD_0 accepts packed finite Float32
65
+ * or normalized Uint8/Uint16 UV pairs per vertex. Optional indices use packed unsigned
66
+ * 8-, 16-, or 32-bit values.
67
+ * Unsupported attributes, layouts, and encoded transforms fail rather than being discarded.
68
+ * Coordinates are preserved: callers own CRS conversion, local origins, placement, source material mapping,
69
+ * feature mappings, and tileset packaging. Input arrays are never modified.
70
+ *
71
+ * @param mesh - Triangle-list geometry in the caller's selected local coordinate frame.
72
+ * @param options - Optional single material with an already encoded base-color image.
73
+ * @returns An embedded-buffer GLB containing one mesh, node, and default scene.
74
+ */
75
+ export declare function encodeMeshTile(mesh: MeshGeometry, options?: MeshTileOptions): ArrayBuffer;
76
+ /** Creates the shared material/image scene without allocating uncompressed geometry buffers. */
77
+ export declare function createMeshTileScenegraph(options: MeshTileOptions, geometry: MeshGeometry): {
78
+ scenegraph: GLTFScenegraph;
79
+ materialIndex: number | undefined;
80
+ };
81
+ /** Adds placement-neutral nodes and serializes the single-mesh scene as GLB. */
82
+ export declare function finalizeMeshTileScenegraph(scenegraph: GLTFScenegraph, meshIndex: number): ArrayBuffer;
83
+ /** Validates the shared mesh profile; spatial preparation may retain Float64 positions internally. */
84
+ export declare function validateMeshGeometry(mesh: MeshGeometry, allowFloat64Positions?: boolean): MeshGeometry;
85
+ /** Validates packed indices for triangle lists or strips, including glTF primitive-restart rules. */
86
+ export declare function validateMeshIndices(attribute: MeshAttribute | undefined, vertexCount: number, primitiveMode?: 4 | 5): Uint8Array | Uint16Array | Uint32Array | undefined;
@@ -0,0 +1,31 @@
1
+ import type { PointCloudTilesetSource } from '@loaders.gl/tiles';
2
+ import type { TileConversionProgress, TileConversionReport, TileConversionSink } from '@loaders.gl/tile-converter/v5/core';
3
+ import type { PointCloudSourceTile } from '@loaders.gl/tile-converter/v5/core';
4
+ import type { EncodedPointCloudSourceTile, EncodePointCloudSourceOptions } from './point-cloud-source-encoder.js';
5
+ /** Point-cloud encoding options and an application-owned output destination. */
6
+ export interface ConvertPointCloudSourceOptions extends EncodePointCloudSourceOptions {
7
+ /** Destination receiving PNTS resources and their source placement metadata. */
8
+ readonly sink: TileConversionSink<EncodedPointCloudSourceTile>;
9
+ /** Input byte accounting for each visited source tile, including tiles with null content. */
10
+ readonly measureInputBytes: (sourceTile: PointCloudSourceTile) => number;
11
+ /** Maximum caller-measured bytes in one decoded source tile, checked before PNTS encoding. */
12
+ readonly maxInputResourceBytes?: number;
13
+ /** Maximum bytes in one encoded PNTS resource. Defaults to no limit. */
14
+ readonly maxOutputResourceBytes?: number;
15
+ /** Receive conversion progress, including resource counts and caller-measured input bytes. */
16
+ readonly onProgress?: (progress: TileConversionProgress) => void;
17
+ }
18
+ /**
19
+ * Converts a point-cloud source to PNTS resources through the v5 output-sink lifecycle.
20
+ *
21
+ * Each write is awaited before reading the next source tile. The destination is finalized only
22
+ * after traversal and writes succeed, and aborted on read, encoding, write, or cancellation errors.
23
+ * Input resource counts include empty tiles; output counts and byte sizes describe emitted PNTS
24
+ * resources. Applications supply input byte accounting because source tiles contain decoded Arrow
25
+ * data rather than transport bytes. The caller retains ownership of the input source.
26
+ *
27
+ * @param source - An I3S, COPC, or compatible point-cloud source to initialize and traverse.
28
+ * @param options - Destination, byte accounting, traversal limits, and per-tile encoding options.
29
+ * @returns The shared v5 conversion report after destination finalization.
30
+ */
31
+ export declare function convertPointCloudSource(source: PointCloudTilesetSource, options: ConvertPointCloudSourceOptions): Promise<TileConversionReport>;
@@ -0,0 +1,46 @@
1
+ import type { PointCloudBoundingVolume, PointCloudCoordinateSystem, PointCloudTilesetSource, TilesetSpatialReference } from '@loaders.gl/tiles';
2
+ import type { PointCloudSpatialOptions } from './point-cloud-spatial.js';
3
+ import type { EncodePointCloudTileOptions, EncodedPointCloudTile } from './point-cloud.js';
4
+ import type { PointCloudSourceTile, TraversePointCloudSourceOptions } from '@loaders.gl/tile-converter/v5/core';
5
+ /** Traversal and per-tile encoding options for a point-cloud source. */
6
+ export type EncodePointCloudSourceOptions = TraversePointCloudSourceOptions & Partial<Pick<PointCloudSpatialOptions, 'spatialContext' | 'normalReferenceFrame'>> & {
7
+ /** Select encoder options for each source tile with content, using its header and decoded data. */
8
+ readonly getTileEncodingOptions?: (sourceTile: PointCloudSourceTile) => EncodePointCloudTileOptions;
9
+ };
10
+ /** A PNTS resource paired with the source placement metadata needed to package its tile. */
11
+ export type EncodedPointCloudSourceTile = EncodedPointCloudTile & {
12
+ /** Stable source tile identifier. */
13
+ readonly id: string;
14
+ /** Original source hierarchy and bounds. */
15
+ readonly header: PointCloudSourceTile['header'];
16
+ /** Coordinate system used by the returned point positions. */
17
+ readonly coordinateSystem: PointCloudCoordinateSystem;
18
+ /** Origin to add to source-relative point positions. */
19
+ readonly cartographicOrigin: readonly number[];
20
+ /** Optional placement transform supplied by the point-cloud source. */
21
+ readonly modelMatrix?: readonly number[];
22
+ /** Optional source or target CRS metadata. */
23
+ readonly spatialReference?: TilesetSpatialReference;
24
+ /** Optional output-frame tile bounds supplied by the source. */
25
+ readonly spatialBoundingVolume?: PointCloudBoundingVolume;
26
+ };
27
+ /**
28
+ * Encodes a point-cloud source as a stream of PNTS resources, one for each non-empty source tile.
29
+ *
30
+ * @param source - An I3S, COPC, or compatible point-cloud tileset source.
31
+ * @param options - Optional traversal depth limit, cancellation signal, and per-tile encoder options.
32
+ * @returns Encoded source tiles in deterministic depth-first order.
33
+ */
34
+ export declare function encodePointCloudSource(source: PointCloudTilesetSource, options?: EncodePointCloudSourceOptions): AsyncIterableIterator<EncodedPointCloudSourceTile>;
35
+ /**
36
+ * Encodes one decoded source tile as PNTS and retains its hierarchy and placement metadata.
37
+ *
38
+ * Positions use the source coordinate system, with an optional RTC center subtracted before float32
39
+ * encoding and stored in the PNTS feature table. Source placement metadata is retained so callers
40
+ * can assemble the output tileset. This function does not transform the source CRS.
41
+ *
42
+ * @param sourceTile - Tile header and decoded Arrow point content from `traversePointCloudSource`.
43
+ * @param options - Optional RTC center, batch-table values, and constant color override.
44
+ * @returns An encoded source tile, or null when the source tile has no content.
45
+ */
46
+ export declare function encodePointCloudSourceTile(sourceTile: PointCloudSourceTile, options?: EncodePointCloudTileOptions): EncodedPointCloudSourceTile | null;
@@ -0,0 +1,25 @@
1
+ import type { PointCloudTileContent, PointCloudTileHeader, PointCloudTilesetSource } from '@loaders.gl/tiles';
2
+ /** A source tile and its decoded point content, including null content when no payload exists. */
3
+ export type PointCloudSourceTile = {
4
+ /** Header with the source tile's hierarchy, bounds, and LOD metadata. */
5
+ readonly header: PointCloudTileHeader;
6
+ /** Arrow point data and its coordinate metadata, or null for an empty tile. */
7
+ readonly content: PointCloudTileContent | null;
8
+ };
9
+ /** Options for camera-independent point-cloud source traversal. */
10
+ export type TraversePointCloudSourceOptions = {
11
+ /** Stop descending after this source tile level. Defaults to the complete hierarchy. */
12
+ readonly maxDepth?: number;
13
+ /** Cancel traversal between source operations. */
14
+ readonly signal?: AbortSignal;
15
+ };
16
+ /**
17
+ * Reads a point-cloud source in deterministic depth-first order, independent of a render camera.
18
+ * Each yielded value retains its tile header and Arrow content metadata so callers can apply the
19
+ * source coordinate frame and placement when encoding output tiles.
20
+ *
21
+ * @param source - An I3S, COPC, or compatible point-cloud tileset source.
22
+ * @param options - Optional depth limit and cancellation signal.
23
+ * @returns One header and decoded payload for each reachable source tile.
24
+ */
25
+ export declare function traversePointCloudSource(source: PointCloudTilesetSource, options?: TraversePointCloudSourceOptions): AsyncIterableIterator<PointCloudSourceTile>;
@@ -0,0 +1,22 @@
1
+ import type { I3SConversionSpatialContext, PointCloudSourceTile } from '@loaders.gl/tile-converter/v5/core';
2
+ /** Explicit spatial preparation for source point positions before PNTS encoding. */
3
+ export interface PointCloudSpatialOptions {
4
+ /** Context for the decoded content's source CRS, units and elevation placement. */
5
+ readonly spatialContext: I3SConversionSpatialContext;
6
+ /** Required for point normals; prevents guessing their I3S vector basis. */
7
+ readonly normalReferenceFrame?: 'earth-centered' | 'vertex-reference-frame';
8
+ /** Cancellation checked before and after application-owned elevation sampling. */
9
+ readonly signal?: AbortSignal;
10
+ }
11
+ /**
12
+ * Resolves renderer placement and transforms one point batch to absolute target coordinates.
13
+ * Cartesian affine placement and longitude/latitude offsets are applied before the shared CRS
14
+ * operation. Ambiguous default/meter-offset representations and repeated source transforms fail
15
+ * explicitly. The caller declares source metadata through the context; metadata on content must
16
+ * agree. Source arrays and traversal headers remain unchanged. Output bounds describe decoded
17
+ * points, not the source LOD volume; archive sinks rebuild their bounds from encoded points.
18
+ * @param sourceTile - A decoded source tile with packed Arrow positions.
19
+ * @param options - Source spatial policy, optional normal frame and cancellation.
20
+ * @returns Prepared target-frame point content, or the unchanged empty tile.
21
+ */
22
+ export declare function transformPointCloudSourceTile(sourceTile: PointCloudSourceTile, options: PointCloudSpatialOptions): Promise<PointCloudSourceTile>;
@@ -0,0 +1,28 @@
1
+ import type { BrowserTileConversionFile, TileConversionSink } from '@loaders.gl/tile-converter/v5/core';
2
+ import type { EncodedPointCloudSourceTile } from './point-cloud-source-encoder.js';
3
+ /** Output limits and geometric error for independent ECEF point tiles. */
4
+ export interface PointCloudTilesetSinkOptions {
5
+ /** Maximum retained PNTS and tileset JSON bytes, excluding peak serialization memory. */
6
+ readonly maxTotalBytes: number;
7
+ /** Maximum independent tile placements retained by the sink. */
8
+ readonly maxTiles: number;
9
+ /** Leaf error in meters, including source sampling error and measured position rounding. */
10
+ readonly geometricError: number;
11
+ }
12
+ /** Atomic flat 3D Tiles package suitable for the existing 3TZ archive adapter. */
13
+ export interface PointCloudTilesetSink extends TileConversionSink<EncodedPointCloudSourceTile> {
14
+ /** Returns named PNTS files and tileset.json after successful finalization; empty after abort. */
15
+ getFiles(): readonly BrowserTileConversionFile[];
16
+ }
17
+ /**
18
+ * Packages independent point tiles as a bounded 3D Tiles 1.0 collection with an ADD root.
19
+ * Requires unmodified encoder outputs in declared EPSG:4978 xyz meters and ellipsoidal heights,
20
+ * cartesian positions, zero source origin and no additional placement transform. PNTS RTC_CENTER
21
+ * is already encoded and is applied once to bounds. Geographic/projected/offset source frames
22
+ * must be converted before this sink. This authors a flat partial dataset, not source LOD;
23
+ * callers must select independent, non-overlapping samples and supply their sampling error.
24
+ * Use createTileConversionArchive with format 3tz to package the finalized files.
25
+ * @param options - Retained byte/tile limits and explicit leaf geometric error.
26
+ * @returns A sink exposing the completed package atomically.
27
+ */
28
+ export declare function createPointCloudTilesetSink(options: PointCloudTilesetSinkOptions): PointCloudTilesetSink;
@@ -0,0 +1,49 @@
1
+ import type { Mesh, MeshArrowTable, MeshAttribute } from '@loaders.gl/schema';
2
+ /** Options for encoding one Arrow or mesh point batch as a 3D Tiles point tile. */
3
+ export interface EncodePointCloudTileOptions {
4
+ /** Optional origin subtracted from absolute positions and stored as the PNTS RTC_CENTER. */
5
+ readonly rtcCenter?: readonly [number, number, number];
6
+ /** Maximum Euclidean position reconstruction error in source units; omission permits float32 rounding. */
7
+ readonly maxPositionError?: number;
8
+ /** Optional source-wide RGBA color stored as the PNTS CONSTANT_RGBA property. */
9
+ readonly constantRGBA?: readonly number[];
10
+ /** Optional per-point values indexed by the tile's `BATCH_ID` attribute. */
11
+ readonly batchTableJson?: Readonly<Record<string, readonly (string | number)[]>>;
12
+ }
13
+ /** Encoded PNTS and measured placement information from its float32 POSITION stream. */
14
+ export interface EncodedPointCloudTile {
15
+ /** Self-contained PNTS payload. */
16
+ readonly pnts: ArrayBuffer;
17
+ /** Actual number of encoded points. */
18
+ readonly pointCount: number;
19
+ /** RTC center added to encoded positions; zero when no RTC center was selected. */
20
+ readonly rtcCenter: readonly [number, number, number];
21
+ /** Axis-aligned bounds of encoded positions before adding the RTC center. */
22
+ readonly localBoundingBox: readonly [readonly number[], readonly number[]];
23
+ /** Maximum Euclidean error after reconstructing absolute positions, in source units. */
24
+ readonly maximumPositionError: number;
25
+ }
26
+ /**
27
+ * Encodes one mesh or Mesh Arrow point batch as a PNTS resource.
28
+ *
29
+ * The input position field must be named `POSITION` and contain xyz values. `COLOR_0` or `COLOR`
30
+ * is written when present; `constantRGBA` supplies a fallback PNTS `CONSTANT_RGBA` feature-table
31
+ * property. `NORMAL` and `BATCH_ID` are also written when present. Arrow batches should be passed
32
+ * one at a time so callers can bound memory and apply their own tiling and output policy.
33
+ * Unsupported attributes, including a second color attribute, fail instead of being discarded.
34
+ *
35
+ * @param pointBatch - Point data produced by a LAS, COPC, I3S, or other point source.
36
+ * @param options - Optional RTC center and batch-table values.
37
+ * @returns A 3D Tiles PNTS resource.
38
+ */
39
+ export declare function encodePointCloudTile(pointBatch: Mesh | MeshArrowTable, options?: EncodePointCloudTileOptions): ArrayBuffer;
40
+ /**
41
+ * Encodes a point batch and measures its decoded float32 bounds and position rounding.
42
+ * The optional error gate runs before PNTS serialization. Source arrays remain unchanged.
43
+ * @param pointBatch - One mesh or Arrow point batch.
44
+ * @param options - RTC center, precision gate, appearance and batch metadata.
45
+ * @returns PNTS bytes paired with bounds, RTC placement and maximum position error.
46
+ */
47
+ export declare function encodePointCloudTileWithMetadata(pointBatch: Mesh | MeshArrowTable, options?: EncodePointCloudTileOptions): EncodedPointCloudTile;
48
+ /** Decodes packed point positions to doubles before applying a spatial operation. */
49
+ export declare function decodePointCloudPositions(attribute: MeshAttribute | undefined): Float64Array;
@@ -0,0 +1,18 @@
1
+ /** One aggregate transport budget shared by selected contents and their dependencies. */
2
+ export interface TileConversionResourceFetcherOptions {
3
+ /** Maximum total response bytes, including previously inspected root bytes. */
4
+ readonly maxInputBytes: number;
5
+ /** Previously consumed input bytes, such as the inspected tileset JSON. */
6
+ readonly initialInputBytes?: number;
7
+ /** Application transport; also enables archive-backed or hermetic resolution. */
8
+ readonly fetcher?: typeof fetch;
9
+ /** Conversion cancellation, forwarded to every dependency request. */
10
+ readonly signal?: AbortSignal;
11
+ }
12
+ /**
13
+ * Wraps application fetch with a shared byte budget and conversion cancellation.
14
+ * Each requested resource is charged, including repeated requests; HTTP(S), Blob and embedded data
15
+ * URLs are accepted. Response streams are canceled on overflow or failure. The complete bounded
16
+ * response is retained for codecs; this does not bound their decoded allocations.
17
+ */
18
+ export declare function createTileConversionResourceFetcher(options: TileConversionResourceFetcherOptions): typeof fetch;
@@ -0,0 +1,58 @@
1
+ import type { TileConversionReport, TileConversionSink } from './conversion-api.js';
2
+ /** Durable record for one successfully written, deterministic output resource. */
3
+ export interface TileResourceManifestEntry {
4
+ /** Stable resource identifier supplied by the output profile. */
5
+ readonly resourceId: string;
6
+ /** Byte length of the output resource. */
7
+ readonly byteLength: number;
8
+ /** Stable caller-computed content fingerprint, such as a SHA-256 digest. */
9
+ readonly fingerprint: string;
10
+ }
11
+ /** Versioned progress record used to resume deterministic output packaging. */
12
+ export interface TileResourceManifest {
13
+ /** Manifest format version. */
14
+ readonly version: 1;
15
+ /** True only after the destination and report have been finalized successfully. */
16
+ readonly complete: boolean;
17
+ /** Resources durably written before interruption or completion. */
18
+ readonly resources: readonly TileResourceManifestEntry[];
19
+ /** Conversion summary saved after successful destination finalization. */
20
+ readonly report?: TileConversionReport;
21
+ }
22
+ /** Application-owned persistence for a conversion manifest. */
23
+ export interface TileResourceManifestStore {
24
+ /** Loads the previous manifest, or returns null when starting a new conversion. */
25
+ load(): Promise<TileResourceManifest | null>;
26
+ /** Atomically replaces the saved manifest with the supplied snapshot. */
27
+ save(manifest: TileResourceManifest): Promise<void>;
28
+ }
29
+ /** Options for decorating a resource sink with restart-safe manifest tracking. */
30
+ export interface ManifestBackedTileConversionSinkOptions<TResource> {
31
+ /** Output destination with deterministic, idempotent resource writes. */
32
+ readonly sink: TileConversionSink<TResource>;
33
+ /** Persistence adapter for snapshots written after each resource. */
34
+ readonly manifestStore: TileResourceManifestStore;
35
+ /** Stable profile-specific path or resource key. */
36
+ readonly getResourceId: (resource: TResource) => string;
37
+ /** Byte length used to detect changed content under an existing resource ID. */
38
+ readonly measureResourceBytes: (resource: TResource) => number;
39
+ /** Stable fingerprint used to detect changed content under an existing resource ID. */
40
+ readonly fingerprintResource: (resource: TResource) => string;
41
+ }
42
+ /**
43
+ * Creates a sink that skips matching checkpointed resources when a process restarts.
44
+ *
45
+ * The destination must write resources idempotently by the ID returned from `getResourceId`.
46
+ * The manifest is persisted after every successful write; the store should replace snapshots
47
+ * atomically. Existing IDs must retain their byte length and fingerprint or the resumed job fails
48
+ * rather than silently mixing output from different conversion inputs. Writes are serialized even
49
+ * when callers issue them concurrently. Reports count resources processed by the current run,
50
+ * including writes skipped because the matching resource was already present. A graceful abort
51
+ * clears the manifest checkpoint before asking the destination to clean partial output, so the
52
+ * next run starts cleanly. A process interruption that does not call `abort` can resume from its
53
+ * last saved checkpoint.
54
+ *
55
+ * @param options - Destination, manifest store, stable IDs, byte measurement, and fingerprinting.
56
+ * @returns A `TileConversionSink` with resumable per-resource progress.
57
+ */
58
+ export declare function createManifestBackedTileConversionSink<TResource>(options: ManifestBackedTileConversionSinkOptions<TResource>): Promise<TileConversionSink<TResource>>;
@@ -0,0 +1,61 @@
1
+ import type { CreateTilesetSpatialReferenceOptions, I3SSpatialBounds, I3STransformedPositions, I3STransformedGeometry, Tiles3DSpatialBoundingVolume, TilesetSpatialOptions, TilesetSpatialReference } from '@loaders.gl/tiles';
2
+ /** Portable coordinate operations and output metadata for a 3D Tiles conversion. */
3
+ export interface Tiles3DConversionSpatialContext {
4
+ /** Source and selected target CRS, height reference, units, and transformation state. */
5
+ readonly spatialReference: TilesetSpatialReference;
6
+ /** Transform packed absolute xyz positions using double precision output. */
7
+ transformPositions(positions: ArrayLike<number>): Float64Array;
8
+ /** Transform packed normals using the corresponding source positions. */
9
+ transformNormals(normals: ArrayLike<number>, positions: ArrayLike<number>): Float32Array;
10
+ /** Rebuild a conservative bound in the selected target coordinate frame. */
11
+ transformBoundingVolume(volume: Tiles3DSpatialBoundingVolume, sourceTransform?: ArrayLike<number>): Tiles3DSpatialBoundingVolume;
12
+ }
13
+ /** Portable coordinate operations and output metadata for an I3S conversion. */
14
+ export interface I3SConversionSpatialContext {
15
+ /** Source and selected target CRS, height reference, units, and transformation state. */
16
+ readonly spatialReference: TilesetSpatialReference;
17
+ /** Transform absolute I3S positions after applying declared height units and placement. */
18
+ transformPositions(positions: ArrayLike<number>, sourceOrigin: ArrayLike<number>): I3STransformedPositions;
19
+ /** Transform absolute conversion geometry without intermediate float32 rounding. */
20
+ transformGeometryAsync(positions: ArrayLike<number>, normals?: ArrayLike<number>, normalReferenceFrame?: string): Promise<I3STransformedGeometry>;
21
+ /** Transform absolute I3S positions when terrain or scene sampling is asynchronous. */
22
+ transformPositionsAsync(positions: ArrayLike<number>, sourceOrigin: ArrayLike<number>): Promise<I3STransformedPositions>;
23
+ /** Transform packed normals using the corresponding source positions. */
24
+ transformNormals(normals: ArrayLike<number>, positions: ArrayLike<number>, normalReferenceFrame?: string): Float32Array;
25
+ /** Rebuild a conservative I3S bound in the selected target frame. */
26
+ transformBoundingVolume(bounds: I3SSpatialBounds): I3SSpatialBounds | {
27
+ box?: number[];
28
+ region?: number[];
29
+ };
30
+ /** Rebuild a bound when terrain or scene sampling is asynchronous. */
31
+ transformBoundingVolumeAsync(bounds: I3SSpatialBounds): Promise<I3SSpatialBounds | {
32
+ box?: number[];
33
+ region?: number[];
34
+ }>;
35
+ }
36
+ /**
37
+ * Creates the shared spatial operations used to write 3D Tiles in a selected CRS and height frame.
38
+ *
39
+ * Source discovery remains format-specific and should use `get3DTilesSpatialReference` or the
40
+ * initialized source's spatial metadata. Target choices on a normalized, transformable reference
41
+ * are retained unless overridden in `options`. Do not reuse a reference already marked
42
+ * `transformed`; that would apply the operation twice. The returned reference is the metadata to
43
+ * publish with transformed output; unresolved requests fail instead of guessing a CRS or height datum.
44
+ *
45
+ * @param discovered - Source CRS, units, coordinate epoch, and height metadata.
46
+ * @param options - Target CRS, height reference, and explicitly supplied geoid resources.
47
+ * @returns Shared position, normal, and bound operations with matching output metadata.
48
+ */
49
+ export declare function createTiles3DConversionSpatialContext(discovered: CreateTilesetSpatialReferenceOptions | TilesetSpatialReference, options?: TilesetSpatialOptions): Tiles3DConversionSpatialContext;
50
+ /**
51
+ * Creates the shared spatial operations used to write I3S in a selected CRS and height frame.
52
+ *
53
+ * I3S height units, vertical datum, elevation placement, and bounds use the same transformer as
54
+ * the source-backed tile runtime. Terrain or scene elevation providers are explicit application
55
+ * inputs and may make position and bound operations asynchronous.
56
+ *
57
+ * @param discovered - Source CRS, vertical units, height reference, and elevation mode.
58
+ * @param options - Target CRS, height reference, geoid, or explicit elevation providers.
59
+ * @returns Shared position, normal, bound, and output-metadata operations.
60
+ */
61
+ export declare function createI3SConversionSpatialContext(discovered: CreateTilesetSpatialReferenceOptions | TilesetSpatialReference, options?: TilesetSpatialOptions): I3SConversionSpatialContext;
@@ -0,0 +1,21 @@
1
+ import type { Tileset3D, TilesetContentTraversalItem, TilesetSourceMetadata, TraverseTilesetContentsOptions } from '@loaders.gl/tiles';
2
+ import type { TileConversionSource } from './conversion-api.js';
3
+ /** Decoded-content lifetime options for source-backed conversion. */
4
+ export type TilesetConversionSourceOptions = Pick<TraverseTilesetContentsOptions, 'unloadContent'>;
5
+ /**
6
+ * Adapts a source-backed tileset to the portable v5 conversion source contract.
7
+ *
8
+ * Inspection waits for initialization and returns the source's normalized metadata. Reading uses
9
+ * camera-independent shared traversal, retaining each placement and its ordered decoded contents.
10
+ * Source adapters own content, subtree, node-page, nested tileset, and archive resolution.
11
+ *
12
+ * Enable `unloadContent` on a dedicated runtime to release newly loaded payloads after the codec
13
+ * and awaited writes finish, or iteration closes on failure. Preloaded payloads remain attached.
14
+ * Applications own tileset destruction, format codecs, byte accounting, and output packaging.
15
+ * This adapter does not impose an aggregate input memory limit or transform coordinates.
16
+ *
17
+ * @param tileset - An initializing or initialized runtime backed by a 3D Tiles or I3S source.
18
+ * @param options - Optional cleanup of content loaded during conversion.
19
+ * @returns A source accepted by `inspectTileset` and `convertTileset`.
20
+ */
21
+ export declare function createTilesetConversionSource(tileset: Tileset3D, options?: TilesetConversionSourceOptions): TileConversionSource<TilesetSourceMetadata, TilesetContentTraversalItem>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-alpha.11",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,6 +24,26 @@
24
24
  "types": "./dist/index.d.ts",
25
25
  "import": "./dist/index.js",
26
26
  "require": "./dist/index.cjs"
27
+ },
28
+ "./v5": {
29
+ "types": "./dist/v5/index.d.ts",
30
+ "import": "./dist/v5/index.js",
31
+ "require": "./dist/v5/index.cjs"
32
+ },
33
+ "./v5/browser": {
34
+ "types": "./dist/v5/browser.d.ts",
35
+ "import": "./dist/v5/browser.js",
36
+ "require": "./dist/v5/browser.cjs"
37
+ },
38
+ "./v5/core": {
39
+ "types": "./dist/v5/core.d.ts",
40
+ "import": "./dist/v5/core.js",
41
+ "require": "./dist/v5/core.cjs"
42
+ },
43
+ "./v5/adapters": {
44
+ "types": "./dist/v5/adapters.d.ts",
45
+ "import": "./dist/v5/adapters.js",
46
+ "require": "./dist/v5/adapters.cjs"
27
47
  }
28
48
  },
29
49
  "sideEffects": false,
@@ -45,30 +65,36 @@
45
65
  "process": false
46
66
  },
47
67
  "scripts": {
48
- "pre-build": "npm run build-converter-bundle && npm run build-i3s-server-bundle && npm run copy-certificates",
49
- "build-converter-bundle": "esbuild src/converter-cli.ts --outfile=dist/converter.min.cjs --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
50
- "build-i3s-server-bundle": "esbuild src/i3s-server/bin/www.ts --outfile=dist/i3s-server/bin/i3s-server.min.cjs --platform=node --target=esnext,node14 --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
51
- "copy-certificates": "cp -R src/i3s-server/certs dist/i3s-server"
68
+ "pre-build": "npm run build-package-entrypoints && npm run build-converter-bundle && npm run build-i3s-server-bundle && npm run copy-certificates",
69
+ "build-package-entrypoints": "esbuild src/index.ts --bundle --packages=external --platform=node --format=esm --outfile=dist/index.js && esbuild src/index.ts --bundle --packages=external --platform=node --format=cjs --outfile=dist/index.cjs && npm run build-v5-entrypoints && npm run build-v5-declarations",
70
+ "build-v5-declarations": "tsc --project tsconfig.v5.json",
71
+ "build-converter-bundle": "esbuild src/v4/converter-cli.ts --outfile=dist/converter.min.cjs --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
72
+ "build-i3s-server-bundle": "esbuild src/v4/i3s-server/bin/www.ts --outfile=dist/i3s-server/bin/i3s-server.min.cjs --platform=node --target=esnext,node14 --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
73
+ "copy-certificates": "cp -R src/v4/i3s-server/certs dist/i3s-server",
74
+ "build-v5-entrypoints": "esbuild src/v5/core.ts src/v5/adapters.ts src/v5/index.ts src/v5/browser.ts --bundle --packages=external --external:@loaders.gl/* --platform=browser --outdir=dist/v5 --format=esm && esbuild src/v5/core.ts src/v5/adapters.ts src/v5/index.ts src/v5/browser.ts --bundle --packages=external --external:@loaders.gl/* --platform=browser --outdir=dist/v5 --format=cjs --out-extension:.js=.cjs"
52
75
  },
53
76
  "dependencies": {
54
- "@loaders.gl/3d-tiles": "5.0.0-alpha.1",
55
- "@loaders.gl/compression": "5.0.0-alpha.1",
56
- "@loaders.gl/crypto": "5.0.0-alpha.1",
57
- "@loaders.gl/draco": "5.0.0-alpha.1",
58
- "@loaders.gl/gltf": "5.0.0-alpha.1",
59
- "@loaders.gl/i3s": "5.0.0-alpha.1",
60
- "@loaders.gl/images": "5.0.0-alpha.1",
61
- "@loaders.gl/loader-utils": "5.0.0-alpha.1",
62
- "@loaders.gl/math": "5.0.0-alpha.1",
63
- "@loaders.gl/polyfills": "5.0.0-alpha.1",
64
- "@loaders.gl/textures": "5.0.0-alpha.1",
65
- "@loaders.gl/tiles": "5.0.0-alpha.1",
66
- "@loaders.gl/worker-utils": "5.0.0-alpha.1",
67
- "@loaders.gl/zip": "5.0.0-alpha.1",
68
- "@math.gl/core": "^4.1.0",
69
- "@math.gl/culling": "^4.1.0",
70
- "@math.gl/geoid": "^4.1.0",
71
- "@math.gl/geospatial": "^4.1.0",
77
+ "@loaders.gl/3d-tiles": "5.0.0-alpha.11",
78
+ "@loaders.gl/compression": "5.0.0-alpha.11",
79
+ "@loaders.gl/crypto": "5.0.0-alpha.11",
80
+ "@loaders.gl/draco": "5.0.0-alpha.11",
81
+ "@loaders.gl/gltf": "5.0.0-alpha.11",
82
+ "@loaders.gl/i3s": "5.0.0-alpha.11",
83
+ "@loaders.gl/images": "5.0.0-alpha.11",
84
+ "@loaders.gl/loader-utils": "5.0.0-alpha.11",
85
+ "@loaders.gl/polyfills": "5.0.0-alpha.11",
86
+ "@loaders.gl/schema": "5.0.0-alpha.11",
87
+ "@loaders.gl/schema-utils": "5.0.0-alpha.11",
88
+ "@loaders.gl/textures": "5.0.0-alpha.11",
89
+ "@loaders.gl/tiles": "5.0.0-alpha.11",
90
+ "@loaders.gl/worker-utils": "5.0.0-alpha.11",
91
+ "@loaders.gl/zip": "5.0.0-alpha.11",
92
+ "@math.gl/core": "5.0.0-alpha.15",
93
+ "@math.gl/crs": "5.0.0-alpha.15",
94
+ "@math.gl/culling": "5.0.0-alpha.15",
95
+ "@math.gl/geoid": "5.0.0-alpha.15",
96
+ "@math.gl/geometry-utils": "5.0.0-alpha.15",
97
+ "@math.gl/geospatial": "5.0.0-alpha.15",
72
98
  "ajv": "^8.12.0",
73
99
  "archiver": "^5.0.0",
74
100
  "cors": "^2.8.5",
@@ -77,7 +103,6 @@
77
103
  "express": "~4.19.2",
78
104
  "inquirer": "^8.0.0",
79
105
  "json-map-transform": "^1.2.6",
80
- "jszip": "^3.5.0",
81
106
  "md5": "^2.3.0",
82
107
  "morgan": "~1.9.1",
83
108
  "uuid": "^9.0.0"
@@ -88,10 +113,11 @@
88
113
  },
89
114
  "devDependencies": {
90
115
  "@types/express": "^4.17.17",
91
- "@types/inquirer": "^9.0.7"
116
+ "@types/inquirer": "^9.0.7",
117
+ "typescript": "^6.0.3"
92
118
  },
93
119
  "peerDependencies": {
94
120
  "@loaders.gl/core": "~5.0.0-alpha.0"
95
121
  },
96
- "gitHead": "77a55028e8204e09df1258f10cb61ed35353b258"
122
+ "gitHead": "e9694544adb0bc7dac68a35adbc8bdae35f64dae"
97
123
  }
@@ -0,0 +1,5 @@
1
+ # Shared tile-converter code
2
+
3
+ Place code here when it is intentionally shared by multiple converter versions.
4
+ Version-specific implementations belong in `v4/` or `v5/` so their APIs and
5
+ runtime requirements remain independent.
package/src/index.ts CHANGED
@@ -1,2 +1 @@
1
- export {default as I3SConverter} from './i3s-converter/i3s-converter';
2
- export {default as Tiles3DConverter} from './3d-tiles-converter/3d-tiles-converter';
1
+ export * from './v4/index.js';
@@ -14,6 +14,7 @@ import {load, isBrowser} from '@loaders.gl/core';
14
14
  import {I3SLoader, I3SAttributeLoader, COORDINATE_SYSTEM} from '@loaders.gl/i3s';
15
15
  import {Geoid} from '@math.gl/geoid';
16
16
 
17
+ import {validateI3SConversionSpatialReference} from './helpers/validate-i3s-spatial-reference';
17
18
  import {PGMLoader} from '../pgm-loader';
18
19
  import {i3sObbTo3dTilesObb} from './helpers/i3s-obb-to-3d-tiles-obb';
19
20
  import {convertScreenThresholdToGeometricError} from '../lib/utils/lod-conversion-utils';
@@ -134,8 +135,6 @@ export default class Tiles3DConverter {
134
135
  }
135
136
  }
136
137
 
137
- this.progress.startMonitoring();
138
-
139
138
  this.sourceTileset = await loadFromArchive(
140
139
  inputUrl,
141
140
  I3SLoader,
@@ -151,6 +150,18 @@ export default class Tiles3DConverter {
151
150
  return undefined;
152
151
  }
153
152
 
153
+ try {
154
+ validateI3SConversionSpatialReference(this.sourceTileset);
155
+ } catch (error) {
156
+ try {
157
+ await this.slpkFilesystem?.destroy();
158
+ } finally {
159
+ this.slpkFilesystem = null;
160
+ }
161
+ throw error;
162
+ }
163
+ this.progress.startMonitoring();
164
+
154
165
  const rootNode = this.sourceTileset?.root;
155
166
  if (!rootNode.obb) {
156
167
  rootNode.obb = createObbFromMbs(rootNode.mbs);