@basemaps/lambda-tiler 6.19.0 → 6.20.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 +12 -0
- package/LICENSE +2 -2
- package/build/__test__/tile.style.json.test.d.ts +2 -0
- package/build/__test__/tile.style.json.test.d.ts.map +1 -0
- package/build/__test__/tile.style.json.test.js +33 -0
- package/build/__test__/xyz.test.js +24 -23
- package/build/cli/dump.js +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/routes/esri/rest.d.ts +10 -0
- package/build/routes/esri/rest.d.ts.map +1 -0
- package/build/routes/esri/rest.js +87 -0
- package/build/routes/imagery.d.ts +2 -0
- package/build/routes/imagery.d.ts.map +1 -1
- package/build/routes/imagery.js +3 -1
- package/build/routes/response.d.ts +4 -0
- package/build/routes/response.d.ts.map +1 -0
- package/build/routes/response.js +3 -0
- package/build/routes/tile.d.ts +0 -20
- package/build/routes/tile.d.ts.map +1 -1
- package/build/routes/tile.js +11 -161
- package/build/routes/tile.json.d.ts +10 -0
- package/build/routes/tile.json.d.ts.map +1 -0
- package/build/routes/tile.json.js +31 -0
- package/build/routes/tile.style.json.d.ts +10 -0
- package/build/routes/tile.style.json.d.ts.map +1 -0
- package/build/routes/tile.style.json.js +74 -0
- package/build/routes/tile.wmts.d.ts +9 -0
- package/build/routes/tile.wmts.d.ts.map +1 -0
- package/build/routes/tile.wmts.js +57 -0
- package/build/routes/tile.xyz.d.ts +13 -0
- package/build/routes/tile.xyz.d.ts.map +1 -0
- package/build/routes/tile.xyz.js +28 -0
- package/build/tile.set.raster.d.ts +2 -0
- package/build/tile.set.raster.d.ts.map +1 -1
- package/build/tile.set.raster.js +3 -1
- package/build/tile.set.vector.js +1 -1
- package/dist/index.js +10545 -9583
- package/dist/node_modules/color/README.md +7 -7
- package/dist/node_modules/color/index.js +173 -158
- package/dist/node_modules/color/package.json +18 -16
- package/dist/node_modules/color-convert/conversions.js +281 -310
- package/dist/node_modules/color-convert/index.js +27 -24
- package/dist/node_modules/color-convert/package.json +16 -14
- package/dist/node_modules/color-convert/route.js +22 -22
- package/dist/node_modules/color-name/package.json +17 -14
- package/dist/node_modules/color-string/package.json +5 -5
- package/dist/node_modules/decompress-response/index.d.ts +14 -21
- package/dist/node_modules/decompress-response/index.js +34 -16
- package/dist/node_modules/decompress-response/license +1 -1
- package/dist/node_modules/decompress-response/package.json +23 -17
- package/dist/node_modules/decompress-response/readme.md +2 -6
- package/dist/node_modules/detect-libc/package.json +0 -1
- package/dist/node_modules/mimic-response/index.d.ts +2 -2
- package/dist/node_modules/mimic-response/index.js +41 -2
- package/dist/node_modules/mimic-response/package.json +17 -17
- package/dist/node_modules/mimic-response/readme.md +22 -1
- package/dist/node_modules/node-abi/.circleci/config.yml +63 -0
- package/dist/node_modules/node-abi/.releaserc.json +9 -0
- package/dist/node_modules/node-abi/abi_registry.json +39 -4
- package/dist/node_modules/node-abi/index.js +5 -2
- package/dist/node_modules/node-abi/package.json +17 -16
- package/dist/node_modules/node-abi/test/index.js +7 -15
- package/dist/node_modules/node-addon-api/README.md +2 -2
- package/dist/node_modules/node-addon-api/except.gypi +20 -11
- package/dist/node_modules/node-addon-api/napi-inl.h +734 -196
- package/dist/node_modules/node-addon-api/napi.h +420 -164
- package/dist/node_modules/node-addon-api/noexcept.gypi +21 -11
- package/dist/node_modules/node-addon-api/package.json +43 -14
- package/dist/node_modules/node-addon-api/tools/clang-format.js +18 -17
- package/dist/node_modules/node-addon-api/tools/eslint-format.js +71 -0
- package/dist/node_modules/prebuild-install/CHANGELOG.md +24 -7
- package/dist/node_modules/prebuild-install/README.md +24 -4
- package/dist/node_modules/prebuild-install/asset.js +10 -10
- package/dist/node_modules/prebuild-install/bin.js +13 -13
- package/dist/node_modules/prebuild-install/download.js +22 -22
- package/dist/node_modules/prebuild-install/log.js +4 -4
- package/dist/node_modules/prebuild-install/node_modules/detect-libc/LICENSE +201 -0
- package/dist/node_modules/prebuild-install/node_modules/detect-libc/README.md +160 -0
- package/dist/node_modules/prebuild-install/node_modules/detect-libc/index.d.ts +11 -0
- package/dist/node_modules/prebuild-install/node_modules/detect-libc/lib/detect-libc.js +178 -0
- package/dist/node_modules/prebuild-install/node_modules/detect-libc/lib/process.js +16 -0
- package/dist/node_modules/prebuild-install/node_modules/detect-libc/package.json +71 -0
- package/dist/node_modules/prebuild-install/package.json +18 -19
- package/dist/node_modules/prebuild-install/proxy.js +10 -10
- package/dist/node_modules/prebuild-install/rc.js +12 -12
- package/dist/node_modules/prebuild-install/util.js +14 -14
- package/dist/node_modules/semver/package.json +1 -0
- package/dist/node_modules/sharp/README.md +2 -2
- package/dist/node_modules/sharp/binding.gyp +12 -9
- package/dist/node_modules/sharp/build/Release/sharp-linux-x64.node +0 -0
- package/dist/node_modules/sharp/install/dll-copy.js +6 -6
- package/dist/node_modules/sharp/install/libvips.js +4 -8
- package/dist/node_modules/sharp/lib/channel.js +11 -7
- package/dist/node_modules/sharp/lib/colour.js +42 -1
- package/dist/node_modules/sharp/lib/constructor.js +18 -31
- package/dist/node_modules/sharp/lib/input.js +45 -3
- package/dist/node_modules/sharp/lib/is.js +19 -5
- package/dist/node_modules/sharp/lib/libvips.js +4 -19
- package/dist/node_modules/sharp/lib/operation.js +28 -5
- package/dist/node_modules/sharp/lib/output.js +147 -16
- package/dist/node_modules/sharp/lib/sharp.js +31 -0
- package/dist/node_modules/sharp/lib/utility.js +3 -2
- package/dist/node_modules/sharp/package.json +32 -23
- package/dist/node_modules/sharp/src/common.cc +67 -11
- package/dist/node_modules/sharp/src/common.h +25 -5
- package/dist/node_modules/sharp/src/libvips/cplusplus/VConnection.cpp +0 -26
- package/dist/node_modules/sharp/src/libvips/cplusplus/VImage.cpp +54 -16
- package/dist/node_modules/sharp/src/libvips/cplusplus/VInterpolate.cpp +0 -13
- package/dist/node_modules/sharp/src/libvips/cplusplus/vips-operators.cpp +185 -1
- package/dist/node_modules/sharp/src/metadata.cc +14 -0
- package/dist/node_modules/sharp/src/metadata.h +1 -0
- package/dist/node_modules/sharp/src/operations.cc +29 -3
- package/dist/node_modules/sharp/src/operations.h +13 -2
- package/dist/node_modules/sharp/src/pipeline.cc +103 -35
- package/dist/node_modules/sharp/src/pipeline.h +23 -3
- package/dist/node_modules/sharp/src/utilities.cc +1 -1
- package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/THIRD-PARTY-NOTICES.md +2 -3
- package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/lib/libvips-cpp.so.42 +0 -0
- package/dist/node_modules/sharp/vendor/{8.10.6 → 8.11.3/linux-x64}/platform.json +0 -0
- package/dist/node_modules/sharp/vendor/8.11.3/linux-x64/versions.json +30 -0
- package/dist/node_modules/simple-get/.github/dependabot.yml +15 -0
- package/dist/node_modules/simple-get/.github/workflows/ci.yml +23 -0
- package/dist/node_modules/simple-get/README.md +17 -3
- package/dist/node_modules/simple-get/index.js +9 -0
- package/dist/node_modules/simple-get/package.json +27 -13
- package/dist/package-lock.json +51 -51
- package/dist/package.json +9 -9
- package/package.json +10 -10
- package/src/__test__/tile.style.json.test.ts +40 -0
- package/src/__test__/xyz.test.ts +32 -30
- package/src/cli/dump.ts +2 -2
- package/src/index.ts +2 -0
- package/src/routes/esri/rest.ts +90 -0
- package/src/routes/imagery.ts +3 -1
- package/src/routes/response.ts +4 -0
- package/src/routes/tile.json.ts +44 -0
- package/src/routes/tile.style.json.ts +77 -0
- package/src/routes/tile.ts +11 -183
- package/src/routes/tile.wmts.ts +59 -0
- package/src/routes/tile.xyz.ts +30 -0
- package/src/tile.set.raster.ts +4 -1
- package/src/tile.set.vector.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/node_modules/color-name/.eslintrc.json +0 -43
- package/dist/node_modules/color-name/test.js +0 -7
- package/dist/node_modules/node-abi/.travis.yml +0 -17
- package/dist/node_modules/node-abi/node_modules/semver/CHANGELOG.md +0 -39
- package/dist/node_modules/node-abi/node_modules/semver/LICENSE +0 -15
- package/dist/node_modules/node-abi/node_modules/semver/README.md +0 -412
- package/dist/node_modules/node-abi/node_modules/semver/bin/semver +0 -160
- package/dist/node_modules/node-abi/node_modules/semver/package.json +0 -60
- package/dist/node_modules/node-abi/node_modules/semver/range.bnf +0 -16
- package/dist/node_modules/node-abi/node_modules/semver/semver.js +0 -1483
- package/dist/node_modules/node-addon-api/CHANGELOG.md +0 -722
- package/dist/node_modules/sharp/build/Release/sharp.node +0 -0
- package/dist/node_modules/sharp/vendor/8.10.6/versions.json +0 -31
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Env } from '@basemaps/shared';
|
|
2
|
+
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
3
|
+
import { createHash } from 'crypto';
|
|
4
|
+
import { Router } from '../router.js';
|
|
5
|
+
import { NotModified } from './response.js';
|
|
6
|
+
import { TileEtag } from './tile.etag.js';
|
|
7
|
+
export async function tileJson(req) {
|
|
8
|
+
var _a;
|
|
9
|
+
const { version, rest, name } = Router.action(req);
|
|
10
|
+
const apiKey = Router.apiKey(req);
|
|
11
|
+
const host = (_a = Env.get(Env.PublicUrlBase)) !== null && _a !== void 0 ? _a : '';
|
|
12
|
+
const tileUrl = `${host}/${version}/${name}/${rest[0]}/${rest[1]}/{z}/{x}/{y}.pbf?api=${apiKey}`;
|
|
13
|
+
const tileJson = {
|
|
14
|
+
tiles: [tileUrl],
|
|
15
|
+
minzoom: 0,
|
|
16
|
+
maxzoom: 15,
|
|
17
|
+
format: 'pbf',
|
|
18
|
+
tilejson: '2.0.0',
|
|
19
|
+
};
|
|
20
|
+
const json = JSON.stringify(tileJson);
|
|
21
|
+
const data = Buffer.from(json);
|
|
22
|
+
const cacheKey = createHash('sha256').update(data).digest('base64');
|
|
23
|
+
if (TileEtag.isNotModified(req, cacheKey))
|
|
24
|
+
return NotModified;
|
|
25
|
+
const response = new LambdaHttpResponse(200, 'ok');
|
|
26
|
+
response.header(HttpHeader.ETag, cacheKey);
|
|
27
|
+
response.header(HttpHeader.CacheControl, 'max-age=120');
|
|
28
|
+
response.buffer(data, 'application/json');
|
|
29
|
+
req.set('bytes', data.byteLength);
|
|
30
|
+
return response;
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
2
|
+
/**
|
|
3
|
+
* Convert relative URLS into a full hostname url
|
|
4
|
+
* @param url possible url to update
|
|
5
|
+
* @param apiKey ApiKey to append with ?api= if required
|
|
6
|
+
* @returns Updated Url or empty string if url is empty
|
|
7
|
+
*/
|
|
8
|
+
export declare function convertRelativeUrl(url?: string, apiKey?: string): string;
|
|
9
|
+
export declare function styleJson(req: LambdaHttpRequest, fileName: string): Promise<LambdaHttpResponse>;
|
|
10
|
+
//# sourceMappingURL=tile.style.json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.style.json.d.ts","sourceRoot":"","sources":["../../src/routes/tile.style.json.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAOnF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAOxE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmDrG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Config, Env } from '@basemaps/shared';
|
|
2
|
+
import { fsa } from '@chunkd/fs';
|
|
3
|
+
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
4
|
+
import { createHash } from 'crypto';
|
|
5
|
+
import { URL } from 'url';
|
|
6
|
+
import { Router } from '../router.js';
|
|
7
|
+
import { NotFound, NotModified } from './response.js';
|
|
8
|
+
import { TileEtag } from './tile.etag.js';
|
|
9
|
+
/**
|
|
10
|
+
* Convert relative URLS into a full hostname url
|
|
11
|
+
* @param url possible url to update
|
|
12
|
+
* @param apiKey ApiKey to append with ?api= if required
|
|
13
|
+
* @returns Updated Url or empty string if url is empty
|
|
14
|
+
*/
|
|
15
|
+
export function convertRelativeUrl(url, apiKey) {
|
|
16
|
+
var _a;
|
|
17
|
+
if (url == null)
|
|
18
|
+
return '';
|
|
19
|
+
const host = (_a = Env.get(Env.PublicUrlBase)) !== null && _a !== void 0 ? _a : '';
|
|
20
|
+
if (!url.startsWith('/'))
|
|
21
|
+
return url; // Not relative ignore
|
|
22
|
+
const fullUrl = new URL(fsa.join(host, url));
|
|
23
|
+
if (apiKey)
|
|
24
|
+
fullUrl.searchParams.set('api', apiKey);
|
|
25
|
+
return fullUrl.toString().replace(/%7B/g, '{').replace(/%7D/g, '}');
|
|
26
|
+
}
|
|
27
|
+
export async function styleJson(req, fileName) {
|
|
28
|
+
const apiKey = Router.apiKey(req);
|
|
29
|
+
if (apiKey == null)
|
|
30
|
+
return new LambdaHttpResponse(400, 'Invalid API Key.');
|
|
31
|
+
const styleName = fileName.split('.json')[0];
|
|
32
|
+
// Get style Config from db
|
|
33
|
+
const dbId = Config.Style.id(styleName);
|
|
34
|
+
const styleConfig = await Config.Style.get(dbId);
|
|
35
|
+
if (styleConfig == null)
|
|
36
|
+
return NotFound;
|
|
37
|
+
// Prepare sources and add linz source
|
|
38
|
+
const style = styleConfig.style;
|
|
39
|
+
const sources = {};
|
|
40
|
+
for (const [key, value] of Object.entries(style.sources)) {
|
|
41
|
+
if (value.type === 'vector') {
|
|
42
|
+
value.url = convertRelativeUrl(value.url, apiKey);
|
|
43
|
+
}
|
|
44
|
+
else if (value.type === 'raster' && Array.isArray(value.tiles)) {
|
|
45
|
+
for (let i = 0; i < value.tiles.length; i++) {
|
|
46
|
+
value.tiles[i] = convertRelativeUrl(value.tiles[i], apiKey);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
sources[key] = value;
|
|
50
|
+
}
|
|
51
|
+
// prepare Style.json
|
|
52
|
+
const styleJson = {
|
|
53
|
+
/** Style.json version 8 */
|
|
54
|
+
version: 8,
|
|
55
|
+
id: style.id,
|
|
56
|
+
name: style.name,
|
|
57
|
+
sources,
|
|
58
|
+
layers: style.layers,
|
|
59
|
+
metadata: style.metadata || {},
|
|
60
|
+
glyphs: convertRelativeUrl(style.glyphs),
|
|
61
|
+
sprite: convertRelativeUrl(style.sprite),
|
|
62
|
+
};
|
|
63
|
+
const json = JSON.stringify(styleJson);
|
|
64
|
+
const data = Buffer.from(json);
|
|
65
|
+
const cacheKey = createHash('sha256').update(data).digest('base64');
|
|
66
|
+
if (TileEtag.isNotModified(req, cacheKey))
|
|
67
|
+
return NotModified;
|
|
68
|
+
const response = new LambdaHttpResponse(200, 'ok');
|
|
69
|
+
response.header(HttpHeader.ETag, cacheKey);
|
|
70
|
+
response.header(HttpHeader.CacheControl, 'no-store');
|
|
71
|
+
response.buffer(data, 'application/json');
|
|
72
|
+
req.set('bytes', data.byteLength);
|
|
73
|
+
return response;
|
|
74
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
2
|
+
/**
|
|
3
|
+
* Serve a WMTS request
|
|
4
|
+
*
|
|
5
|
+
* /v1/tiles/:tileSet/:tileMatrixSet/WMTSCapabilities.xml
|
|
6
|
+
* @example `/v1/tiles/aerial/NZTM2000Quad/WMTSCapabilities.xml`
|
|
7
|
+
*/
|
|
8
|
+
export declare function wmts(req: LambdaHttpRequest): Promise<LambdaHttpResponse>;
|
|
9
|
+
//# sourceMappingURL=tile.wmts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.wmts.d.ts","sourceRoot":"","sources":["../../src/routes/tile.wmts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AASnF;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA8B9E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Config } from '@basemaps/config';
|
|
2
|
+
import { Env, TileSetName, tileWmtsFromPath } from '@basemaps/shared';
|
|
3
|
+
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
4
|
+
import { createHash } from 'crypto';
|
|
5
|
+
import { Router } from '../router.js';
|
|
6
|
+
import { TileSets } from '../tile.set.cache.js';
|
|
7
|
+
import { WmtsCapabilities } from '../wmts.capability.js';
|
|
8
|
+
import { NotFound, NotModified } from './response.js';
|
|
9
|
+
import { TileEtag } from './tile.etag.js';
|
|
10
|
+
/**
|
|
11
|
+
* Serve a WMTS request
|
|
12
|
+
*
|
|
13
|
+
* /v1/tiles/:tileSet/:tileMatrixSet/WMTSCapabilities.xml
|
|
14
|
+
* @example `/v1/tiles/aerial/NZTM2000Quad/WMTSCapabilities.xml`
|
|
15
|
+
*/
|
|
16
|
+
export async function wmts(req) {
|
|
17
|
+
var _a;
|
|
18
|
+
const action = Router.action(req);
|
|
19
|
+
const wmtsData = tileWmtsFromPath(action.rest);
|
|
20
|
+
if (wmtsData == null)
|
|
21
|
+
return NotFound;
|
|
22
|
+
const host = (_a = Env.get(Env.PublicUrlBase)) !== null && _a !== void 0 ? _a : '';
|
|
23
|
+
req.timer.start('tileset:load');
|
|
24
|
+
const tileSets = await wmtsLoadTileSets(wmtsData.name, wmtsData.tileMatrix);
|
|
25
|
+
req.timer.end('tileset:load');
|
|
26
|
+
if (tileSets.length === 0)
|
|
27
|
+
return NotFound;
|
|
28
|
+
const providerId = Config.Provider.id('linz');
|
|
29
|
+
const provider = await Config.Provider.get(providerId);
|
|
30
|
+
if (provider == null)
|
|
31
|
+
return NotFound;
|
|
32
|
+
const apiKey = Router.apiKey(req);
|
|
33
|
+
const xml = WmtsCapabilities.toXml(host, provider, tileSets, apiKey);
|
|
34
|
+
if (xml == null)
|
|
35
|
+
return NotFound;
|
|
36
|
+
const data = Buffer.from(xml);
|
|
37
|
+
const cacheKey = createHash('sha256').update(data).digest('base64');
|
|
38
|
+
if (TileEtag.isNotModified(req, cacheKey))
|
|
39
|
+
return NotModified;
|
|
40
|
+
const response = new LambdaHttpResponse(200, 'ok');
|
|
41
|
+
response.header(HttpHeader.ETag, cacheKey);
|
|
42
|
+
response.header(HttpHeader.CacheControl, 'max-age=0');
|
|
43
|
+
response.buffer(data, 'text/xml');
|
|
44
|
+
req.set('bytes', data.byteLength);
|
|
45
|
+
return response;
|
|
46
|
+
}
|
|
47
|
+
async function wmtsLoadTileSets(name, tileMatrix) {
|
|
48
|
+
if (tileMatrix != null) {
|
|
49
|
+
const ts = await TileSets.get(name, tileMatrix);
|
|
50
|
+
if (ts == null || ts.isVector())
|
|
51
|
+
return [];
|
|
52
|
+
return [ts];
|
|
53
|
+
}
|
|
54
|
+
if (name === '')
|
|
55
|
+
name = TileSetName.aerial;
|
|
56
|
+
return (await TileSets.getAll(name, tileMatrix)).filter((f) => f.type === 'raster');
|
|
57
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
2
|
+
/**
|
|
3
|
+
* Serve a tile
|
|
4
|
+
*
|
|
5
|
+
* /v1/tiles/:tileSet/:tileMatrixSet/:z/:x/:y.:tileType
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* Vector Tile `/v1/tiles/topographic/EPSG:3857/2/1/1.pbf`
|
|
9
|
+
* Raster Tile `/v1/tiles/aerial/EPSG:3857/6/0/38.webp`
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function tileXyz(req: LambdaHttpRequest): Promise<LambdaHttpResponse>;
|
|
13
|
+
//# sourceMappingURL=tile.xyz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.xyz.d.ts","sourceRoot":"","sources":["../../src/routes/tile.xyz.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMvE;;;;;;;;;GASG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAYjF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { tileXyzFromPath } from '@basemaps/shared';
|
|
2
|
+
import { Router } from '../router.js';
|
|
3
|
+
import { TileSets } from '../tile.set.cache.js';
|
|
4
|
+
import { ValidateTilePath } from '../validate.js';
|
|
5
|
+
import { NotFound } from './response.js';
|
|
6
|
+
/**
|
|
7
|
+
* Serve a tile
|
|
8
|
+
*
|
|
9
|
+
* /v1/tiles/:tileSet/:tileMatrixSet/:z/:x/:y.:tileType
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* Vector Tile `/v1/tiles/topographic/EPSG:3857/2/1/1.pbf`
|
|
13
|
+
* Raster Tile `/v1/tiles/aerial/EPSG:3857/6/0/38.webp`
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export async function tileXyz(req) {
|
|
17
|
+
const action = Router.action(req);
|
|
18
|
+
const xyzData = tileXyzFromPath(action.rest);
|
|
19
|
+
if (xyzData == null)
|
|
20
|
+
return NotFound;
|
|
21
|
+
ValidateTilePath.validate(req, xyzData);
|
|
22
|
+
req.timer.start('tileset:load');
|
|
23
|
+
const tileSet = await TileSets.get(xyzData.name, xyzData.tileMatrix);
|
|
24
|
+
req.timer.end('tileset:load');
|
|
25
|
+
if (tileSet == null)
|
|
26
|
+
return NotFound;
|
|
27
|
+
return await tileSet.tile(req, xyzData);
|
|
28
|
+
}
|
|
@@ -3,10 +3,12 @@ import { ConfigImagery, ConfigTileSetRaster, TileSetType } from '@basemaps/confi
|
|
|
3
3
|
import { Bounds, Tile, TileMatrixSet } from '@basemaps/geo';
|
|
4
4
|
import { LogType, TileDataXyz } from '@basemaps/shared';
|
|
5
5
|
import { Tiler } from '@basemaps/tiler';
|
|
6
|
+
import { TileMakerSharp } from '@basemaps/tiler-sharp';
|
|
6
7
|
import { CogTiff } from '@cogeotiff/core';
|
|
7
8
|
import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
8
9
|
import { Metrics } from '@linzjs/metrics';
|
|
9
10
|
import { TileSetHandler } from './tile.set.js';
|
|
11
|
+
export declare const TileComposer: TileMakerSharp;
|
|
10
12
|
export interface TileSetResponse {
|
|
11
13
|
buffer: Buffer;
|
|
12
14
|
metrics: Metrics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.set.raster.d.ts","sourceRoot":"","sources":["../src/tile.set.raster.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAe,mBAAmB,EAAqB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACnH,OAAO,EAAE,MAAM,EAAQ,IAAI,EAAE,aAAa,EAAkB,MAAM,eAAe,CAAC;AAClF,OAAO,EAAoB,OAAO,EAAE,WAAW,EAAqC,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,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;AAK1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,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,qB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AAE,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;IAgC5D,OAAO,CAAC,cAAc;IAsBtB,oDAAoD;IACpD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAShD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;CAuBpC"}
|
package/build/tile.set.raster.js
CHANGED
|
@@ -2,14 +2,16 @@ import { TileSetNameParser, TileSetType } from '@basemaps/config';
|
|
|
2
2
|
import { Bounds, Epsg, TileMatrixSet, TileMatrixSets } from '@basemaps/geo';
|
|
3
3
|
import { Config, Env, fsa, titleizeImageryName, VectorFormat } from '@basemaps/shared';
|
|
4
4
|
import { Tiler } from '@basemaps/tiler';
|
|
5
|
+
import { TileMakerSharp } from '@basemaps/tiler-sharp';
|
|
5
6
|
import { CogTiff } from '@cogeotiff/core';
|
|
6
7
|
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
7
8
|
import pLimit from 'p-limit';
|
|
9
|
+
import { NotFound, NotModified } from './routes/response.js';
|
|
8
10
|
import { TileEtag } from './routes/tile.etag.js';
|
|
9
|
-
import { NotFound, NotModified, TileComposer } from './routes/tile.js';
|
|
10
11
|
import { TiffCache } from './tiff.cache.js';
|
|
11
12
|
import { TileSetHandler } from './tile.set.js';
|
|
12
13
|
const LoadingQueue = pLimit(Env.getNumber(Env.TiffConcurrency, 5));
|
|
14
|
+
export const TileComposer = new TileMakerSharp(256);
|
|
13
15
|
const DefaultResizeKernel = { in: 'lanczos3', out: 'lanczos3' };
|
|
14
16
|
const DefaultBackground = { r: 0, g: 0, b: 0, alpha: 0 };
|
|
15
17
|
export class TileSetRaster extends TileSetHandler {
|
package/build/tile.set.vector.js
CHANGED
|
@@ -2,7 +2,7 @@ import { TileSetType } from '@basemaps/config';
|
|
|
2
2
|
import { fsa, VectorFormat } from '@basemaps/shared';
|
|
3
3
|
import { Cotar } from '@cotar/core';
|
|
4
4
|
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
5
|
-
import { NotFound } from './routes/
|
|
5
|
+
import { NotFound } from './routes/response.js';
|
|
6
6
|
import { TileSetHandler } from './tile.set.js';
|
|
7
7
|
class CotarCache {
|
|
8
8
|
constructor() {
|