@loaders.gl/tile-converter 4.3.0-alpha.1 → 4.3.0-alpha.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.
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.2",
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.2",
57
+ "@loaders.gl/compression": "4.3.0-alpha.2",
58
+ "@loaders.gl/crypto": "4.3.0-alpha.2",
59
+ "@loaders.gl/draco": "4.3.0-alpha.2",
60
+ "@loaders.gl/gltf": "4.3.0-alpha.2",
61
+ "@loaders.gl/i3s": "4.3.0-alpha.2",
62
+ "@loaders.gl/images": "4.3.0-alpha.2",
63
+ "@loaders.gl/loader-utils": "4.3.0-alpha.2",
64
+ "@loaders.gl/math": "4.3.0-alpha.2",
65
+ "@loaders.gl/polyfills": "4.3.0-alpha.2",
66
+ "@loaders.gl/textures": "4.3.0-alpha.2",
67
+ "@loaders.gl/tiles": "4.3.0-alpha.2",
68
+ "@loaders.gl/worker-utils": "4.3.0-alpha.2",
69
+ "@loaders.gl/zip": "4.3.0-alpha.2",
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": "77a3cb538ab7a1fbf74245f25590210451689f5c"
98
98
  }
@@ -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;