@basemaps/lambda-tiler 6.26.0 → 6.27.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 +26 -0
- package/build/__test__/wmts.capability.test.js +36 -9
- 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__/attribution.test.js +1 -0
- package/build/routes/__test__/wmts.test.d.ts +2 -0
- package/build/routes/__test__/wmts.test.d.ts.map +1 -0
- package/build/routes/__test__/wmts.test.js +31 -0
- 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 -1
- package/build/tile.set.cache.js +1 -1
- package/build/tile.set.raster.d.ts.map +1 -1
- package/build/tile.set.raster.js +1 -2
- package/build/tile.set.vector.d.ts.map +1 -1
- package/build/tile.set.vector.js +3 -1
- package/build/wmts.capability.d.ts +11 -5
- package/build/wmts.capability.d.ts.map +1 -1
- package/build/wmts.capability.js +10 -11
- package/package.json +6 -7
- package/src/__test__/wmts.capability.test.ts +39 -8
- package/src/index.ts +2 -3
- package/src/routes/__test__/attribution.test.ts +1 -0
- package/src/routes/__test__/wmts.test.ts +40 -0
- package/src/routes/tile.wmts.ts +23 -2
- package/src/tile.set.cache.ts +1 -1
- package/src/tile.set.raster.ts +1 -2
- package/src/tile.set.vector.ts +2 -1
- package/src/wmts.capability.ts +19 -14
- package/tsconfig.tsbuildinfo +1 -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/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/import.d.ts +0 -9
- package/build/routes/import.d.ts.map +0 -1
- package/build/routes/import.js +0 -62
- 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 -67
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.27.0](https://github.com/linz/basemaps/compare/v6.26.0...v6.27.0) (2022-05-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **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))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **cli:** allow overriding imagery names ([#2169](https://github.com/linz/basemaps/issues/2169)) ([5c3bdd8](https://github.com/linz/basemaps/commit/5c3bdd89b664dd85df2b48d709653b71bdc348f7))
|
|
17
|
+
* **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))
|
|
18
|
+
* **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))
|
|
19
|
+
* **config:** add configuration parser and bundler ([#2200](https://github.com/linz/basemaps/issues/2200)) ([795e3f2](https://github.com/linz/basemaps/commit/795e3f224ee0b4cd1e66a242d05a1fd5357cae3a))
|
|
20
|
+
* **lambda-cog:** New lambda Cog for import api. ([#2207](https://github.com/linz/basemaps/issues/2207)) ([79f4ae7](https://github.com/linz/basemaps/commit/79f4ae70ea3fc16a37dd575b843a0b60a1365df4))
|
|
21
|
+
* **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))
|
|
22
|
+
* **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))
|
|
23
|
+
* **lambda-tiler:** Increase limit of total file size. ([#2205](https://github.com/linz/basemaps/issues/2205)) ([5246ea0](https://github.com/linz/basemaps/commit/5246ea0879a4bf6b20770fb633d63afac778d54d))
|
|
24
|
+
* **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))
|
|
25
|
+
* **lambda-tiler:** Load MaxImagePixelSize from import api. ([#2206](https://github.com/linz/basemaps/issues/2206)) ([b851934](https://github.com/linz/basemaps/commit/b85193401bc5df2ecb689c3801f62af71696cdf5))
|
|
26
|
+
* **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))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
# [6.26.0](https://github.com/linz/basemaps/compare/v6.25.0...v6.26.0) (2022-05-12)
|
|
7
33
|
|
|
8
34
|
|
|
@@ -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');
|
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);
|
|
@@ -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) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wmts.test.d.ts","sourceRoot":"","sources":["../../../src/routes/__test__/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
|
+
});
|
|
@@ -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,CAoC9E"}
|
|
@@ -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
|
*
|
|
@@ -30,7 +46,13 @@ export async function wmts(req) {
|
|
|
30
46
|
if (provider == null)
|
|
31
47
|
return NotFound;
|
|
32
48
|
const apiKey = Router.apiKey(req);
|
|
33
|
-
const xml = WmtsCapabilities
|
|
49
|
+
const xml = new WmtsCapabilities({
|
|
50
|
+
httpBase: host,
|
|
51
|
+
provider,
|
|
52
|
+
layers: tileSets,
|
|
53
|
+
apiKey,
|
|
54
|
+
formats: getImageFormats(req),
|
|
55
|
+
}).toXml();
|
|
34
56
|
if (xml == null)
|
|
35
57
|
return NotFound;
|
|
36
58
|
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)) {
|
|
@@ -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;IAE7B;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;gBAMjD,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;IA8BxF;;;;OAIG;IACI,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE;
|
|
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;IAE7B;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;gBAMjD,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;IA8BxF;;;;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,7 +11,7 @@ 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 };
|
|
@@ -131,7 +131,6 @@ export class TileSetRaster {
|
|
|
131
131
|
}
|
|
132
132
|
const imagery = this.imagery.get(imgId);
|
|
133
133
|
if (imagery == null) {
|
|
134
|
-
console.log('Failed', { imagery, i: this.imagery, ts: this.tileSet.layers });
|
|
135
134
|
log === null || log === void 0 ? void 0 : log.warn({ layer: layer.name, projection: this.tileMatrix.projection.code, imgId }, 'Failed to lookup imagery');
|
|
136
135
|
continue;
|
|
137
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.set.vector.d.ts","sourceRoot":"","sources":["../src/tile.set.vector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAqB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9G,OAAO,
|
|
1
|
+
{"version":3,"file":"tile.set.vector.d.ts","sourceRoot":"","sources":["../src/tile.set.vector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAqB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9G,OAAO,EAAa,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAO,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAKnF,cAAM,UAAU;IACd,KAAK,qCAA4C;IAEjD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAUxC;AAED,eAAO,MAAM,MAAM,YAAmB,CAAC;AAEvC,qBAAa,aAAa;IACxB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAsB;IAC9C,UAAU,EAAE,qBAAqB,CAAC;IAClC,UAAU,EAAE,aAAa,CAAC;IAC1B,OAAO,EAAE,mBAAmB,CAAC;gBACjB,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa;IAK7C,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,oCAAoC;IACpC,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAEK,IAAI,CAAC,GAAG,EAAE,iBAAiB,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAyBlF"}
|
package/build/tile.set.vector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TileSetNameParser, TileSetType } from '@basemaps/config';
|
|
2
|
-
import { VectorFormat } from '@basemaps/geo';
|
|
2
|
+
import { GoogleTms, VectorFormat } from '@basemaps/geo';
|
|
3
3
|
import { fsa } from '@basemaps/shared';
|
|
4
4
|
import { Cotar } from '@cotar/core';
|
|
5
5
|
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
@@ -44,6 +44,8 @@ export class TileSetVector {
|
|
|
44
44
|
async tile(req, xyz) {
|
|
45
45
|
if (xyz.ext !== VectorFormat.MapboxVectorTiles)
|
|
46
46
|
return NotFound;
|
|
47
|
+
if (xyz.tileMatrix.identifier !== GoogleTms.identifier)
|
|
48
|
+
return NotFound;
|
|
47
49
|
if (this.tileSet.layers.length > 1)
|
|
48
50
|
return new LambdaHttpResponse(500, 'Too many layers in tileset');
|
|
49
51
|
const [layer] = this.tileSet.layers;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Bounds, TileMatrixSet, WmtsProvider } from '@basemaps/geo';
|
|
1
|
+
import { Bounds, ImageFormat, TileMatrixSet, WmtsProvider } from '@basemaps/geo';
|
|
3
2
|
import { VNodeElement } from '@basemaps/shared';
|
|
4
3
|
import { TileSetRaster } from './tile.set.raster.js';
|
|
5
4
|
/**
|
|
6
5
|
* Default the tile matrix id to the projection of the TileMatrixSet
|
|
7
6
|
*/
|
|
8
7
|
export declare function getTileMatrixId(tileMatrix: TileMatrixSet): string;
|
|
8
|
+
export interface WmtsCapabilitiesParams {
|
|
9
|
+
httpBase: string;
|
|
10
|
+
provider: WmtsProvider;
|
|
11
|
+
layers: TileSetRaster[];
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
formats?: ImageFormat[];
|
|
14
|
+
}
|
|
9
15
|
export declare class WmtsCapabilities {
|
|
10
16
|
httpBase: string;
|
|
11
17
|
provider: WmtsProvider;
|
|
12
18
|
layers: Map<string, TileSetRaster[]>;
|
|
13
19
|
apiKey?: string;
|
|
14
20
|
tileMatrixSets: Map<string, TileMatrixSet>;
|
|
15
|
-
|
|
21
|
+
formats: ImageFormat[];
|
|
22
|
+
constructor(params: WmtsCapabilitiesParams);
|
|
16
23
|
buildWgs84BoundingBox(layers: TileSetRaster[], tagName?: string): VNodeElement;
|
|
17
24
|
buildBoundingBox(tms: TileMatrixSet, extent: Bounds): VNodeElement;
|
|
18
25
|
buildProvider(): VNodeElement[];
|
|
@@ -22,7 +29,6 @@ export declare class WmtsCapabilities {
|
|
|
22
29
|
buildStyle(): VNodeElement;
|
|
23
30
|
buildTileMatrixSet(tms: TileMatrixSet): VNodeElement;
|
|
24
31
|
toVNode(): VNodeElement;
|
|
25
|
-
|
|
26
|
-
static toXml(httpBase: string, provider: ConfigProvider, tileSet: TileSetRaster[], apiKey?: string): string;
|
|
32
|
+
toXml(): string;
|
|
27
33
|
}
|
|
28
34
|
//# sourceMappingURL=wmts.capability.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wmts.capability.d.ts","sourceRoot":"","sources":["../src/wmts.capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"wmts.capability.d.ts","sourceRoot":"","sources":["../src/wmts.capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAmB,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAiB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAiBrD;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAIjE;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,qBAAa,gBAAgB;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IAEvB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAa;IAEjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,6BAAoC;IAClD,OAAO,EAAE,WAAW,EAAE,CAAC;gBAEX,MAAM,EAAE,sBAAsB;IAoB1C,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,OAAO,SAAyB,GAAG,YAAY;IAe9F,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAQlE,aAAa,IAAI,YAAY,EAAE;IAkC/B,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAc5D,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAQtE,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,YAAY;IAuBjD,UAAU,IAAI,YAAY;IAI1B,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY;IAoBpD,OAAO,IAAI,YAAY;IAUvB,KAAK,IAAI,MAAM;CAGhB"}
|
package/build/wmts.capability.js
CHANGED
|
@@ -24,12 +24,13 @@ export function getTileMatrixId(tileMatrix) {
|
|
|
24
24
|
return tileMatrix.projection.toEpsgString();
|
|
25
25
|
}
|
|
26
26
|
export class WmtsCapabilities {
|
|
27
|
-
constructor(
|
|
27
|
+
constructor(params) {
|
|
28
|
+
var _a;
|
|
28
29
|
this.layers = new Map();
|
|
29
30
|
this.tileMatrixSets = new Map();
|
|
30
|
-
this.httpBase = httpBase;
|
|
31
|
-
this.provider = provider;
|
|
32
|
-
for (const layer of layers) {
|
|
31
|
+
this.httpBase = params.httpBase;
|
|
32
|
+
this.provider = params.provider;
|
|
33
|
+
for (const layer of params.layers) {
|
|
33
34
|
// TODO is grouping by name the best option
|
|
34
35
|
let existing = this.layers.get(layer.fullName);
|
|
35
36
|
if (existing == null) {
|
|
@@ -40,7 +41,8 @@ export class WmtsCapabilities {
|
|
|
40
41
|
existing.push(layer);
|
|
41
42
|
this.tileMatrixSets.set(layer.tileMatrix.identifier, layer.tileMatrix);
|
|
42
43
|
}
|
|
43
|
-
this.apiKey = apiKey;
|
|
44
|
+
this.apiKey = params.apiKey;
|
|
45
|
+
this.formats = (_a = params.formats) !== null && _a !== void 0 ? _a : ImageFormatOrder;
|
|
44
46
|
}
|
|
45
47
|
buildWgs84BoundingBox(layers, tagName = 'ows:WGS84BoundingBox') {
|
|
46
48
|
let bbox = wgs84Extent(layers[0]);
|
|
@@ -127,9 +129,9 @@ export class WmtsCapabilities {
|
|
|
127
129
|
...layers.map((layer) => this.buildBoundingBox(layer.tileMatrix, layer.extent)),
|
|
128
130
|
this.buildWgs84BoundingBox(layers),
|
|
129
131
|
this.buildStyle(),
|
|
130
|
-
...
|
|
132
|
+
...this.formats.map((fmt) => V('Format', 'image/' + fmt)),
|
|
131
133
|
...matrixSetNodes,
|
|
132
|
-
...
|
|
134
|
+
...this.formats.map((fmt) => this.buildResourceUrl(firstLayer, fmt)),
|
|
133
135
|
]);
|
|
134
136
|
}
|
|
135
137
|
buildStyle() {
|
|
@@ -164,10 +166,7 @@ export class WmtsCapabilities {
|
|
|
164
166
|
layers.push(this.buildTileMatrixSet(tms));
|
|
165
167
|
return V('Capabilities', CapabilitiesAttrs, [...this.buildProvider(), V('Contents', layers)]);
|
|
166
168
|
}
|
|
167
|
-
|
|
169
|
+
toXml() {
|
|
168
170
|
return '<?xml version="1.0"?>\n' + this.toVNode().toString();
|
|
169
171
|
}
|
|
170
|
-
static toXml(httpBase, provider, tileSet, apiKey) {
|
|
171
|
-
return new WmtsCapabilities(httpBase, provider, tileSet, apiKey).toString();
|
|
172
|
-
}
|
|
173
172
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/lambda-tiler",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.27.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/linz/basemaps.git",
|
|
@@ -22,18 +22,17 @@
|
|
|
22
22
|
"types": "./build/index.d.ts",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@basemaps/
|
|
26
|
-
"@basemaps/config": "^6.26.0",
|
|
25
|
+
"@basemaps/config": "^6.27.0",
|
|
27
26
|
"@basemaps/geo": "^6.26.0",
|
|
28
27
|
"@basemaps/lambda": "^6.7.0",
|
|
29
|
-
"@basemaps/shared": "^6.
|
|
28
|
+
"@basemaps/shared": "^6.27.0",
|
|
30
29
|
"@basemaps/tiler": "^6.26.0",
|
|
31
30
|
"@basemaps/tiler-sharp": "^6.26.0",
|
|
32
31
|
"@chunkd/fs": "^8.1.0",
|
|
33
32
|
"@cogeotiff/core": "^7.0.0",
|
|
34
33
|
"@cotar/core": "^5.3.0",
|
|
35
34
|
"@linzjs/geojson": "^6.21.1",
|
|
36
|
-
"@linzjs/lambda": "^
|
|
35
|
+
"@linzjs/lambda": "^3.0.1",
|
|
37
36
|
"p-limit": "^4.0.0",
|
|
38
37
|
"path-to-regexp": "^6.1.0",
|
|
39
38
|
"pixelmatch": "^5.1.0",
|
|
@@ -55,10 +54,10 @@
|
|
|
55
54
|
"devDependencies": {
|
|
56
55
|
"@basemaps/attribution": "^6.26.0",
|
|
57
56
|
"@types/aws-lambda": "^8.10.75",
|
|
58
|
-
"@types/node": "^
|
|
57
|
+
"@types/node": "^17.0.34",
|
|
59
58
|
"@types/pixelmatch": "^5.0.0",
|
|
60
59
|
"@types/sharp": "^0.29.3",
|
|
61
60
|
"pretty-json-log": "^1.0.0"
|
|
62
61
|
},
|
|
63
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c6aa61c20503cbc7f04cf31927f4e2b95aed34cb"
|
|
64
63
|
}
|
|
@@ -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';
|
|
@@ -21,8 +21,30 @@ o.spec('WmtsCapabilities', () => {
|
|
|
21
21
|
const tileSet = new FakeTileSet(TileSetName.aerial, GoogleTms);
|
|
22
22
|
const tileSetImagery = new FakeTileSet('01E7PJFR9AMQFJ05X9G7FQ3XMW', GoogleTms);
|
|
23
23
|
|
|
24
|
+
o('should output the requested formats', () => {
|
|
25
|
+
const wmts = new WmtsCapabilities({
|
|
26
|
+
httpBase: 'https://basemaps.test',
|
|
27
|
+
provider: Provider,
|
|
28
|
+
layers: [tileSet],
|
|
29
|
+
apiKey,
|
|
30
|
+
formats: [ImageFormat.Avif],
|
|
31
|
+
}).toVNode();
|
|
32
|
+
|
|
33
|
+
const urls = tags(wmts, 'ResourceURL');
|
|
34
|
+
o(urls.length).equals(1);
|
|
35
|
+
o(urls[0].attrs.format).equals('image/avif');
|
|
36
|
+
o(urls[0].attrs.template).equals(
|
|
37
|
+
'https://basemaps.test/v1/tiles/aerial/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.avif?api=secret1234',
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
24
41
|
o('should build capability xml for tileset and projection', () => {
|
|
25
|
-
const wmts = new WmtsCapabilities(
|
|
42
|
+
const wmts = new WmtsCapabilities({
|
|
43
|
+
httpBase: 'https://basemaps.test',
|
|
44
|
+
provider: Provider,
|
|
45
|
+
layers: [tileSet],
|
|
46
|
+
apiKey,
|
|
47
|
+
});
|
|
26
48
|
|
|
27
49
|
const raw = wmts.toVNode();
|
|
28
50
|
const serviceId = raw.find('ows:ServiceIdentification');
|
|
@@ -102,7 +124,12 @@ o.spec('WmtsCapabilities', () => {
|
|
|
102
124
|
compareMatrix(tileMatrices[0], '0', 1, 559082264.028717);
|
|
103
125
|
compareMatrix(tileMatrices[10], '10', 1024, 545978.773465544);
|
|
104
126
|
|
|
105
|
-
const xml = WmtsCapabilities
|
|
127
|
+
const xml = new WmtsCapabilities({
|
|
128
|
+
httpBase: 'https://basemaps.test',
|
|
129
|
+
provider: Provider,
|
|
130
|
+
layers: [tileSet],
|
|
131
|
+
apiKey,
|
|
132
|
+
}).toXml();
|
|
106
133
|
|
|
107
134
|
o(xml).deepEquals('<?xml version="1.0"?>\n' + raw?.toString());
|
|
108
135
|
|
|
@@ -112,7 +139,11 @@ o.spec('WmtsCapabilities', () => {
|
|
|
112
139
|
});
|
|
113
140
|
|
|
114
141
|
o('should allow individual imagery sets', () => {
|
|
115
|
-
const raw = new WmtsCapabilities(
|
|
142
|
+
const raw = new WmtsCapabilities({
|
|
143
|
+
httpBase: 'https://basemaps.test',
|
|
144
|
+
provider: Provider,
|
|
145
|
+
layers: [tileSetImagery],
|
|
146
|
+
}).toVNode();
|
|
116
147
|
|
|
117
148
|
const tms = raw?.find('TileMatrixSet', 'ows:Identifier');
|
|
118
149
|
|
|
@@ -128,7 +159,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
128
159
|
|
|
129
160
|
o('should support multiple projections', () => {
|
|
130
161
|
const ts = [new FakeTileSet(TileSetName.aerial, Nztm2000Tms), new FakeTileSet(TileSetName.aerial, GoogleTms)];
|
|
131
|
-
const xml = new WmtsCapabilities('basemaps.test', Provider, ts);
|
|
162
|
+
const xml = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts });
|
|
132
163
|
const nodes = xml.toVNode();
|
|
133
164
|
|
|
134
165
|
const layers = tags(nodes, 'Layer');
|
|
@@ -175,7 +206,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
175
206
|
new FakeTileSet(TileSetName.aerial, Nztm2000Tms, 'aerial-title'),
|
|
176
207
|
new FakeTileSet('01E7PJFR9AMQFJ05X9G7FQ3XMW', Nztm2000Tms, 'imagery-title'),
|
|
177
208
|
];
|
|
178
|
-
const nodes = new WmtsCapabilities('basemaps.test', Provider, ts).toVNode();
|
|
209
|
+
const nodes = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts }).toVNode();
|
|
179
210
|
const layers = tags(nodes, 'Layer');
|
|
180
211
|
o(layers.length).equals(2);
|
|
181
212
|
|
|
@@ -199,7 +230,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
199
230
|
'west-coast_rural_2016-17_0-3m',
|
|
200
231
|
),
|
|
201
232
|
];
|
|
202
|
-
const nodes = new WmtsCapabilities('basemaps.test', Provider, ts).toVNode();
|
|
233
|
+
const nodes = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts }).toVNode();
|
|
203
234
|
const layers = tags(nodes, 'Layer');
|
|
204
235
|
|
|
205
236
|
o(layers.length).equals(2);
|
|
@@ -223,7 +254,7 @@ o.spec('WmtsCapabilities', () => {
|
|
|
223
254
|
ts[1].extentOverride = new Bounds(1, 2, 2, 2);
|
|
224
255
|
|
|
225
256
|
ts[2].tileSet.title = 'aerial_dunedin_urban';
|
|
226
|
-
const nodes = new WmtsCapabilities('basemaps.test', Provider, ts).toVNode();
|
|
257
|
+
const nodes = new WmtsCapabilities({ httpBase: 'basemaps.test', provider: Provider, layers: ts }).toVNode();
|
|
227
258
|
|
|
228
259
|
const allMatrixes = tags(nodes, 'TileMatrixSet');
|
|
229
260
|
|
package/src/index.ts
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
|
|
|
13
12
|
const app = new Router();
|
|
14
13
|
|
|
@@ -18,7 +17,6 @@ app.get('version', Version);
|
|
|
18
17
|
app.get('tiles', Tiles);
|
|
19
18
|
app.get('imagery', Imagery);
|
|
20
19
|
app.get('esri', Esri);
|
|
21
|
-
app.get('import', Import);
|
|
22
20
|
|
|
23
21
|
let slowTimer: NodeJS.Timer | null = null;
|
|
24
22
|
export async function handleRequest(req: LambdaHttpRequest): Promise<LambdaHttpResponse> {
|
|
@@ -50,4 +48,5 @@ export async function handleRequest(req: LambdaHttpRequest): Promise<LambdaHttpR
|
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
export const handler = lf.http(
|
|
51
|
+
export const handler = lf.http(LogConfig.get());
|
|
52
|
+
handler.router.get('*', handleRequest);
|
|
@@ -268,6 +268,7 @@ function makeImageRecord(id: string, name: string, x = 10): ConfigImagery {
|
|
|
268
268
|
id,
|
|
269
269
|
name,
|
|
270
270
|
projection: EpsgCode.Google,
|
|
271
|
+
tileMatrix: 'WebMercatorQuad',
|
|
271
272
|
uri: 's3://bucket/path/' + name,
|
|
272
273
|
bounds: GoogleTms.tileToSourceBounds({ x, y: 10, z: 5 }),
|
|
273
274
|
files: [0, 1].map((i) => {
|