chiitiler 1.22.1 → 1.22.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/README.md +1 -0
- package/dist/render/index.d.ts +4 -4
- package/dist/source/fs.d.ts +1 -1
- package/dist/source/fs.js +23 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -60,6 +60,7 @@ You're done. That same endpoint works as an XYZ tile source for Leaflet, MapLibr
|
|
|
60
60
|
- **[PLATEAU VIEW](https://plateauview.mlit.go.jp/)** — Cesium.js imagery via `/tiles`
|
|
61
61
|
- **[qgis-amazonlocationservice-plugin](https://github.com/dayjournal/qgis-amazonlocationservice-plugin)** — QGIS integration
|
|
62
62
|
- **[Allmaps Latest](https://bsky.app/profile/latest.allmaps.org)** — Bluesky bot
|
|
63
|
+
- **[Kumoy](https://www.kumoy.io/)** - used for thumbnail image of designed maps
|
|
63
64
|
|
|
64
65
|
## HTTP API
|
|
65
66
|
|
package/dist/render/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Sharp } from 'sharp';
|
|
2
2
|
import type { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
3
3
|
import type { Cache } from '../cache/index.js';
|
|
4
4
|
type GetRenderedTileOptions = {
|
|
@@ -13,7 +13,7 @@ type GetRenderedTileOptions = {
|
|
|
13
13
|
quality: number;
|
|
14
14
|
};
|
|
15
15
|
type SupportedFormat = 'png' | 'jpeg' | 'jpg' | 'webp';
|
|
16
|
-
declare function getRenderedTile({ stylejson, z, x, y, tileSize, cache, margin, ext, quality, }: GetRenderedTileOptions): Promise<
|
|
16
|
+
declare function getRenderedTile({ stylejson, z, x, y, tileSize, cache, margin, ext, quality, }: GetRenderedTileOptions): Promise<Sharp>;
|
|
17
17
|
type GetRenderedClipOptions = {
|
|
18
18
|
stylejson: string | StyleSpecification;
|
|
19
19
|
bbox: [number, number, number, number];
|
|
@@ -22,7 +22,7 @@ type GetRenderedClipOptions = {
|
|
|
22
22
|
ext: SupportedFormat;
|
|
23
23
|
quality: number;
|
|
24
24
|
};
|
|
25
|
-
declare function getRenderedClip({ stylejson, bbox, size, cache, ext, quality, }: GetRenderedClipOptions): Promise<
|
|
25
|
+
declare function getRenderedClip({ stylejson, bbox, size, cache, ext, quality, }: GetRenderedClipOptions): Promise<Sharp>;
|
|
26
26
|
type GetRenderedCameraOptions = {
|
|
27
27
|
stylejson: string | StyleSpecification;
|
|
28
28
|
cache: Cache;
|
|
@@ -35,5 +35,5 @@ type GetRenderedCameraOptions = {
|
|
|
35
35
|
height: number;
|
|
36
36
|
width: number;
|
|
37
37
|
};
|
|
38
|
-
declare function getRenderedCamera(options: GetRenderedCameraOptions): Promise<
|
|
38
|
+
declare function getRenderedCamera(options: GetRenderedCameraOptions): Promise<Sharp>;
|
|
39
39
|
export { getRenderedTile, getRenderedClip, getRenderedCamera, type GetRenderedClipOptions, type GetRenderedTileOptions, type GetRenderedCameraOptions, type SupportedFormat, };
|
package/dist/source/fs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function getFilesystemSource(uri: string): Promise<Buffer
|
|
1
|
+
declare function getFilesystemSource(uri: string): Promise<Buffer | null>;
|
|
2
2
|
export { getFilesystemSource };
|
package/dist/source/fs.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
function getFilesystemSource(uri) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
async function getFilesystemSource(uri) {
|
|
3
|
+
const path = uri.replace('file://', '');
|
|
4
|
+
const data = await fs.readFile(path).catch(() => null);
|
|
5
|
+
if (data !== null)
|
|
6
|
+
return data;
|
|
7
|
+
// maplibre-gl-native percent-encodes {fontstack} in glyphs URLs
|
|
8
|
+
// (e.g. "Noto Sans Regular" -> "Noto%20Sans%20Regular"),
|
|
9
|
+
// so retry with the percent-decoded path
|
|
10
|
+
let decodedPath;
|
|
11
|
+
try {
|
|
12
|
+
decodedPath = decodeURIComponent(path);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
decodedPath = path;
|
|
16
|
+
}
|
|
17
|
+
if (decodedPath !== path) {
|
|
18
|
+
const decodedData = await fs.readFile(decodedPath).catch(() => null);
|
|
19
|
+
if (decodedData !== null)
|
|
20
|
+
return decodedData;
|
|
21
|
+
}
|
|
22
|
+
console.error(`[ERROR]: failed to read ${path}`);
|
|
23
|
+
return null;
|
|
14
24
|
}
|
|
15
25
|
export { getFilesystemSource };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "chiitiler",
|
|
4
|
-
"version": "1.22.
|
|
4
|
+
"version": "1.22.3",
|
|
5
5
|
"description": "Tiny map rendering server for MapLibre Style Spec",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"lru-cache": "^11.3.5",
|
|
51
51
|
"maplibre-gl": "^5.23.0",
|
|
52
52
|
"pmtiles": "^4.4.1",
|
|
53
|
-
"sharp": "^0.
|
|
53
|
+
"sharp": "^0.35.3"
|
|
54
54
|
}
|
|
55
55
|
}
|