@basemaps/lambda-tiler 6.25.0 → 6.28.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 +62 -0
- package/build/{__test__ → __tests__}/index.test.d.ts +0 -0
- package/build/{__test__ → __tests__}/index.test.d.ts.map +1 -1
- package/build/{__test__ → __tests__}/index.test.js +0 -0
- package/build/{__test__ → __tests__}/route.test.d.ts +0 -0
- package/build/{__test__ → __tests__}/route.test.d.ts.map +1 -1
- package/build/{__test__ → __tests__}/route.test.js +0 -0
- package/build/{__test__ → __tests__}/tiff.cache.test.d.ts +0 -0
- package/build/__tests__/tiff.cache.test.d.ts.map +1 -0
- package/build/{__test__ → __tests__}/tiff.cache.test.js +0 -0
- package/build/{__test__ → __tests__}/tile.cache.key.test.d.ts +0 -0
- package/build/__tests__/tile.cache.key.test.d.ts.map +1 -0
- package/build/{__test__ → __tests__}/tile.cache.key.test.js +0 -0
- package/build/{__test__ → __tests__}/tile.set.cache.test.d.ts +0 -0
- package/build/__tests__/tile.set.cache.test.d.ts.map +1 -0
- package/build/{__test__ → __tests__}/tile.set.cache.test.js +0 -0
- package/build/{__test__ → __tests__}/tile.set.test.d.ts +0 -0
- package/build/__tests__/tile.set.test.d.ts.map +1 -0
- package/build/{__test__ → __tests__}/tile.set.test.js +0 -5
- package/build/{__test__ → __tests__}/tile.style.json.test.d.ts +0 -0
- package/build/__tests__/tile.style.json.test.d.ts.map +1 -0
- package/build/{__test__ → __tests__}/tile.style.json.test.js +0 -0
- package/build/{__test__ → __tests__}/wmts.capability.test.d.ts +0 -0
- package/build/__tests__/wmts.capability.test.d.ts.map +1 -0
- package/build/{__test__ → __tests__}/wmts.capability.test.js +36 -9
- package/build/{__test__ → __tests__}/xyz.test.d.ts +0 -0
- package/build/{__test__ → __tests__}/xyz.test.d.ts.map +1 -1
- package/build/{__test__ → __tests__}/xyz.test.js +0 -4
- package/build/{__test__ → __tests__}/xyz.util.d.ts +0 -0
- package/build/__tests__/xyz.util.d.ts.map +1 -0
- package/build/{__test__ → __tests__}/xyz.util.js +0 -0
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -3
- package/build/routes/{__test__ → __tests__}/attribution.test.d.ts +0 -0
- package/build/routes/__tests__/attribution.test.d.ts.map +1 -0
- package/build/routes/{__test__ → __tests__}/attribution.test.js +3 -2
- package/build/routes/{__test__ → __tests__}/health.test.d.ts +0 -0
- package/build/routes/__tests__/health.test.d.ts.map +1 -0
- package/build/routes/{__test__ → __tests__}/health.test.js +0 -0
- package/build/routes/{__test__ → __tests__}/imagery.test.d.ts +0 -0
- package/build/routes/__tests__/imagery.test.d.ts.map +1 -0
- package/build/routes/{__test__ → __tests__}/imagery.test.js +0 -0
- package/build/routes/__tests__/wmts.test.d.ts +2 -0
- package/build/routes/__tests__/wmts.test.d.ts.map +1 -0
- package/build/routes/__tests__/wmts.test.js +31 -0
- package/build/routes/tile.json.js +1 -1
- package/build/routes/tile.wmts.d.ts +2 -0
- package/build/routes/tile.wmts.d.ts.map +1 -1
- package/build/routes/tile.wmts.js +23 -3
- package/build/tile.set.cache.js +1 -1
- package/build/tile.set.raster.d.ts +1 -6
- package/build/tile.set.raster.d.ts.map +1 -1
- package/build/tile.set.raster.js +12 -22
- package/build/tile.set.vector.d.ts.map +1 -1
- package/build/tile.set.vector.js +3 -1
- package/build/wmts.capability.d.ts +12 -6
- package/build/wmts.capability.d.ts.map +1 -1
- package/build/wmts.capability.js +12 -11
- package/package.json +13 -14
- package/scripts/create.deployment.package.mjs +3 -3
- package/src/{__test__ → __tests__}/index.test.ts +0 -0
- package/src/{__test__ → __tests__}/route.test.ts +0 -0
- package/src/{__test__ → __tests__}/tiff.cache.test.ts +0 -0
- package/src/{__test__ → __tests__}/tile.cache.key.test.ts +0 -0
- package/src/{__test__ → __tests__}/tile.set.cache.test.ts +0 -0
- package/src/{__test__ → __tests__}/tile.set.test.ts +0 -7
- package/src/{__test__ → __tests__}/tile.style.json.test.ts +0 -0
- package/src/{__test__ → __tests__}/wmts.capability.test.ts +39 -8
- package/src/{__test__ → __tests__}/xyz.test.ts +0 -4
- package/src/{__test__ → __tests__}/xyz.util.ts +0 -0
- package/src/index.ts +2 -3
- package/src/routes/{__test__ → __tests__}/attribution.test.ts +3 -2
- package/src/routes/{__test__ → __tests__}/health.test.ts +0 -0
- package/src/routes/{__test__ → __tests__}/imagery.test.ts +0 -0
- package/src/routes/__tests__/wmts.test.ts +40 -0
- package/src/routes/tile.json.ts +1 -1
- package/src/routes/tile.wmts.ts +23 -3
- package/src/tile.set.cache.ts +1 -1
- package/src/tile.set.raster.ts +12 -21
- package/src/tile.set.vector.ts +2 -1
- package/src/wmts.capability.ts +21 -15
- package/tsconfig.tsbuildinfo +1 -1
- package/build/__test__/tiff.cache.test.d.ts.map +0 -1
- package/build/__test__/tile.cache.key.test.d.ts.map +0 -1
- package/build/__test__/tile.import.test.d.ts +0 -2
- package/build/__test__/tile.import.test.d.ts.map +0 -1
- package/build/__test__/tile.import.test.js +0 -115
- package/build/__test__/tile.set.cache.test.d.ts.map +0 -1
- package/build/__test__/tile.set.test.d.ts.map +0 -1
- package/build/__test__/tile.style.json.test.d.ts.map +0 -1
- package/build/__test__/wmts.capability.test.d.ts.map +0 -1
- package/build/__test__/xyz.util.d.ts.map +0 -1
- package/build/import/imagery.find.d.ts +0 -17
- package/build/import/imagery.find.d.ts.map +0 -1
- package/build/import/imagery.find.js +0 -38
- package/build/import/make.cog.d.ts +0 -5
- package/build/import/make.cog.d.ts.map +0 -1
- package/build/import/make.cog.js +0 -21
- package/build/routes/__test__/attribution.test.d.ts.map +0 -1
- package/build/routes/__test__/health.test.d.ts.map +0 -1
- package/build/routes/__test__/imagery.test.d.ts.map +0 -1
- package/build/routes/import.d.ts +0 -9
- package/build/routes/import.d.ts.map +0 -1
- package/build/routes/import.js +0 -61
- package/src/__test__/tile.import.test.ts +0 -140
- package/src/import/imagery.find.ts +0 -60
- package/src/import/make.cog.ts +0 -29
- package/src/routes/import.ts +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,68 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.28.0](https://github.com/linz/basemaps/compare/v6.27.0...v6.28.0) (2022-06-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **lambda-tiler:** remove console.log ([#2224](https://github.com/linz/basemaps/issues/2224)) ([addc742](https://github.com/linz/basemaps/commit/addc74270235fe6348e53391444a5570b02fea3e))
|
|
12
|
+
* **tiler:** down grade sharp to 0.29.2 as we are scaling webp past 16k ([#2237](https://github.com/linz/basemaps/issues/2237)) ([53cd5ef](https://github.com/linz/basemaps/commit/53cd5ef420698c2d8528735b5c02b84189c6b7f9))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **lambda-tiler:** tiff paths should allow trailing slashes ([#2223](https://github.com/linz/basemaps/issues/2223)) ([4cd4948](https://github.com/linz/basemaps/commit/4cd49487dddc3a70123437d1644ff3e22d9dc12f))
|
|
18
|
+
* **server:** bundle basemaps-server cli so its easier to install ([#2218](https://github.com/linz/basemaps/issues/2218)) ([8457b66](https://github.com/linz/basemaps/commit/8457b66be6d0f54decf43b515bb78853cefbc8ed))
|
|
19
|
+
* **sprites:** create sprites using sharp ([#2235](https://github.com/linz/basemaps/issues/2235)) ([e7b6a9e](https://github.com/linz/basemaps/commit/e7b6a9e9c95359dc866b40e7a6988837a71d9d96))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [6.27.0](https://github.com/linz/basemaps/compare/v6.26.0...v6.27.0) (2022-05-29)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **lambda-tiler:** do not serve mvt in the wrong projection ([#2212](https://github.com/linz/basemaps/issues/2212)) ([a68e588](https://github.com/linz/basemaps/commit/a68e5889f2d0394676dcc41d831d00ede3df115d))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* **cli:** allow overriding imagery names ([#2169](https://github.com/linz/basemaps/issues/2169)) ([5c3bdd8](https://github.com/linz/basemaps/commit/5c3bdd89b664dd85df2b48d709653b71bdc348f7))
|
|
36
|
+
* **cli:** Insert imagery and tileset config after cog creation complete ([#2191](https://github.com/linz/basemaps/issues/2191)) ([3ea5efd](https://github.com/linz/basemaps/commit/3ea5efd049b956f882a05c90471d764efb5d39fd))
|
|
37
|
+
* **cli:** make cogs will update the process job status if exists. ([#2180](https://github.com/linz/basemaps/issues/2180)) ([855ce1c](https://github.com/linz/basemaps/commit/855ce1cb1f7b8bff575be342184e5ac387684f09))
|
|
38
|
+
* **config:** add configuration parser and bundler ([#2200](https://github.com/linz/basemaps/issues/2200)) ([795e3f2](https://github.com/linz/basemaps/commit/795e3f224ee0b4cd1e66a242d05a1fd5357cae3a))
|
|
39
|
+
* **lambda-cog:** New lambda Cog for import api. ([#2207](https://github.com/linz/basemaps/issues/2207)) ([79f4ae7](https://github.com/linz/basemaps/commit/79f4ae70ea3fc16a37dd575b843a0b60a1365df4))
|
|
40
|
+
* **lambda-tiler:** Add file number limitation to import api. ([#2203](https://github.com/linz/basemaps/issues/2203)) ([4694e29](https://github.com/linz/basemaps/commit/4694e29a4444810391e72b290ec64f8b8541c369))
|
|
41
|
+
* **lambda-tiler:** allow selection of output format for wmts with ?format= ([#2211](https://github.com/linz/basemaps/issues/2211)) ([e32e1ed](https://github.com/linz/basemaps/commit/e32e1ed6f48f5d70c47b9fd81032ebc8662d3a72))
|
|
42
|
+
* **lambda-tiler:** Increase limit of total file size. ([#2205](https://github.com/linz/basemaps/issues/2205)) ([5246ea0](https://github.com/linz/basemaps/commit/5246ea0879a4bf6b20770fb633d63afac778d54d))
|
|
43
|
+
* **lambda-tiler:** increase the max number of tiffs to load at once to 25 ([#2219](https://github.com/linz/basemaps/issues/2219)) ([d7d30a8](https://github.com/linz/basemaps/commit/d7d30a843201be91933c8627d99988098d783cec))
|
|
44
|
+
* **lambda-tiler:** Load MaxImagePixelSize from import api. ([#2206](https://github.com/linz/basemaps/issues/2206)) ([b851934](https://github.com/linz/basemaps/commit/b85193401bc5df2ecb689c3801f62af71696cdf5))
|
|
45
|
+
* **server:** use a bundled `@basemaps/landing` to serve static assets ([#2202](https://github.com/linz/basemaps/issues/2202)) ([c60f518](https://github.com/linz/basemaps/commit/c60f518893fe037a03f8bfd489c84d8427481678))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# [6.26.0](https://github.com/linz/basemaps/compare/v6.25.0...v6.26.0) (2022-05-12)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* **lambda-tiler:** Fix the insert of processing job config and actually start job after inserting config. ([#2182](https://github.com/linz/basemaps/issues/2182)) ([65d9c84](https://github.com/linz/basemaps/commit/65d9c841d3cbdde1c9a3753f3ae81fd67c5aef80))
|
|
57
|
+
* **lambda-tiler:** remove vector_layers as maplibre uses it as a validator ([#2189](https://github.com/linz/basemaps/issues/2189)) ([457d978](https://github.com/linz/basemaps/commit/457d978527f2c42408562021cef7b48ff9ce1afb))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Features
|
|
61
|
+
|
|
62
|
+
* **lambda-tiler:** Remove the job id to use ulid and update HTTP status code. ([#2188](https://github.com/linz/basemaps/issues/2188)) ([7d72f0c](https://github.com/linz/basemaps/commit/7d72f0c94ce4eefe0342b01b1ac2c8c153fc7c10))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
6
68
|
# [6.25.0](https://github.com/linz/basemaps/compare/v6.24.2...v6.25.0) (2022-05-11)
|
|
7
69
|
|
|
8
70
|
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.test.d.ts","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"route.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/route.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiff.cache.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tiff.cache.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.cache.key.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tile.cache.key.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.set.cache.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tile.set.cache.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.set.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tile.set.test.ts"],"names":[],"mappings":""}
|
|
@@ -2,11 +2,6 @@ import { GoogleTms, Nztm2000Tms } from '@basemaps/geo';
|
|
|
2
2
|
import o from 'ospec';
|
|
3
3
|
import { TileSetRaster } from '../tile.set.raster.js';
|
|
4
4
|
o.spec('tile.set', () => {
|
|
5
|
-
o('basePath', () => {
|
|
6
|
-
const rec = { uri: 's3://test-bucket/3857/aerail/job123' };
|
|
7
|
-
o(TileSetRaster.basePath(rec)).equals('s3://test-bucket/3857/aerail/job123');
|
|
8
|
-
o(TileSetRaster.basePath(rec, '31223')).equals('s3://test-bucket/3857/aerail/job123/31223.tiff');
|
|
9
|
-
});
|
|
10
5
|
o('extent', () => {
|
|
11
6
|
o(new TileSetRaster('google', GoogleTms).extent.toBbox()).deepEquals([
|
|
12
7
|
-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892,
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.style.json.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tile.style.json.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wmts.capability.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/wmts.capability.test.ts"],"names":[],"mappings":"AAQA,OAAO,gCAAgC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bounds, Epsg, GoogleTms, Nztm2000QuadTms, Nztm2000Tms } from '@basemaps/geo';
|
|
1
|
+
import { Bounds, Epsg, GoogleTms, ImageFormat, Nztm2000QuadTms, Nztm2000Tms } from '@basemaps/geo';
|
|
2
2
|
import { TileSetName, V, VNodeElement } from '@basemaps/shared';
|
|
3
3
|
import { roundNumbersInString } from '@basemaps/test/build/rounding.js';
|
|
4
4
|
import { createHash } from 'crypto';
|
|
@@ -18,9 +18,27 @@ o.spec('WmtsCapabilities', () => {
|
|
|
18
18
|
const apiKey = 'secret1234';
|
|
19
19
|
const tileSet = new FakeTileSet(TileSetName.aerial, GoogleTms);
|
|
20
20
|
const tileSetImagery = new FakeTileSet('01E7PJFR9AMQFJ05X9G7FQ3XMW', GoogleTms);
|
|
21
|
+
o('should output the requested formats', () => {
|
|
22
|
+
const wmts = new WmtsCapabilities({
|
|
23
|
+
httpBase: 'https://basemaps.test',
|
|
24
|
+
provider: Provider,
|
|
25
|
+
layers: [tileSet],
|
|
26
|
+
apiKey,
|
|
27
|
+
formats: [ImageFormat.Avif],
|
|
28
|
+
}).toVNode();
|
|
29
|
+
const urls = tags(wmts, 'ResourceURL');
|
|
30
|
+
o(urls.length).equals(1);
|
|
31
|
+
o(urls[0].attrs.format).equals('image/avif');
|
|
32
|
+
o(urls[0].attrs.template).equals('https://basemaps.test/v1/tiles/aerial/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.avif?api=secret1234');
|
|
33
|
+
});
|
|
21
34
|
o('should build capability xml for tileset and projection', () => {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
23
|
-
const wmts = new WmtsCapabilities(
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
36
|
+
const wmts = new WmtsCapabilities({
|
|
37
|
+
httpBase: 'https://basemaps.test',
|
|
38
|
+
provider: Provider,
|
|
39
|
+
layers: [tileSet],
|
|
40
|
+
apiKey,
|
|
41
|
+
});
|
|
24
42
|
const raw = wmts.toVNode();
|
|
25
43
|
const serviceId = raw.find('ows:ServiceIdentification');
|
|
26
44
|
o((_a = serviceId === null || serviceId === void 0 ? void 0 : serviceId.find('ows:Abstract')) === null || _a === void 0 ? void 0 : _a.textContent).equals('the description');
|
|
@@ -73,12 +91,21 @@ o.spec('WmtsCapabilities', () => {
|
|
|
73
91
|
}
|
|
74
92
|
compareMatrix(tileMatrices[0], '0', 1, 559082264.028717);
|
|
75
93
|
compareMatrix(tileMatrices[10], '10', 1024, 545978.773465544);
|
|
76
|
-
const xml =
|
|
94
|
+
const xml = new WmtsCapabilities({
|
|
95
|
+
httpBase: 'https://basemaps.test',
|
|
96
|
+
provider: Provider,
|
|
97
|
+
layers: [tileSet],
|
|
98
|
+
apiKey,
|
|
99
|
+
}).toXml();
|
|
77
100
|
o(xml).deepEquals('<?xml version="1.0"?>\n' + (raw === null || raw === void 0 ? void 0 : raw.toString()));
|
|
78
101
|
o(createHash('sha256').update(Buffer.from(xml)).digest('base64')).equals('beknYyMt8v74vK4p84AS3c1OnBSJ+ZE0kan+mMVQS1A=');
|
|
79
102
|
});
|
|
80
103
|
o('should allow individual imagery sets', () => {
|
|
81
|
-
const raw = new WmtsCapabilities(
|
|
104
|
+
const raw = new WmtsCapabilities({
|
|
105
|
+
httpBase: 'https://basemaps.test',
|
|
106
|
+
provider: Provider,
|
|
107
|
+
layers: [tileSetImagery],
|
|
108
|
+
}).toVNode();
|
|
82
109
|
const tms = raw === null || raw === void 0 ? void 0 : raw.find('TileMatrixSet', 'ows:Identifier');
|
|
83
110
|
o(tms === null || tms === void 0 ? void 0 : tms.textContent).equals('EPSG:3857');
|
|
84
111
|
const urls = Array.from(raw ? raw.tags('ResourceURL') : []);
|
|
@@ -89,7 +116,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
89
116
|
o('should support multiple projections', () => {
|
|
90
117
|
var _a, _b, _c, _d;
|
|
91
118
|
const ts = [new FakeTileSet(TileSetName.aerial, Nztm2000Tms), new FakeTileSet(TileSetName.aerial, GoogleTms)];
|
|
92
|
-
const xml = new WmtsCapabilities('basemaps.test', Provider, ts);
|
|
119
|
+
const xml = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts });
|
|
93
120
|
const nodes = xml.toVNode();
|
|
94
121
|
const layers = tags(nodes, 'Layer');
|
|
95
122
|
o(layers.length).equals(1);
|
|
@@ -129,7 +156,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
129
156
|
new FakeTileSet(TileSetName.aerial, Nztm2000Tms, 'aerial-title'),
|
|
130
157
|
new FakeTileSet('01E7PJFR9AMQFJ05X9G7FQ3XMW', Nztm2000Tms, 'imagery-title'),
|
|
131
158
|
];
|
|
132
|
-
const nodes = new WmtsCapabilities('basemaps.test', Provider, ts).toVNode();
|
|
159
|
+
const nodes = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts }).toVNode();
|
|
133
160
|
const layers = tags(nodes, 'Layer');
|
|
134
161
|
o(layers.length).equals(2);
|
|
135
162
|
o((_a = layers[0].find('ows:Title')) === null || _a === void 0 ? void 0 : _a.textContent).equals('aerial-title');
|
|
@@ -142,7 +169,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
142
169
|
new FakeTileSet(`${TileSetName.aerial}:wairoa_urban_2014-2015_0-10m_RGBA`, Nztm2000Tms, 'wairoa_urban_2014-2015_0-10m_RGBA'),
|
|
143
170
|
new FakeTileSet(`${TileSetName.aerial}:west-coast_rural_2016-17_0-3m`, Nztm2000Tms, 'west-coast_rural_2016-17_0-3m'),
|
|
144
171
|
];
|
|
145
|
-
const nodes = new WmtsCapabilities('basemaps.test', Provider, ts).toVNode();
|
|
172
|
+
const nodes = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts }).toVNode();
|
|
146
173
|
const layers = tags(nodes, 'Layer');
|
|
147
174
|
o(layers.length).equals(2);
|
|
148
175
|
const boundingBoxes = tags(layers[0], 'ows:BoundingBox');
|
|
@@ -162,7 +189,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
162
189
|
];
|
|
163
190
|
ts[1].extentOverride = new Bounds(1, 2, 2, 2);
|
|
164
191
|
ts[2].tileSet.title = 'aerial_dunedin_urban';
|
|
165
|
-
const nodes = new WmtsCapabilities('basemaps.test', Provider, ts).toVNode();
|
|
192
|
+
const nodes = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts }).toVNode();
|
|
166
193
|
const allMatrixes = tags(nodes, 'TileMatrixSet');
|
|
167
194
|
o(allMatrixes[0].children[0].textContent).equals('EPSG:2193');
|
|
168
195
|
o(allMatrixes[1].children[0].textContent).equals('EPSG:2193');
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xyz.test.d.ts","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"xyz.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/xyz.test.ts"],"names":[],"mappings":""}
|
|
@@ -167,7 +167,6 @@ o.spec('LambdaXyz', () => {
|
|
|
167
167
|
const body = Buffer.from((_a = res.body) !== null && _a !== void 0 ? _a : '', 'base64').toString();
|
|
168
168
|
o(JSON.parse(body)).deepEquals({
|
|
169
169
|
tiles: [`https://tiles.test/v1/tiles/aerial/NZTM2000Quad/{z}/{x}/{y}.webp?api=${apiKey}`],
|
|
170
|
-
vector_layers: [],
|
|
171
170
|
tilejson: '3.0.0',
|
|
172
171
|
});
|
|
173
172
|
});
|
|
@@ -179,7 +178,6 @@ o.spec('LambdaXyz', () => {
|
|
|
179
178
|
const body = Buffer.from((_a = res.body) !== null && _a !== void 0 ? _a : '', 'base64').toString();
|
|
180
179
|
o(JSON.parse(body)).deepEquals({
|
|
181
180
|
tiles: [`https://tiles.test/v1/tiles/topographic/EPSG:3857/{z}/{x}/{y}.pbf?api=${apiKey}`],
|
|
182
|
-
vector_layers: [],
|
|
183
181
|
tilejson: '3.0.0',
|
|
184
182
|
});
|
|
185
183
|
});
|
|
@@ -195,7 +193,6 @@ o.spec('LambdaXyz', () => {
|
|
|
195
193
|
const body = Buffer.from((_a = res.body) !== null && _a !== void 0 ? _a : '', 'base64').toString();
|
|
196
194
|
o(JSON.parse(body)).deepEquals({
|
|
197
195
|
tiles: [`https://tiles.test/v1/tiles/fake-vector/EPSG:3857/{z}/{x}/{y}.pbf?api=${apiKey}`],
|
|
198
|
-
vector_layers: [],
|
|
199
196
|
maxzoom: 15,
|
|
200
197
|
minzoom: 3,
|
|
201
198
|
tilejson: '3.0.0',
|
|
@@ -213,7 +210,6 @@ o.spec('LambdaXyz', () => {
|
|
|
213
210
|
const body = Buffer.from((_a = res.body) !== null && _a !== void 0 ? _a : '', 'base64').toString();
|
|
214
211
|
o(JSON.parse(body)).deepEquals({
|
|
215
212
|
tiles: [`https://tiles.test/v1/tiles/fake-vector/NZTM2000Quad/{z}/{x}/{y}.pbf?api=${apiKey}`],
|
|
216
|
-
vector_layers: [],
|
|
217
213
|
maxzoom: 13,
|
|
218
214
|
minzoom: 0,
|
|
219
215
|
tilejson: '3.0.0',
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xyz.util.d.ts","sourceRoot":"","sources":["../../src/__tests__/xyz.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAQ,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,iBAAiB,CAajH;AAED,qBAAa,WAAY,SAAQ,aAAa;gBAChC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,SAAkB,EAAE,WAAW,SAAwB;CAIlH;AAED,qBAAa,iBAAkB,SAAQ,aAAa;gBACtC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa;CAIpD;AAED,eAAO,MAAM,QAAQ,EAAE,cA4BtB,CAAC"}
|
|
File without changes
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
2
2
|
export declare function handleRequest(req: LambdaHttpRequest): Promise<LambdaHttpResponse>;
|
|
3
|
-
export declare const handler: import("@linzjs/lambda/build/src/function").LambdaHandler<import("@linzjs/lambda/build/src/request.http").HttpRequestEvent, import("@linzjs/lambda/build/src/request.http").HttpResponse
|
|
3
|
+
export declare const handler: import("@linzjs/lambda/build/src/function").LambdaHandler<import("@linzjs/lambda/build/src/http/request.http").HttpRequestEvent, import("@linzjs/lambda/build/src/http/request.http").HttpResponse> & {
|
|
4
|
+
router: import("@linzjs/lambda/build/src/http/router").Router;
|
|
5
|
+
};
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAqB3E,wBAAsB,aAAa,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA2BvF;AAED,eAAO,MAAM,OAAO;;CAA2B,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import { createHash } from 'crypto';
|
|
|
8
8
|
import { Imagery } from './routes/imagery.js';
|
|
9
9
|
import { Esri } from './routes/esri/rest.js';
|
|
10
10
|
import { St } from './source.tracer.js';
|
|
11
|
-
import { Import } from './routes/import.js';
|
|
12
11
|
const app = new Router();
|
|
13
12
|
app.get('ping', Ping);
|
|
14
13
|
app.get('health', Health);
|
|
@@ -16,7 +15,6 @@ app.get('version', Version);
|
|
|
16
15
|
app.get('tiles', Tiles);
|
|
17
16
|
app.get('imagery', Imagery);
|
|
18
17
|
app.get('esri', Esri);
|
|
19
|
-
app.get('import', Import);
|
|
20
18
|
let slowTimer = null;
|
|
21
19
|
export async function handleRequest(req) {
|
|
22
20
|
// Reset the request tracing
|
|
@@ -45,4 +43,5 @@ export async function handleRequest(req) {
|
|
|
45
43
|
slowTimer = null;
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
|
-
export const handler = lf.http(
|
|
46
|
+
export const handler = lf.http(LogConfig.get());
|
|
47
|
+
handler.router.get('*', handleRequest);
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribution.test.d.ts","sourceRoot":"","sources":["../../../src/routes/__tests__/attribution.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { EpsgCode, GoogleTms, Nztm2000QuadTms, Nztm2000Tms, Stac, TileMatrixSets } from '@basemaps/geo';
|
|
2
2
|
import { HttpHeader } from '@linzjs/lambda';
|
|
3
3
|
import { Config } from '@basemaps/shared';
|
|
4
|
-
import { mockFileOperator } from '@basemaps/shared/build/file/
|
|
4
|
+
import { mockFileOperator } from '@basemaps/shared/build/file/__tests__/file.operator.test.helper.js';
|
|
5
5
|
import { round } from '@basemaps/test/build/rounding.js';
|
|
6
6
|
import o from 'ospec';
|
|
7
7
|
import sinon from 'sinon';
|
|
8
8
|
const sandbox = sinon.createSandbox();
|
|
9
9
|
import { TileSets } from '../../tile.set.cache.js';
|
|
10
10
|
import { TileSetRaster } from '../../tile.set.raster.js';
|
|
11
|
-
import { FakeTileSet, mockRequest, Provider } from '../../
|
|
11
|
+
import { FakeTileSet, mockRequest, Provider } from '../../__tests__/xyz.util.js';
|
|
12
12
|
import { attribution, createAttributionCollection } from '../attribution.js';
|
|
13
13
|
import { TileEtag } from '../tile.etag.js';
|
|
14
14
|
import { Attribution } from '@basemaps/attribution';
|
|
@@ -266,6 +266,7 @@ function makeImageRecord(id, name, x = 10) {
|
|
|
266
266
|
id,
|
|
267
267
|
name,
|
|
268
268
|
projection: EpsgCode.Google,
|
|
269
|
+
tileMatrix: 'WebMercatorQuad',
|
|
269
270
|
uri: 's3://bucket/path/' + name,
|
|
270
271
|
bounds: GoogleTms.tileToSourceBounds({ x, y: 10, z: 5 }),
|
|
271
272
|
files: [0, 1].map((i) => {
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.test.d.ts","sourceRoot":"","sources":["../../../src/routes/__tests__/health.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imagery.test.d.ts","sourceRoot":"","sources":["../../../src/routes/__tests__/imagery.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wmts.test.d.ts","sourceRoot":"","sources":["../../../src/routes/__tests__/wmts.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ImageFormat } from '@basemaps/geo';
|
|
2
|
+
import { LogConfig } from '@basemaps/shared';
|
|
3
|
+
import { LambdaUrlRequest } from '@linzjs/lambda';
|
|
4
|
+
import o from 'ospec';
|
|
5
|
+
import { getImageFormats } from '../tile.wmts.js';
|
|
6
|
+
o.spec('GetImageFormats', () => {
|
|
7
|
+
function newRequest(path, query) {
|
|
8
|
+
return new LambdaUrlRequest({
|
|
9
|
+
requestContext: { http: { method: 'GET' } },
|
|
10
|
+
headers: {},
|
|
11
|
+
rawPath: path,
|
|
12
|
+
rawQueryString: query,
|
|
13
|
+
isBase64Encoded: false,
|
|
14
|
+
}, {}, LogConfig.get());
|
|
15
|
+
}
|
|
16
|
+
o('should parse all formats', () => {
|
|
17
|
+
const req = newRequest('/v1/blank', 'format=png&format=jpeg');
|
|
18
|
+
const formats = getImageFormats(req);
|
|
19
|
+
o(formats).deepEquals([ImageFormat.Png, ImageFormat.Jpeg]);
|
|
20
|
+
});
|
|
21
|
+
o('should ignore bad formats', () => {
|
|
22
|
+
const req = newRequest('/v1/blank', 'format=fake&format=mvt');
|
|
23
|
+
const formats = getImageFormats(req);
|
|
24
|
+
o(formats).equals(undefined);
|
|
25
|
+
});
|
|
26
|
+
o('should de-dupe formats', () => {
|
|
27
|
+
const req = newRequest('/v1/blank', 'format=png&format=jpeg&format=png&format=jpeg&format=png&format=jpeg');
|
|
28
|
+
const formats = getImageFormats(req);
|
|
29
|
+
o(formats).deepEquals([ImageFormat.Png, ImageFormat.Jpeg]);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -22,7 +22,7 @@ export async function tileJson(req) {
|
|
|
22
22
|
const host = (_a = Env.get(Env.PublicUrlBase)) !== null && _a !== void 0 ? _a : '';
|
|
23
23
|
const tileUrl = [host, version, name, tileSet.fullName, getTileMatrixId(tileMatrix), '{z}', '{x}', '{y}'].join('/') +
|
|
24
24
|
`.${tileSet.format}?api=${apiKey}`;
|
|
25
|
-
const tileJson = { tiles: [tileUrl],
|
|
25
|
+
const tileJson = { tiles: [tileUrl], tilejson: '3.0.0' };
|
|
26
26
|
const maxZoom = TileMatrixSet.convertZoomLevel((_b = tileSet.tileSet.maxZoom) !== null && _b !== void 0 ? _b : 30, GoogleTms, tileMatrix, true);
|
|
27
27
|
const minZoom = TileMatrixSet.convertZoomLevel((_c = tileSet.tileSet.minZoom) !== null && _c !== void 0 ? _c : 0, GoogleTms, tileMatrix, true);
|
|
28
28
|
if (tileSet.tileSet.maxZoom)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.wmts.d.ts","sourceRoot":"","sources":["../../src/routes/tile.wmts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tile.wmts.d.ts","sourceRoot":"","sources":["../../src/routes/tile.wmts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AASnF,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,WAAW,EAAE,GAAG,SAAS,CAYjF;AAED;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmC9E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Config, TileSetType } from '@basemaps/config';
|
|
2
2
|
import { Env, TileSetName, tileWmtsFromPath } from '@basemaps/shared';
|
|
3
|
+
import { getImageFormat } from '@basemaps/tiler';
|
|
3
4
|
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
4
5
|
import { createHash } from 'crypto';
|
|
5
6
|
import { Router } from '../router.js';
|
|
@@ -7,6 +8,21 @@ import { TileSets } from '../tile.set.cache.js';
|
|
|
7
8
|
import { WmtsCapabilities } from '../wmts.capability.js';
|
|
8
9
|
import { NotFound, NotModified } from './response.js';
|
|
9
10
|
import { TileEtag } from './tile.etag.js';
|
|
11
|
+
export function getImageFormats(req) {
|
|
12
|
+
const formats = req.query.getAll('format');
|
|
13
|
+
if (formats == null || formats.length === 0)
|
|
14
|
+
return undefined;
|
|
15
|
+
const output = new Set();
|
|
16
|
+
for (const fmt of formats) {
|
|
17
|
+
const parsed = getImageFormat(fmt);
|
|
18
|
+
if (parsed == null)
|
|
19
|
+
continue;
|
|
20
|
+
output.add(parsed);
|
|
21
|
+
}
|
|
22
|
+
if (output.size === 0)
|
|
23
|
+
return undefined;
|
|
24
|
+
return [...output.values()];
|
|
25
|
+
}
|
|
10
26
|
/**
|
|
11
27
|
* Serve a WMTS request
|
|
12
28
|
*
|
|
@@ -27,10 +43,14 @@ export async function wmts(req) {
|
|
|
27
43
|
return NotFound;
|
|
28
44
|
const providerId = Config.Provider.id('linz');
|
|
29
45
|
const provider = await Config.Provider.get(providerId);
|
|
30
|
-
if (provider == null)
|
|
31
|
-
return NotFound;
|
|
32
46
|
const apiKey = Router.apiKey(req);
|
|
33
|
-
const xml = WmtsCapabilities
|
|
47
|
+
const xml = new WmtsCapabilities({
|
|
48
|
+
httpBase: host,
|
|
49
|
+
provider: provider !== null && provider !== void 0 ? provider : undefined,
|
|
50
|
+
layers: tileSets,
|
|
51
|
+
apiKey,
|
|
52
|
+
formats: getImageFormats(req),
|
|
53
|
+
}).toXml();
|
|
34
54
|
if (xml == null)
|
|
35
55
|
return NotFound;
|
|
36
56
|
const data = Buffer.from(xml);
|
package/build/tile.set.cache.js
CHANGED
|
@@ -54,7 +54,7 @@ export class TileSetCache {
|
|
|
54
54
|
}
|
|
55
55
|
// If we already have a copy and it hasn't been modified just return it
|
|
56
56
|
const existing = this.tileSets.get(tileSetId);
|
|
57
|
-
if ((existing === null || existing === void 0 ? void 0 : existing.tileSet.updatedAt) === tileSet.updatedAt) {
|
|
57
|
+
if (existing != null && (existing === null || existing === void 0 ? void 0 : existing.tileSet.updatedAt) === tileSet.updatedAt) {
|
|
58
58
|
return existing;
|
|
59
59
|
}
|
|
60
60
|
if (Config.isTileSetRaster(tileSet)) {
|
|
@@ -15,6 +15,7 @@ export interface TileSetResponse {
|
|
|
15
15
|
layersTotal: number;
|
|
16
16
|
contentType: string;
|
|
17
17
|
}
|
|
18
|
+
export declare function getTiffName(name: string): string;
|
|
18
19
|
export declare class TileSetRaster {
|
|
19
20
|
type: TileSetType.Raster;
|
|
20
21
|
tileMatrix: TileMatrixSet;
|
|
@@ -23,12 +24,6 @@ export declare class TileSetRaster {
|
|
|
23
24
|
extentOverride: Bounds;
|
|
24
25
|
components: TileSetNameComponents;
|
|
25
26
|
tileSet: ConfigTileSetRaster;
|
|
26
|
-
/**
|
|
27
|
-
* Return the location of a imagery `record`
|
|
28
|
-
* @param record
|
|
29
|
-
* @param name the COG to locate. Return just the directory if `null`
|
|
30
|
-
*/
|
|
31
|
-
static basePath(record: ConfigImagery, name?: string): string;
|
|
32
27
|
constructor(name: string, tileMatrix: TileMatrixSet);
|
|
33
28
|
get id(): string;
|
|
34
29
|
get fullName(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.set.raster.d.ts","sourceRoot":"","sources":["../src/tile.set.raster.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAEb,mBAAmB,EACnB,qBAAqB,EAErB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAQ,WAAW,EAAE,IAAI,EAAE,aAAa,EAAgC,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAoB,OAAO,EAAE,WAAW,EAAuB,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU1C,eAAO,MAAM,YAAY,gBAA0B,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAKD,qBAAa,aAAa;IACxB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAsB;IAE9C,UAAU,EAAE,aAAa,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;IAEvB,UAAU,EAAE,qBAAqB,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tile.set.raster.d.ts","sourceRoot":"","sources":["../src/tile.set.raster.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAEb,mBAAmB,EACnB,qBAAqB,EAErB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAQ,WAAW,EAAE,IAAI,EAAE,aAAa,EAAgC,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAoB,OAAO,EAAE,WAAW,EAAuB,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU1C,eAAO,MAAM,YAAY,gBAA0B,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAKD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,qBAAa,aAAa;IACxB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAsB;IAE9C,UAAU,EAAE,aAAa,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;IAEvB,UAAU,EAAE,qBAAqB,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC;gBAEjB,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa;IAMnD,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,uCAAuC;IACvC,IAAI,MAAM,IAAI,WAAW,CAExB;IAEK,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhD,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAmBhD,IAAI,CAAC,GAAG,EAAE,iBAAiB,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4BxF;;;;OAIG;IACI,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE;IA+B5D,OAAO,CAAC,cAAc;IAwBtB,oDAAoD;IACpD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAShD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;CAqB3C"}
|
package/build/tile.set.raster.js
CHANGED
|
@@ -11,10 +11,15 @@ import { TileEtag } from './routes/tile.etag.js';
|
|
|
11
11
|
import { St } from './source.tracer.js';
|
|
12
12
|
import { TiffCache } from './tiff.cache.js';
|
|
13
13
|
import { TileSets } from './tile.set.cache.js';
|
|
14
|
-
const LoadingQueue = pLimit(Env.getNumber(Env.TiffConcurrency,
|
|
14
|
+
const LoadingQueue = pLimit(Env.getNumber(Env.TiffConcurrency, 25));
|
|
15
15
|
export const TileComposer = new TileMakerSharp(256);
|
|
16
16
|
const DefaultResizeKernel = { in: 'lanczos3', out: 'lanczos3' };
|
|
17
17
|
const DefaultBackground = { r: 0, g: 0, b: 0, alpha: 0 };
|
|
18
|
+
export function getTiffName(name) {
|
|
19
|
+
if (name.endsWith('.tif') || name.endsWith('.tiff'))
|
|
20
|
+
return name;
|
|
21
|
+
return `${name}.tiff`;
|
|
22
|
+
}
|
|
18
23
|
export class TileSetRaster {
|
|
19
24
|
constructor(name, tileMatrix) {
|
|
20
25
|
this.type = TileSetType.Raster;
|
|
@@ -22,18 +27,6 @@ export class TileSetRaster {
|
|
|
22
27
|
this.tileMatrix = tileMatrix;
|
|
23
28
|
this.tiler = new Tiler(this.tileMatrix);
|
|
24
29
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Return the location of a imagery `record`
|
|
27
|
-
* @param record
|
|
28
|
-
* @param name the COG to locate. Return just the directory if `null`
|
|
29
|
-
*/
|
|
30
|
-
static basePath(record, name) {
|
|
31
|
-
if (name == null)
|
|
32
|
-
return record.uri;
|
|
33
|
-
if (record.uri.endsWith('/'))
|
|
34
|
-
throw new Error("Invalid uri ending with '/' " + record.uri);
|
|
35
|
-
return `${record.uri}/${name}.tiff`;
|
|
36
|
-
}
|
|
37
30
|
get id() {
|
|
38
31
|
return TileSets.id(this.fullName, this.tileMatrix);
|
|
39
32
|
}
|
|
@@ -92,16 +85,14 @@ export class TileSetRaster {
|
|
|
92
85
|
req.set('layers', layers.length);
|
|
93
86
|
if (TileEtag.isNotModified(req, cacheKey))
|
|
94
87
|
return NotModified;
|
|
95
|
-
req.timer.start('tile:compose');
|
|
96
88
|
const res = await TileComposer.compose({
|
|
97
89
|
layers,
|
|
98
90
|
format: xyz.ext,
|
|
99
91
|
background: (_a = this.tileSet.background) !== null && _a !== void 0 ? _a : DefaultBackground,
|
|
100
92
|
resizeKernel: (_b = this.tileSet.resizeKernel) !== null && _b !== void 0 ? _b : DefaultResizeKernel,
|
|
93
|
+
metrics: req.timer,
|
|
101
94
|
});
|
|
102
|
-
req.timer.end('tile:compose');
|
|
103
95
|
req.set('layersUsed', res.layers);
|
|
104
|
-
req.set('allLayersUsed', res.layers === layers.length);
|
|
105
96
|
req.set('bytes', res.buffer.byteLength);
|
|
106
97
|
const response = new LambdaHttpResponse(200, 'ok');
|
|
107
98
|
response.header(HttpHeader.ETag, cacheKey);
|
|
@@ -131,7 +122,6 @@ export class TileSetRaster {
|
|
|
131
122
|
}
|
|
132
123
|
const imagery = this.imagery.get(imgId);
|
|
133
124
|
if (imagery == null) {
|
|
134
|
-
console.log('Failed', { imagery, i: this.imagery, ts: this.tileSet.layers });
|
|
135
125
|
log === null || log === void 0 ? void 0 : log.warn({ layer: layer.name, projection: this.tileMatrix.projection.code, imgId }, 'Failed to lookup imagery');
|
|
136
126
|
continue;
|
|
137
127
|
}
|
|
@@ -147,16 +137,16 @@ export class TileSetRaster {
|
|
|
147
137
|
for (const c of record.files) {
|
|
148
138
|
if (!tileBounds.intersects(Bounds.fromJson(c)))
|
|
149
139
|
continue;
|
|
150
|
-
const
|
|
151
|
-
let existing = TiffCache.get(
|
|
140
|
+
const tiffPath = fsa.join(record.uri, getTiffName(c.name));
|
|
141
|
+
let existing = TiffCache.get(tiffPath);
|
|
152
142
|
if (existing == null) {
|
|
153
|
-
const source = fsa.source(
|
|
143
|
+
const source = fsa.source(tiffPath);
|
|
154
144
|
if (source == null) {
|
|
155
|
-
throw new Error(`Failed to create CogSource from ${
|
|
145
|
+
throw new Error(`Failed to create CogSource from ${tiffPath}`);
|
|
156
146
|
}
|
|
157
147
|
St.trace(source);
|
|
158
148
|
existing = new CogTiff(source);
|
|
159
|
-
TiffCache.set(
|
|
149
|
+
TiffCache.set(tiffPath, existing);
|
|
160
150
|
}
|
|
161
151
|
output.push(existing);
|
|
162
152
|
}
|