@basemaps/server 8.6.0 → 8.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/route.layers.js +41 -31
- package/build/route.layers.js.map +1 -1
- package/package.json +10 -10
- package/bin/basemaps-server.cjs +0 -142328
package/build/route.layers.js
CHANGED
|
@@ -1,46 +1,56 @@
|
|
|
1
|
-
import { ConfigProviderMemory
|
|
2
|
-
import {
|
|
1
|
+
import { ConfigProviderMemory } from '@basemaps/config';
|
|
2
|
+
import { GoogleTms, TileMatrixSets } from '@basemaps/geo';
|
|
3
3
|
import { getPreviewUrl, V } from '@basemaps/shared';
|
|
4
|
+
async function getAllImagery(cfg) {
|
|
5
|
+
const allImagery = [];
|
|
6
|
+
if (ConfigProviderMemory.is(cfg)) {
|
|
7
|
+
for (const obj of cfg.objects.values())
|
|
8
|
+
if (cfg.Imagery.is(obj))
|
|
9
|
+
allImagery.push(obj);
|
|
10
|
+
}
|
|
11
|
+
return Promise.resolve(allImagery);
|
|
12
|
+
}
|
|
4
13
|
export async function createLayersHtml(mem) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
14
|
+
const allImagery = await getAllImagery(mem);
|
|
15
|
+
if (allImagery.length === 0)
|
|
16
|
+
return 'No imagery found';
|
|
17
|
+
allImagery.sort((a, b) => a.title.localeCompare(b.title));
|
|
18
|
+
const showPreview = allImagery.length < 10;
|
|
10
19
|
const cards = [];
|
|
11
|
-
const
|
|
12
|
-
const showPreview = allImagery.size < 10;
|
|
13
|
-
for (const img of layers) {
|
|
20
|
+
for (const img of allImagery) {
|
|
14
21
|
let tileMatrix = TileMatrixSets.find(img.tileMatrix);
|
|
15
22
|
if (tileMatrix == null)
|
|
16
23
|
tileMatrix = GoogleTms;
|
|
17
24
|
const ts = ConfigProviderMemory.imageryToTileSet(img);
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
for (const o of ts.outputs ?? []) {
|
|
26
|
+
const ret = getPreviewUrl({ imagery: img, pipeline: o.name });
|
|
27
|
+
const els = [
|
|
28
|
+
V('div', { class: `layer-header`, style: 'display:flex; justify-content: space-around;' }, [
|
|
29
|
+
V('div', { class: 'layer-title' }, img.title),
|
|
30
|
+
V('div', { class: 'layer-tile-matrix' }, `TileMatrix: ${img.tileMatrix}`),
|
|
31
|
+
V('div', { class: 'layer-tile-epsg' }, tileMatrix.projection.toEpsgString()),
|
|
32
|
+
]),
|
|
33
|
+
];
|
|
34
|
+
if (showPreview)
|
|
35
|
+
els.push(V('img', { width: '600px', height: '315px', src: ret.url }));
|
|
36
|
+
cards.push(V('a', {
|
|
37
|
+
class: `layer layer-${img.id}`,
|
|
38
|
+
href: `/${ret.slug}?tileMatrix=${tileMatrix.identifier}&style=${ret.name}&pipeline=${o.name}`,
|
|
39
|
+
}, els));
|
|
40
|
+
}
|
|
33
41
|
}
|
|
34
42
|
const style = `
|
|
35
43
|
body {
|
|
36
44
|
font-family: 'Fira Sans', 'Open Sans';
|
|
37
45
|
}
|
|
46
|
+
.layer-grid {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-wrap: wrap;
|
|
49
|
+
gap: 1rem;
|
|
50
|
+
padding: 1rem;
|
|
51
|
+
}
|
|
38
52
|
.layer {
|
|
39
|
-
margin: auto;
|
|
40
|
-
margin-top: 32px;
|
|
41
53
|
width: 600px;
|
|
42
|
-
display: flex;
|
|
43
|
-
flex-direction: column;
|
|
44
54
|
padding: 16px;
|
|
45
55
|
box-shadow: 0px 2px 3px 0px rgba(0,0,0,.2509803922), 0px 0px 3px 0px rgba(0,0,0,.1490196078);
|
|
46
56
|
}
|
|
@@ -53,13 +63,13 @@ body {
|
|
|
53
63
|
padding-bottom: 16px;
|
|
54
64
|
display: flex;
|
|
55
65
|
flex-direction: column;
|
|
56
|
-
line-height: 1.
|
|
66
|
+
line-height: 1.5rem;
|
|
57
67
|
}
|
|
58
68
|
.layer-title {
|
|
59
69
|
font-weight: bold;
|
|
60
70
|
}
|
|
61
71
|
`;
|
|
62
|
-
return V('html', [V('head', [V('style', '__STYLE_TEXT__')]), V('body', cards)])
|
|
72
|
+
return V('html', [V('head', [V('style', '__STYLE_TEXT__')]), V('body', [V('div', { class: 'layer-grid' }, cards)])])
|
|
63
73
|
.toString()
|
|
64
74
|
.replace('__STYLE_TEXT__', style); // CSS gets escaped be escaped
|
|
65
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.layers.js","sourceRoot":"","sources":["../src/route.layers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"route.layers.js","sourceRoot":"","sources":["../src/route.layers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAEpD,KAAK,UAAU,aAAa,CAAC,GAA2B;IACtD,MAAM,UAAU,GAAoB,EAAE,CAAC;IAEvC,IAAI,oBAAoB,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE;YAAE,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAA2B;IAChE,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,EAAE,CAAC;iBAC7E,CAAC;aACH,CAAC;YAEF,IAAI,WAAW;gBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACvF,KAAK,CAAC,IAAI,CACR,CAAC,CACC,GAAG,EACH;gBACE,KAAK,EAAE,eAAe,GAAG,CAAC,EAAE,EAAE;gBAC9B,IAAI,EAAE,IAAI,GAAG,CAAC,IAAI,eAAe,UAAU,CAAC,UAAU,UAAU,GAAG,CAAC,IAAI,aAAa,CAAC,CAAC,IAAI,EAAE;aAC9F,EACD,GAAG,CACJ,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Bf,CAAC;IAEA,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACjH,QAAQ,EAAE;SACV,OAAO,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC,8BAA8B;AACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/server",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.10.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/linz/basemaps.git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"main": "./build/index.js",
|
|
20
20
|
"types": "./build/index.d.ts",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"test": "node --test",
|
|
22
|
+
"test": "node --test \"build/**/*.test.js\"",
|
|
23
23
|
"bundle": "../../scripts/bundle.mjs package.json"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
@@ -45,24 +45,24 @@
|
|
|
45
45
|
"bin/"
|
|
46
46
|
],
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@basemaps/landing": "^
|
|
48
|
+
"@basemaps/landing": "^8.11.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"lerc": "^4.0.4",
|
|
52
52
|
"sharp": "^0.33.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@basemaps/config": "^8.
|
|
56
|
-
"@basemaps/config-loader": "^8.
|
|
57
|
-
"@basemaps/geo": "^8.
|
|
58
|
-
"@basemaps/lambda-tiler": "^8.
|
|
59
|
-
"@basemaps/landing": "^
|
|
60
|
-
"@basemaps/shared": "^8.
|
|
55
|
+
"@basemaps/config": "^8.10.1",
|
|
56
|
+
"@basemaps/config-loader": "^8.10.1",
|
|
57
|
+
"@basemaps/geo": "^8.9.0",
|
|
58
|
+
"@basemaps/lambda-tiler": "^8.10.1",
|
|
59
|
+
"@basemaps/landing": "^8.11.0",
|
|
60
|
+
"@basemaps/shared": "^8.9.2",
|
|
61
61
|
"@fastify/formbody": "^7.0.1",
|
|
62
62
|
"@fastify/static": "^6.5.0",
|
|
63
63
|
"cmd-ts": "^0.12.1",
|
|
64
64
|
"fastify": "^4.9.2",
|
|
65
65
|
"pretty-json-log": "^1.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "5a1984ab0e9b3939aab0db451d2f5e7aee1919af"
|
|
68
68
|
}
|