@loaders.gl/tile-converter 4.3.0-alpha.1 → 4.3.0-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "4.3.0-alpha.1",
3
+ "version": "4.3.0-alpha.3",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -53,20 +53,20 @@
53
53
  "copy-certificates": "cp -R src/i3s-server/certs dist/i3s-server"
54
54
  },
55
55
  "dependencies": {
56
- "@loaders.gl/3d-tiles": "4.3.0-alpha.1",
57
- "@loaders.gl/compression": "4.3.0-alpha.1",
58
- "@loaders.gl/crypto": "4.3.0-alpha.1",
59
- "@loaders.gl/draco": "4.3.0-alpha.1",
60
- "@loaders.gl/gltf": "4.3.0-alpha.1",
61
- "@loaders.gl/i3s": "4.3.0-alpha.1",
62
- "@loaders.gl/images": "4.3.0-alpha.1",
63
- "@loaders.gl/loader-utils": "4.3.0-alpha.1",
64
- "@loaders.gl/math": "4.3.0-alpha.1",
65
- "@loaders.gl/polyfills": "4.3.0-alpha.1",
66
- "@loaders.gl/textures": "4.3.0-alpha.1",
67
- "@loaders.gl/tiles": "4.3.0-alpha.1",
68
- "@loaders.gl/worker-utils": "4.3.0-alpha.1",
69
- "@loaders.gl/zip": "4.3.0-alpha.1",
56
+ "@loaders.gl/3d-tiles": "4.3.0-alpha.3",
57
+ "@loaders.gl/compression": "4.3.0-alpha.3",
58
+ "@loaders.gl/crypto": "4.3.0-alpha.3",
59
+ "@loaders.gl/draco": "4.3.0-alpha.3",
60
+ "@loaders.gl/gltf": "4.3.0-alpha.3",
61
+ "@loaders.gl/i3s": "4.3.0-alpha.3",
62
+ "@loaders.gl/images": "4.3.0-alpha.3",
63
+ "@loaders.gl/loader-utils": "4.3.0-alpha.3",
64
+ "@loaders.gl/math": "4.3.0-alpha.3",
65
+ "@loaders.gl/polyfills": "4.3.0-alpha.3",
66
+ "@loaders.gl/textures": "4.3.0-alpha.3",
67
+ "@loaders.gl/tiles": "4.3.0-alpha.3",
68
+ "@loaders.gl/worker-utils": "4.3.0-alpha.3",
69
+ "@loaders.gl/zip": "4.3.0-alpha.3",
70
70
  "@math.gl/core": "^4.0.0",
71
71
  "@math.gl/culling": "^4.0.0",
72
72
  "@math.gl/geoid": "^4.0.0",
@@ -94,5 +94,5 @@
94
94
  "peerDependencies": {
95
95
  "@loaders.gl/core": "^4.0.0"
96
96
  },
97
- "gitHead": "568446ea69eb590f0c42d965459b636216cda74e"
97
+ "gitHead": "3213679d79e6ff2814d48fd3337acfa446c74099"
98
98
  }
@@ -6,7 +6,7 @@ import type {
6
6
  } from '@loaders.gl/3d-tiles';
7
7
  import {Tiles3DArchive} from '@loaders.gl/3d-tiles';
8
8
  import {LoaderWithParser, load} from '@loaders.gl/core';
9
- import {FileHandleFile, FileProvider} from '@loaders.gl/loader-utils';
9
+ import {FileHandleFile, FileProviderInterface} from '@loaders.gl/loader-utils';
10
10
  import {
11
11
  CD_HEADER_SIGNATURE,
12
12
  ZipFileSystem,
@@ -142,7 +142,7 @@ export function isNestedTileset(tile: Tiles3DTileJSONPostprocessed) {
142
142
  * @returns hash table of the 3TZ file content or undefined if the hash file is not presented inside
143
143
  */
144
144
  async function loadHashTable(
145
- fileProvider: FileProvider
145
+ fileProvider: FileProviderInterface
146
146
  ): Promise<undefined | Record<string, bigint>> {
147
147
  let hashTable: undefined | Record<string, bigint>;
148
148
 
@@ -24,7 +24,13 @@ app.use(express.static(path.join(__dirname, 'public')));
24
24
  app.use(cors());
25
25
 
26
26
  if (/\.slpk$/.test(I3S_LAYER_PATH)) {
27
- loadArchive(FULL_LAYER_PATH);
27
+ let filePath = FULL_LAYER_PATH;
28
+ // Checks if the first character is not a point to indicate absolute path
29
+ const absolutePath = /^[^.]/.exec(I3S_LAYER_PATH);
30
+ if (absolutePath) {
31
+ filePath = I3S_LAYER_PATH;
32
+ }
33
+ loadArchive(filePath);
28
34
  app.use('/SceneServer/layers/0', router);
29
35
  app.use('/SceneServer', sceneServerRouter);
30
36
  } else {
@@ -3,18 +3,24 @@ import fs from 'fs';
3
3
 
4
4
  const {promises} = fs;
5
5
 
6
- const I3S_LAYER_PATH = process.env.I3sLayerPath || '';
7
-
8
6
  /**
9
7
  * Get local file name by input HTTP URL
10
8
  * @param url - I3S HTTP service url
9
+ * @param i3sLayerPath - I3S layer path
11
10
  * @returns - local file name
12
11
  */
13
- export async function getFileNameByUrl(url: string): Promise<string | null> {
12
+ export async function getFileNameByUrl(url: string, i3sLayerPath = ''): Promise<string | null> {
13
+ i3sLayerPath = i3sLayerPath || process.env.I3sLayerPath || '';
14
14
  const extensions = ['json', 'bin', 'jpg', 'jpeg', 'png', 'bin.dds', 'ktx2'];
15
- const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH);
15
+ let filePath = process.cwd();
16
+ // Checks if the first character is not a point to indicate absolute path
17
+ const absolutePath = /^[^.]/.exec(i3sLayerPath);
18
+ if (absolutePath) {
19
+ filePath = '';
20
+ }
21
+ const FULL_LAYER_PATH = path.join(filePath, i3sLayerPath, url);
16
22
  for (const ext of extensions) {
17
- const fileName = `${FULL_LAYER_PATH}${url}/index.${ext}`;
23
+ const fileName = `${FULL_LAYER_PATH}/index.${ext}`;
18
24
  try {
19
25
  await promises.access(fileName);
20
26
  return fileName;