tileserver-gl-light 5.4.0 → 5.5.0-pre.0
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/CHANGELOG.md +3 -0
- package/docs/config.rst +158 -2
- package/docs/usage.rst +58 -3
- package/package.json +7 -6
- package/public/resources/maplibre-gl.js +4 -4
- package/public/resources/maplibre-gl.js.map +1 -1
- package/src/main.js +89 -14
- package/src/mbtiles_wrapper.js +5 -6
- package/src/pmtiles_adapter.js +413 -60
- package/src/render.js +48 -13
- package/src/serve_data.js +28 -9
- package/src/serve_rendered.js +78 -27
- package/src/serve_style.js +13 -8
- package/src/server.js +115 -25
- package/src/utils.js +79 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# tileserver-gl changelog
|
|
2
2
|
|
|
3
|
+
## 5.5.0-pre.0
|
|
4
|
+
* Add S3 support for PMTiles with multiple AWS credential profiles (https://github.com/maptiler/tileserver-gl/pull/1779) by @acalcutt
|
|
5
|
+
|
|
3
6
|
## 5.4.0
|
|
4
7
|
* Fix the issue where the tile URL cannot be correctly parsed with the HTTPS protocol when using an nginx proxy service (https://github.com/maptiler/tileserver-gl/pull/1578) by @dakanggo
|
|
5
8
|
* Use jemalloc as memory allocator in the docker image (https://github.com/maptiler/tileserver-gl/pull/1574) by @MichielMortier
|
package/docs/config.rst
CHANGED
|
@@ -225,7 +225,7 @@ Each item in this object defines one style (map). It can have the following opti
|
|
|
225
225
|
Each item specifies one data source which should be made accessible by the server. It has to have one of the following options:
|
|
226
226
|
|
|
227
227
|
* ``mbtiles`` -- name of the mbtiles file
|
|
228
|
-
* ``pmtiles`` -- name of the pmtiles file or
|
|
228
|
+
* ``pmtiles`` -- name of the pmtiles file, url, or S3 path.
|
|
229
229
|
|
|
230
230
|
For example::
|
|
231
231
|
|
|
@@ -238,6 +238,9 @@ For example::
|
|
|
238
238
|
},
|
|
239
239
|
"source3": {
|
|
240
240
|
"pmtiles": "https://foo.lan/source3.pmtiles"
|
|
241
|
+
},
|
|
242
|
+
"source4": {
|
|
243
|
+
"pmtiles": "s3://my-bucket/tiles/terrain.pmtiles"
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
|
|
@@ -260,6 +263,10 @@ For example::
|
|
|
260
263
|
"sparse_vector_tiles": {
|
|
261
264
|
"pmtiles": "custom_osm.pmtiles",
|
|
262
265
|
"sparse": true
|
|
266
|
+
},
|
|
267
|
+
"production-s3-tiles": {
|
|
268
|
+
"pmtiles": "s3://prod-bucket/tiles.pmtiles",
|
|
269
|
+
"s3Profile": "production"
|
|
263
270
|
}
|
|
264
271
|
}
|
|
265
272
|
|
|
@@ -281,6 +288,29 @@ Here are the available options for each data source:
|
|
|
281
288
|
When ``false`` (default), *tileserver-gl* returns a ``204 No Content`` for missing tiles, which typically signals the client to stop trying to load a substitute.
|
|
282
289
|
Default: ``false``.
|
|
283
290
|
|
|
291
|
+
``s3Profile`` (string)
|
|
292
|
+
Specifies the AWS credential profile to use for S3 PMTiles sources. The profile must be defined in your ``~/.aws/credentials`` file.
|
|
293
|
+
This is useful when you need to access multiple S3 buckets with different credentials.
|
|
294
|
+
Alternatively, you can specify the profile in the URL using ``?profile=profile-name``.
|
|
295
|
+
If both are specified, the configuration ``s3Profile`` takes precedence.
|
|
296
|
+
Optional, only applicable to PMTiles sources using S3 URLs.
|
|
297
|
+
|
|
298
|
+
``requestPayer`` (boolean)
|
|
299
|
+
Enables support for "requester pays" S3 buckets where the requester (not the bucket owner) pays for data transfer costs.
|
|
300
|
+
Set to ``true`` if accessing a requester pays bucket.
|
|
301
|
+
Can be specified in the URL using ``?requestPayer=true`` or in the configuration.
|
|
302
|
+
If both are specified, the configuration value takes precedence.
|
|
303
|
+
Default: ``false``.
|
|
304
|
+
Optional, only applicable to PMTiles sources using S3 URLs.
|
|
305
|
+
|
|
306
|
+
``s3Region`` (string)
|
|
307
|
+
Specifies the AWS region for the S3 bucket.
|
|
308
|
+
Important for optimizing performance and reducing data transfer costs when accessing AWS S3 buckets.
|
|
309
|
+
Can be specified in the URL using ``?region=region-name`` or in the configuration.
|
|
310
|
+
If both are specified, the configuration value takes precedence.
|
|
311
|
+
If not specified, uses ``AWS_REGION`` environment variable or defaults to ``us-east-1``.
|
|
312
|
+
Optional, only applicable to PMTiles sources using S3 URLs.
|
|
313
|
+
|
|
284
314
|
.. note::
|
|
285
315
|
These configuration options will be overridden by metadata in the MBTiles or PMTiles file. if corresponding properties exist in the file's metadata, you do not need to specify them in the data configuration.
|
|
286
316
|
|
|
@@ -331,7 +361,133 @@ For example::
|
|
|
331
361
|
|
|
332
362
|
Alternatively, you can use ``pmtiles://{source2}`` to reference existing data object from the config.
|
|
333
363
|
In this case, the server will look into the ``config.json`` to determine what file to use by data id.
|
|
334
|
-
For the config above, this is equivalent to ``pmtiles://source2.
|
|
364
|
+
For the config above, this is equivalent to ``pmtiles://source2.pmtiles``.
|
|
365
|
+
|
|
366
|
+
S3 and S3-Compatible Storage
|
|
367
|
+
-----------------------------
|
|
368
|
+
|
|
369
|
+
PMTiles files can be accessed directly from AWS S3 or S3-compatible storage services (such as Contabo, DigitalOcean Spaces, MinIO, etc.) using S3 URLs. This provides better performance and eliminates HTTP rate limiting issues.
|
|
370
|
+
|
|
371
|
+
**Supported URL Formats:**
|
|
372
|
+
|
|
373
|
+
1. **AWS S3 (default):**
|
|
374
|
+
``s3://bucket-name/path/to/file.pmtiles``
|
|
375
|
+
|
|
376
|
+
2. **S3-compatible storage with custom endpoint:**
|
|
377
|
+
``s3://endpoint-url/bucket-name/path/to/file.pmtiles``
|
|
378
|
+
|
|
379
|
+
**AWS Credentials:**
|
|
380
|
+
|
|
381
|
+
S3 sources require AWS credentials to be configured. The server will automatically use credentials from:
|
|
382
|
+
|
|
383
|
+
* Environment variables: ``AWS_ACCESS_KEY_ID``, ``AWS_SECRET_ACCESS_KEY``, ``AWS_REGION``
|
|
384
|
+
* AWS credentials file: ``~/.aws/credentials`` on Linux/macOS or ``C:\Users\USERNAME\.aws\credentials`` on Windows
|
|
385
|
+
* IAM role (when running on AWS EC2, ECS, or Lambda)
|
|
386
|
+
|
|
387
|
+
For S3-compatible storage providers, use the same AWS credential format with your provider's access keys.
|
|
388
|
+
|
|
389
|
+
Example using environment variables::
|
|
390
|
+
|
|
391
|
+
export AWS_ACCESS_KEY_ID=your_access_key
|
|
392
|
+
export AWS_SECRET_ACCESS_KEY=your_secret_key
|
|
393
|
+
export AWS_REGION=us-west-2
|
|
394
|
+
|
|
395
|
+
**Multiple AWS Credential Profiles:**
|
|
396
|
+
|
|
397
|
+
If you need to access S3 buckets with different credentials, you can use AWS credential profiles. Profiles are defined in your AWS credentials file (``~/.aws/credentials`` on Linux/macOS or ``C:\Users\USERNAME\.aws\credentials`` on Windows)::
|
|
398
|
+
|
|
399
|
+
[default]
|
|
400
|
+
aws_access_key_id=YOUR_DEFAULT_KEY
|
|
401
|
+
aws_secret_access_key=YOUR_DEFAULT_SECRET
|
|
402
|
+
|
|
403
|
+
[production]
|
|
404
|
+
aws_access_key_id=YOUR_PRODUCTION_KEY
|
|
405
|
+
aws_secret_access_key=YOUR_PRODUCTION_SECRET
|
|
406
|
+
|
|
407
|
+
[staging]
|
|
408
|
+
aws_access_key_id=YOUR_STAGING_KEY
|
|
409
|
+
aws_secret_access_key=YOUR_STAGING_SECRET
|
|
410
|
+
|
|
411
|
+
**S3 Configuration Options (Main Config Data Section):**
|
|
412
|
+
|
|
413
|
+
When configuring S3 sources in the main configuration file's ``data`` section, you can use URL query parameters or configuration properties. Configuration properties take precedence over URL parameters.
|
|
414
|
+
|
|
415
|
+
*Profile* - Specifies which AWS credential profile to use::
|
|
416
|
+
|
|
417
|
+
# URL parameter
|
|
418
|
+
"pmtiles": "s3://bucket/tiles.pmtiles?profile=production"
|
|
419
|
+
|
|
420
|
+
# Configuration property
|
|
421
|
+
"pmtiles": "s3://bucket/tiles.pmtiles",
|
|
422
|
+
"s3Profile": "production"
|
|
423
|
+
|
|
424
|
+
Precedence order (highest to lowest): Configuration property ``s3Profile``, URL parameter ``?profile=...``, default AWS credential chain.
|
|
425
|
+
|
|
426
|
+
*Region* - Specifies the AWS region (important for performance and cost optimization)::
|
|
427
|
+
|
|
428
|
+
# URL parameter
|
|
429
|
+
"pmtiles": "s3://bucket/tiles.pmtiles?region=us-west-2"
|
|
430
|
+
|
|
431
|
+
# Configuration property
|
|
432
|
+
"pmtiles": "s3://bucket/tiles.pmtiles",
|
|
433
|
+
"s3Region": "us-west-2"
|
|
434
|
+
|
|
435
|
+
Precedence order (highest to lowest): Configuration property ``s3Region``, URL parameter ``?region=...``, Environment variable ``AWS_REGION``, Default: ``us-east-1``.
|
|
436
|
+
|
|
437
|
+
*RequestPayer* - Enables "requester pays" buckets where you pay for data transfer::
|
|
438
|
+
|
|
439
|
+
# URL parameter
|
|
440
|
+
"pmtiles": "s3://bucket/tiles.pmtiles?requestPayer=true"
|
|
441
|
+
|
|
442
|
+
# Configuration property
|
|
443
|
+
"pmtiles": "s3://bucket/tiles.pmtiles",
|
|
444
|
+
"requestPayer": true
|
|
445
|
+
|
|
446
|
+
Precedence order (highest to lowest): Configuration property ``requestPayer``, URL parameter ``?requestPayer=true``, Default: ``false``.
|
|
447
|
+
|
|
448
|
+
**Complete Configuration Examples:**
|
|
449
|
+
|
|
450
|
+
Using URL parameters::
|
|
451
|
+
|
|
452
|
+
"data": {
|
|
453
|
+
"us-west-tiles": {
|
|
454
|
+
"pmtiles": "s3://prod-bucket/tiles.pmtiles?profile=production®ion=us-west-2"
|
|
455
|
+
},
|
|
456
|
+
"eu-requester-pays": {
|
|
457
|
+
"pmtiles": "s3://bucket/tiles.pmtiles?profile=prod®ion=eu-central-1&requestPayer=true"
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
Using configuration properties (recommended)::
|
|
462
|
+
|
|
463
|
+
"data": {
|
|
464
|
+
"us-west-tiles": {
|
|
465
|
+
"pmtiles": "s3://prod-bucket/tiles.pmtiles",
|
|
466
|
+
"s3Profile": "production",
|
|
467
|
+
"s3Region": "us-west-2"
|
|
468
|
+
},
|
|
469
|
+
"eu-requester-pays": {
|
|
470
|
+
"pmtiles": "s3://bucket/tiles.pmtiles",
|
|
471
|
+
"s3Profile": "production",
|
|
472
|
+
"s3Region": "eu-central-1",
|
|
473
|
+
"requestPayer": true
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
**Using S3 in Style JSON Sources:**
|
|
478
|
+
|
|
479
|
+
When referencing S3 sources from within a style JSON file, use the ``pmtiles://`` prefix with S3 URLs. You can only specify profile, region, and requestPayer using URL query parameters (configuration properties are not available in style JSON)::
|
|
480
|
+
|
|
481
|
+
"sources": {
|
|
482
|
+
"aws-tiles": {
|
|
483
|
+
"url": "pmtiles://s3://my-bucket/tiles.pmtiles?profile=production",
|
|
484
|
+
"type": "vector"
|
|
485
|
+
},
|
|
486
|
+
"spaces-tiles": {
|
|
487
|
+
"url": "pmtiles://s3://example-storage.com/my-bucket/tiles.pmtiles?region=nyc3",
|
|
488
|
+
"type": "vector"
|
|
489
|
+
}
|
|
490
|
+
}
|
|
335
491
|
|
|
336
492
|
Sprites
|
|
337
493
|
-------
|
package/docs/usage.rst
CHANGED
|
@@ -6,10 +6,10 @@ Getting started
|
|
|
6
6
|
======
|
|
7
7
|
::
|
|
8
8
|
|
|
9
|
-
Usage:
|
|
9
|
+
Usage: tileserver-gl [file] [options]
|
|
10
10
|
|
|
11
11
|
Options:
|
|
12
|
-
--file <file> MBTiles or PMTiles file
|
|
12
|
+
--file <file> MBTiles or PMTiles file (local path, http(s)://, s3://, pmtiles://, or mbtiles:// URL)
|
|
13
13
|
ignored if the configuration file is also specified
|
|
14
14
|
--mbtiles <file> (DEPRECIATED) MBTiles file
|
|
15
15
|
ignored if file is also specified
|
|
@@ -19,7 +19,10 @@ Getting started
|
|
|
19
19
|
-p, --port <port> Port [8080] (default: 8080)
|
|
20
20
|
-C|--no-cors Disable Cross-origin resource sharing headers
|
|
21
21
|
-u|--public_url <url> Enable exposing the server on subpaths, not necessarily the root of the domain
|
|
22
|
-
-V, --verbose
|
|
22
|
+
-V, --verbose [level] More verbose output (level 1-3)
|
|
23
|
+
-V, --verbose, -V 1, or --verbose 1: Important operations
|
|
24
|
+
-V 2 or --verbose 2: Detailed operations
|
|
25
|
+
-V 3 or --verbose 3: All requests and debug info
|
|
23
26
|
-s, --silent Less verbose output
|
|
24
27
|
-l|--log_file <file> output log file (defaults to standard out)
|
|
25
28
|
-f|--log_format <format> define the log format: https://github.com/expressjs/morgan#morganformat-options
|
|
@@ -27,6 +30,58 @@ Getting started
|
|
|
27
30
|
-h, --help display help for command
|
|
28
31
|
|
|
29
32
|
|
|
33
|
+
File Source Options
|
|
34
|
+
======
|
|
35
|
+
|
|
36
|
+
The `--file` option supports multiple source types:
|
|
37
|
+
|
|
38
|
+
**Local files:**
|
|
39
|
+
::
|
|
40
|
+
|
|
41
|
+
tileserver-gl --file ./data/zurich.mbtiles
|
|
42
|
+
tileserver-gl --file ./data/terrain.pmtiles
|
|
43
|
+
|
|
44
|
+
**HTTP/HTTPS URLs:**
|
|
45
|
+
::
|
|
46
|
+
|
|
47
|
+
tileserver-gl --file https://example.com/tiles.pmtiles
|
|
48
|
+
|
|
49
|
+
**S3 URLs:**
|
|
50
|
+
::
|
|
51
|
+
|
|
52
|
+
# Basic AWS S3
|
|
53
|
+
tileserver-gl --file s3://my-bucket/tiles.pmtiles
|
|
54
|
+
|
|
55
|
+
# With AWS credential profile
|
|
56
|
+
tileserver-gl --file "s3://my-bucket/tiles.pmtiles?profile=production"
|
|
57
|
+
|
|
58
|
+
# With specific region
|
|
59
|
+
tileserver-gl --file "s3://my-bucket/tiles.pmtiles?region=us-west-2"
|
|
60
|
+
|
|
61
|
+
# With profile and region
|
|
62
|
+
tileserver-gl --file "s3://my-bucket/tiles.pmtiles?profile=production®ion=eu-central-1"
|
|
63
|
+
|
|
64
|
+
# Requester-pays bucket
|
|
65
|
+
tileserver-gl --file "s3://bucket/tiles.pmtiles?requestPayer=true"
|
|
66
|
+
|
|
67
|
+
# All options combined
|
|
68
|
+
tileserver-gl --file "s3://bucket/tiles.pmtiles?profile=prod®ion=us-west-2&requestPayer=true"
|
|
69
|
+
|
|
70
|
+
# S3-compatible storage (e.g., DigitalOcean Spaces, Contabo)
|
|
71
|
+
tileserver-gl --file "s3://example-storage.com/my-bucket/tiles.pmtiles?profile=dev"
|
|
72
|
+
|
|
73
|
+
**Protocol prefixes:**
|
|
74
|
+
|
|
75
|
+
You can also use `pmtiles://` or `mbtiles://` prefixes to explicitly specify the file type:
|
|
76
|
+
::
|
|
77
|
+
|
|
78
|
+
tileserver-gl --file pmtiles://https://example.com/tiles.pmtiles
|
|
79
|
+
tileserver-gl --file "pmtiles://s3://my-bucket/tiles.pmtiles?profile=production"
|
|
80
|
+
tileserver-gl --file mbtiles://./data/zurich.mbtiles
|
|
81
|
+
|
|
82
|
+
.. note::
|
|
83
|
+
For S3 sources, AWS credentials must be configured via environment variables, AWS credentials file (`~/.aws/credentials` on Linux/macOS or `C:\Users\USERNAME\.aws\credentials` on Windows), or IAM roles. See the Configuration documentation for details on using AWS credential profiles.
|
|
84
|
+
|
|
30
85
|
Default preview style and configuration
|
|
31
86
|
======
|
|
32
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tileserver-gl-light",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0-pre.0",
|
|
4
4
|
"description": "Map tile server for JSON GL styles - serving vector tiles",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"bin": "src/main.js",
|
|
@@ -34,21 +34,22 @@
|
|
|
34
34
|
"docker": "docker build . && docker run --rm -i -p 8080:8080 $(docker build -q .)"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@aws-sdk/client-s3": "^3.922.0",
|
|
37
38
|
"@jsse/pbfont": "^0.3.0",
|
|
38
39
|
"@mapbox/mapbox-gl-rtl-text": "0.3.0",
|
|
39
40
|
"@mapbox/mbtiles": "0.12.1",
|
|
40
41
|
"@mapbox/polyline": "^1.2.1",
|
|
41
|
-
"@mapbox/sphericalmercator": "2.0.
|
|
42
|
+
"@mapbox/sphericalmercator": "2.0.2",
|
|
42
43
|
"@mapbox/vector-tile": "2.0.4",
|
|
43
44
|
"@maplibre/maplibre-gl-inspect": "1.7.1",
|
|
44
|
-
"@maplibre/maplibre-gl-style-spec": "
|
|
45
|
+
"@maplibre/maplibre-gl-style-spec": "24.2.0",
|
|
45
46
|
"@sindresorhus/fnv1a": "3.1.0",
|
|
46
47
|
"advanced-pool": "0.3.3",
|
|
47
|
-
"axios": "^1.
|
|
48
|
+
"axios": "^1.13.1",
|
|
48
49
|
"chokidar": "4.0.3",
|
|
49
50
|
"clone": "2.1.2",
|
|
50
51
|
"color": "5.0.0",
|
|
51
|
-
"commander": "14.0.
|
|
52
|
+
"commander": "14.0.2",
|
|
52
53
|
"copyfiles": "2.4.1",
|
|
53
54
|
"cors": "2.8.5",
|
|
54
55
|
"express": "5.1.0",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"http-shutdown": "1.2.2",
|
|
57
58
|
"leaflet": "1.9.4",
|
|
58
59
|
"leaflet-hash": "0.2.1",
|
|
59
|
-
"maplibre-gl": "5.
|
|
60
|
+
"maplibre-gl": "5.8.0",
|
|
60
61
|
"morgan": "1.10.1",
|
|
61
62
|
"pbf": "4.0.1",
|
|
62
63
|
"pmtiles": "4.3.0",
|