chiitiler 1.14.0 → 1.14.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/README.md +17 -47
- package/dist/render/rasterize.d.ts +1 -1
- package/dist/source/fs.d.ts +1 -1
- package/dist/source/index.js +2 -2
- package/dist/source/pmtiles.d.ts +2 -2
- package/dist/source/pmtiles.js +2 -2
- package/dist/source/s3.d.ts +1 -1
- package/package.json +51 -52
package/README.md
CHANGED
|
@@ -14,11 +14,17 @@ chii-tiler: "tiny" in Japanese is "chiisai", shorten into "chii"
|
|
|
14
14
|
- In this type of server, there is a de-facto - [maptiler/tileserver-gl](https://github.com/maptiler/tileserver-gl), but this is too big for me.
|
|
15
15
|
- I want a server accept style.json-url and respond raster tile, inspired by [developmentseed/titiler](https://github.com/developmentseed/titiler)
|
|
16
16
|
|
|
17
|
+
## usecases
|
|
18
|
+
|
|
19
|
+
- [MIERUNE/tiles](https://github.com/MIERUNE/tiles) - You can find example [here](https://mierune.github.io/tiles/color.html#11.62/43.064/141.3375)
|
|
20
|
+
- [dayjournal/qgis-amazonlocationservice-plugin](https://github.com/dayjournal/qgis-amazonlocationservice-plugin) - used in Maps feature
|
|
21
|
+
- [Allmaps Latest - Bluesky](https://bsky.app/profile/latest.allmaps.org)
|
|
22
|
+
|
|
17
23
|
## features
|
|
18
24
|
|
|
19
25
|
### /tiles
|
|
20
26
|
|
|
21
|
-
chiitiler provides you with `/tiles
|
|
27
|
+
chiitiler provides you with an endpoint `/tiles`. Once server launched, you can use the endpoint like this:
|
|
22
28
|
|
|
23
29
|
```planetext
|
|
24
30
|
http://localhost:3000/tiles/0/0/0.png?url=https://tile.openstreetmap.jp/styles/osm-bright/style.json
|
|
@@ -81,9 +87,6 @@ docker run -p 3000:3000 -d \
|
|
|
81
87
|
-e CHIITILER_S3CACHE_BUCKET=bucketname \
|
|
82
88
|
-e CHIITILER_S3_REGION=ap-northeast-1 \
|
|
83
89
|
ghcr.io/kanahiro/chiitiler
|
|
84
|
-
|
|
85
|
-
# you also can pass options
|
|
86
|
-
docker run -p 8000:8000 ghcr.io/kanahiro/chiitiler tile-server -p 8000 -c s3 -s3b bucketname -s3r ap-northeast-1
|
|
87
90
|
```
|
|
88
91
|
|
|
89
92
|
#### Environment Variables
|
|
@@ -105,56 +108,23 @@ you can pass server options via environment variables
|
|
|
105
108
|
| CHIITILER_S3_ENDPOINT | | s3 endpoint for caching/fetching |
|
|
106
109
|
| CHIITILER_S3_FORCE_PATH_STYLE | false | force path style for s3, needed for minio |
|
|
107
110
|
|
|
108
|
-
###
|
|
109
|
-
|
|
110
|
-
- Node.js v18 or v20
|
|
111
|
-
|
|
112
|
-
```sh
|
|
113
|
-
npm install
|
|
114
|
-
npm run build
|
|
115
|
-
node dist/main.js tile-server
|
|
116
|
-
# running server: http://localhost:3000
|
|
117
|
-
|
|
118
|
-
# develop
|
|
119
|
-
npm run dev
|
|
120
|
-
# running server: http://localhost:3000
|
|
121
|
-
# debug page: http://localhost:3000/debug
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
#### options
|
|
125
|
-
|
|
126
|
-
```sh
|
|
127
|
-
node dist/main.js tile-server -p 8000 -c file -ctl 60 -fcd cachedir -D
|
|
128
|
-
# -p: port number
|
|
129
|
-
# -c: cache method
|
|
130
|
-
# -ctl: cache ttl
|
|
131
|
-
# -fcd: cache directory
|
|
132
|
-
# -D: debug mode
|
|
133
|
-
|
|
134
|
-
node dist/main.js tile-server -c memory -ctl 60 -mci 1000
|
|
135
|
-
# -mci: max cache items
|
|
136
|
-
|
|
137
|
-
node dist/main.js tile-server -c s3 -s3b chiitiler -s3r ap-northeast-1
|
|
138
|
-
# -s3b: S3 bucket name for cache
|
|
139
|
-
# -s3r: S3 bucket region
|
|
140
|
-
# caution: TTL is not supported in S3 cache, please utilize S3 lifecycle policy
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
#### debug page
|
|
111
|
+
### debug page
|
|
144
112
|
|
|
145
|
-
- in debug mode, you can access
|
|
146
|
-
-
|
|
147
|
-
|
|
113
|
+
- in debug mode, you can access:
|
|
114
|
+
- debug page: <http://localhost:3000/debug>
|
|
115
|
+
- You can pass style.json url: <http://localhost:3000/debug?url=https://tile.openstreetmap.jp/styles/osm-bright/style.json>
|
|
116
|
+
- editor page: <http://localhost:3000/editor>
|
|
148
117
|
|
|
149
118
|
## supported protocols in style.json
|
|
150
119
|
|
|
151
120
|
- `http://` or `https://` protocol are used in Style Specification
|
|
152
121
|
- In addition, chiitiler supports following protocols:
|
|
153
122
|
- `s3://` for S3 bucket
|
|
154
|
-
- `file://` for
|
|
155
|
-
- `mbtiles://` for
|
|
156
|
-
- `pmtiles://`
|
|
157
|
-
-
|
|
123
|
+
- `file://` for file system
|
|
124
|
+
- `mbtiles://` for MBTIles files
|
|
125
|
+
- `pmtiles://` for PMTiles, remote or local or s3
|
|
126
|
+
- `cog://` experimental, for Cloud Optimized GeoTIFF. CRS must be EPSG:3857.
|
|
127
|
+
- Only when `http://` and `https://` chiitiler cache them with a method you specified.
|
|
158
128
|
|
|
159
129
|
### example
|
|
160
130
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RenderOptions } from '@maplibre/maplibre-gl-native';
|
|
2
2
|
import type { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
3
3
|
import type { Cache } from '../cache/index.js';
|
|
4
|
-
declare function render(style: StyleSpecification, renderOptions: RenderOptions, cache: Cache, mode: 'tile' | 'static'): Promise<Uint8Array
|
|
4
|
+
declare function render(style: StyleSpecification, renderOptions: RenderOptions, cache: Cache, mode: 'tile' | 'static'): Promise<Uint8Array<ArrayBufferLike>>;
|
|
5
5
|
declare function renderTile(style: StyleSpecification, z: number, x: number, y: number, options: {
|
|
6
6
|
tileSize: number;
|
|
7
7
|
cache: Cache;
|
package/dist/source/fs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function getFilesystemSource(uri: string): Promise<Buffer | null>;
|
|
1
|
+
declare function getFilesystemSource(uri: string): Promise<Buffer<ArrayBufferLike> | null>;
|
|
2
2
|
export { getFilesystemSource };
|
package/dist/source/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getFilesystemSource } from './fs.js';
|
|
2
2
|
import { getHttpSource } from './http.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getPmtilesSource } from './pmtiles.js';
|
|
4
4
|
import { getMbtilesSource } from './mbtiles.js';
|
|
5
5
|
import { getS3Source } from './s3.js';
|
|
6
6
|
import { getCogSource } from './cog.js';
|
|
@@ -22,7 +22,7 @@ async function getSource(uri, cache = noneCache()) {
|
|
|
22
22
|
else if (uri.startsWith('mbtiles://'))
|
|
23
23
|
data = await getMbtilesSource(uri);
|
|
24
24
|
else if (uri.startsWith('pmtiles://'))
|
|
25
|
-
data = await
|
|
25
|
+
data = await getPmtilesSource(uri, cache);
|
|
26
26
|
else if (uri.startsWith('cog://'))
|
|
27
27
|
data = await getCogSource(uri);
|
|
28
28
|
else
|
package/dist/source/pmtiles.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ import { type Cache } from '../cache/index.js';
|
|
|
4
4
|
* uri = pmtiles://http://url/to/file.pmtiles/{z}/{x}/{y}
|
|
5
5
|
* uri = pmtiles://s3://bucket/key/to/file.pmtiles/{z}/{x}/{y}
|
|
6
6
|
*/
|
|
7
|
-
declare function
|
|
8
|
-
export {
|
|
7
|
+
declare function getPmtilesSource(uri: string, cache?: Cache): Promise<Buffer | null>;
|
|
8
|
+
export { getPmtilesSource };
|
package/dist/source/pmtiles.js
CHANGED
|
@@ -72,7 +72,7 @@ class S3Source {
|
|
|
72
72
|
* uri = pmtiles://http://url/to/file.pmtiles/{z}/{x}/{y}
|
|
73
73
|
* uri = pmtiles://s3://bucket/key/to/file.pmtiles/{z}/{x}/{y}
|
|
74
74
|
*/
|
|
75
|
-
async function
|
|
75
|
+
async function getPmtilesSource(uri, cache = noneCache()) {
|
|
76
76
|
const pmtilesUri = uri
|
|
77
77
|
.replace('pmtiles://', '')
|
|
78
78
|
.replace(/\/\d+\/\d+\/\d+$/, '');
|
|
@@ -112,4 +112,4 @@ async function getPmtilesSoruce(uri, cache = noneCache()) {
|
|
|
112
112
|
cache.set(uri, buf);
|
|
113
113
|
return buf;
|
|
114
114
|
}
|
|
115
|
-
export {
|
|
115
|
+
export { getPmtilesSource };
|
package/dist/source/s3.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function getS3Source(uri: string): Promise<Buffer | null>;
|
|
1
|
+
declare function getS3Source(uri: string): Promise<Buffer<ArrayBuffer> | null>;
|
|
2
2
|
export { getS3Source };
|
package/package.json
CHANGED
|
@@ -1,53 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "chiitiler",
|
|
4
|
+
"version": "1.14.2",
|
|
5
|
+
"description": "Tiny map rendering server for MapLibre Style Spec",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npx esbuild --bundle src/main.ts --minify --outfile=build/main.cjs --platform=node --external:@maplibre/maplibre-gl-native --external:sharp",
|
|
13
|
+
"dev": "tsx watch src/main.ts tile-server -D",
|
|
14
|
+
"test:unit": "vitest src",
|
|
15
|
+
"test:coverage": "vitest src --coverage --coverage.provider=v8",
|
|
16
|
+
"test:integration": "vitest tests/integration.test.ts",
|
|
17
|
+
"test:benchmark": "vitest bench"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "Kanahiro Iguchi",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@tsconfig/node20": "^20.1.4",
|
|
24
|
+
"@types/better-sqlite3": "^7.6.10",
|
|
25
|
+
"@types/node": "^20.6.0",
|
|
26
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
27
|
+
"esbuild": "^0.25.0",
|
|
28
|
+
"image-size": "^1.1.1",
|
|
29
|
+
"ts-node": "^10.9.1",
|
|
30
|
+
"tsx": "^4.7.1",
|
|
31
|
+
"typescript": "^5.2.2",
|
|
32
|
+
"vitest": "^1.6.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@aws-sdk/client-s3": "^3.418.0",
|
|
36
|
+
"@hono/node-server": "^1.12.0",
|
|
37
|
+
"@mapbox/sphericalmercator": "^1.2.0",
|
|
38
|
+
"@mapbox/tilebelt": "^1.0.2",
|
|
39
|
+
"@maplibre/maplibre-gl-native": "^5.4.0",
|
|
40
|
+
"@maplibre/maplibre-gl-style-spec": "^20.2.0",
|
|
41
|
+
"better-sqlite3": "^9.6.0",
|
|
42
|
+
"commander": "^11.0.0",
|
|
43
|
+
"file-system-cache": "^2.4.4",
|
|
44
|
+
"higuruma": "^0.1.6",
|
|
45
|
+
"hono": "^4.5.4",
|
|
46
|
+
"lightning-pool": "^4.2.2",
|
|
47
|
+
"lru-cache": "^11.0.0",
|
|
48
|
+
"maplibre-gl": "^3.3.1",
|
|
49
|
+
"pmtiles": "^3.0.5",
|
|
50
|
+
"sharp": "^0.32.5"
|
|
51
|
+
}
|
|
52
|
+
}
|