@basemaps/lambda-tiler 7.0.0 → 7.1.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.
Files changed (242) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/build/__tests__/config.data.d.ts +0 -1
  3. package/build/__tests__/config.data.js +2 -6
  4. package/build/__tests__/config.data.js.map +1 -1
  5. package/build/__tests__/index.test.d.ts +0 -1
  6. package/build/__tests__/index.test.js +28 -27
  7. package/build/__tests__/index.test.js.map +1 -1
  8. package/build/__tests__/tile.style.json.test.d.ts +0 -1
  9. package/build/__tests__/tile.style.json.test.js +38 -37
  10. package/build/__tests__/tile.style.json.test.js.map +1 -1
  11. package/build/__tests__/wmts.capability.test.d.ts +0 -1
  12. package/build/__tests__/wmts.capability.test.js +111 -122
  13. package/build/__tests__/wmts.capability.test.js.map +1 -1
  14. package/build/__tests__/xyz.util.d.ts +0 -1
  15. package/build/cli/render.preview.d.ts +0 -1
  16. package/build/cli/render.preview.js +13 -9
  17. package/build/cli/render.preview.js.map +1 -1
  18. package/build/cli/render.tile.d.ts +0 -1
  19. package/build/cli/render.tile.js +25 -17
  20. package/build/cli/render.tile.js.map +1 -1
  21. package/build/index.d.ts +0 -1
  22. package/build/index.js +24 -20
  23. package/build/index.js.map +1 -1
  24. package/build/routes/__tests__/attribution.test.d.ts +0 -1
  25. package/build/routes/__tests__/attribution.test.js +38 -37
  26. package/build/routes/__tests__/attribution.test.js.map +1 -1
  27. package/build/routes/__tests__/fonts.test.d.ts +0 -1
  28. package/build/routes/__tests__/fonts.test.js +61 -63
  29. package/build/routes/__tests__/fonts.test.js.map +1 -1
  30. package/build/routes/__tests__/health.test.d.ts +0 -1
  31. package/build/routes/__tests__/health.test.js +16 -16
  32. package/build/routes/__tests__/health.test.js.map +1 -1
  33. package/build/routes/__tests__/imagery.test.d.ts +0 -1
  34. package/build/routes/__tests__/imagery.test.js +10 -9
  35. package/build/routes/__tests__/imagery.test.js.map +1 -1
  36. package/build/routes/__tests__/memory.fs.d.ts +2 -3
  37. package/build/routes/__tests__/preview.index.test.d.ts +0 -1
  38. package/build/routes/__tests__/preview.index.test.js +88 -42
  39. package/build/routes/__tests__/preview.index.test.js.map +1 -1
  40. package/build/routes/__tests__/sprites.test.d.ts +0 -1
  41. package/build/routes/__tests__/sprites.test.js +34 -34
  42. package/build/routes/__tests__/sprites.test.js.map +1 -1
  43. package/build/routes/__tests__/tile.json.test.d.ts +0 -1
  44. package/build/routes/__tests__/tile.json.test.js +45 -51
  45. package/build/routes/__tests__/tile.json.test.js.map +1 -1
  46. package/build/routes/__tests__/tile.style.json.test.d.ts +0 -1
  47. package/build/routes/__tests__/tile.style.json.test.js +49 -50
  48. package/build/routes/__tests__/tile.style.json.test.js.map +1 -1
  49. package/build/routes/__tests__/wmts.test.d.ts +0 -1
  50. package/build/routes/__tests__/wmts.test.js +27 -20
  51. package/build/routes/__tests__/wmts.test.js.map +1 -1
  52. package/build/routes/__tests__/xyz.test.d.ts +0 -1
  53. package/build/routes/__tests__/xyz.test.js +97 -49
  54. package/build/routes/__tests__/xyz.test.js.map +1 -1
  55. package/build/routes/attribution.d.ts +1 -1
  56. package/build/routes/attribution.js +4 -5
  57. package/build/routes/attribution.js.map +1 -1
  58. package/build/routes/config.d.ts +0 -1
  59. package/build/routes/config.js +1 -2
  60. package/build/routes/config.js.map +1 -1
  61. package/build/routes/fonts.d.ts +0 -1
  62. package/build/routes/fonts.js +2 -3
  63. package/build/routes/fonts.js.map +1 -1
  64. package/build/routes/health.d.ts +1 -2
  65. package/build/routes/health.js +5 -15
  66. package/build/routes/health.js.map +1 -1
  67. package/build/routes/imagery.d.ts +0 -1
  68. package/build/routes/imagery.js +1 -1
  69. package/build/routes/imagery.js.map +1 -1
  70. package/build/routes/ping.d.ts +0 -1
  71. package/build/routes/ping.js +1 -1
  72. package/build/routes/ping.js.map +1 -1
  73. package/build/routes/preview.d.ts +6 -5
  74. package/build/routes/preview.index.d.ts +0 -1
  75. package/build/routes/preview.index.js +6 -5
  76. package/build/routes/preview.index.js.map +1 -1
  77. package/build/routes/preview.js +35 -10
  78. package/build/routes/preview.js.map +1 -1
  79. package/build/routes/sprites.d.ts +0 -1
  80. package/build/routes/sprites.js +2 -4
  81. package/build/routes/sprites.js.map +1 -1
  82. package/build/routes/tile.json.d.ts +0 -1
  83. package/build/routes/tile.json.js +10 -5
  84. package/build/routes/tile.json.js.map +1 -1
  85. package/build/routes/tile.style.json.d.ts +1 -1
  86. package/build/routes/tile.style.json.js +79 -16
  87. package/build/routes/tile.style.json.js.map +1 -1
  88. package/build/routes/tile.wmts.d.ts +0 -1
  89. package/build/routes/tile.wmts.js +8 -9
  90. package/build/routes/tile.wmts.js.map +1 -1
  91. package/build/routes/tile.xyz.d.ts +0 -1
  92. package/build/routes/tile.xyz.js.map +1 -1
  93. package/build/routes/tile.xyz.raster.d.ts +7 -8
  94. package/build/routes/tile.xyz.raster.js +17 -13
  95. package/build/routes/tile.xyz.raster.js.map +1 -1
  96. package/build/routes/tile.xyz.vector.d.ts +0 -1
  97. package/build/routes/tile.xyz.vector.js +4 -3
  98. package/build/routes/tile.xyz.vector.js.map +1 -1
  99. package/build/routes/version.d.ts +0 -1
  100. package/build/routes/version.js +3 -4
  101. package/build/routes/version.js.map +1 -1
  102. package/build/util/__test__/config.loader.test.d.ts +0 -1
  103. package/build/util/__test__/config.loader.test.js +35 -34
  104. package/build/util/__test__/config.loader.test.js.map +1 -1
  105. package/build/util/__test__/filter.test.d.ts +0 -1
  106. package/build/util/__test__/filter.test.js +17 -16
  107. package/build/util/__test__/filter.test.js.map +1 -1
  108. package/build/util/__test__/validate.test.d.ts +0 -1
  109. package/build/util/__test__/validate.test.js +26 -43
  110. package/build/util/__test__/validate.test.js.map +1 -1
  111. package/build/util/assets.provider.d.ts +5 -5
  112. package/build/util/assets.provider.js +8 -8
  113. package/build/util/assets.provider.js.map +1 -1
  114. package/build/util/config.cache.d.ts +2 -2
  115. package/build/util/config.cache.js +14 -3
  116. package/build/util/config.cache.js.map +1 -1
  117. package/build/util/config.loader.d.ts +0 -1
  118. package/build/util/config.loader.js +11 -12
  119. package/build/util/config.loader.js.map +1 -1
  120. package/build/util/cotar.serve.d.ts +3 -3
  121. package/build/util/cotar.serve.js +2 -2
  122. package/build/util/cotar.serve.js.map +1 -1
  123. package/build/util/etag.d.ts +0 -1
  124. package/build/util/etag.js.map +1 -1
  125. package/build/util/filter.d.ts +0 -1
  126. package/build/util/filter.js +4 -5
  127. package/build/util/filter.js.map +1 -1
  128. package/build/util/response.d.ts +0 -1
  129. package/build/util/source.cache.d.ts +8 -9
  130. package/build/util/source.cache.js +27 -24
  131. package/build/util/source.cache.js.map +1 -1
  132. package/build/util/swapping.lru.d.ts +0 -1
  133. package/build/util/swapping.lru.js +48 -7
  134. package/build/util/swapping.lru.js.map +1 -1
  135. package/build/util/validate.d.ts +17 -5
  136. package/build/util/validate.js +51 -15
  137. package/build/util/validate.js.map +1 -1
  138. package/build/wmts.capability.d.ts +1 -2
  139. package/build/wmts.capability.js +81 -12
  140. package/build/wmts.capability.js.map +1 -1
  141. package/bundle.sh +2 -2
  142. package/package.json +16 -18
  143. package/scripts/create.deployment.package.mjs +4 -11
  144. package/src/__tests__/config.data.ts +2 -6
  145. package/src/__tests__/index.test.ts +29 -27
  146. package/src/__tests__/tile.style.json.test.ts +40 -37
  147. package/src/__tests__/wmts.capability.test.ts +139 -120
  148. package/src/cli/render.preview.ts +14 -9
  149. package/src/cli/render.tile.ts +27 -18
  150. package/src/index.ts +28 -23
  151. package/src/routes/__tests__/attribution.test.ts +40 -37
  152. package/src/routes/__tests__/fonts.test.ts +68 -64
  153. package/src/routes/__tests__/health.test.ts +18 -17
  154. package/src/routes/__tests__/imagery.test.ts +11 -9
  155. package/src/routes/__tests__/preview.index.test.ts +114 -40
  156. package/src/routes/__tests__/sprites.test.ts +39 -34
  157. package/src/routes/__tests__/tile.json.test.ts +41 -39
  158. package/src/routes/__tests__/tile.style.json.test.ts +49 -46
  159. package/src/routes/__tests__/wmts.test.ts +28 -20
  160. package/src/routes/__tests__/xyz.test.ts +134 -55
  161. package/src/routes/attribution.ts +2 -2
  162. package/src/routes/config.ts +1 -0
  163. package/src/routes/fonts.ts +3 -3
  164. package/src/routes/health.ts +7 -13
  165. package/src/routes/imagery.ts +2 -1
  166. package/src/routes/ping.ts +1 -1
  167. package/src/routes/preview.index.ts +9 -5
  168. package/src/routes/preview.ts +44 -15
  169. package/src/routes/sprites.ts +4 -5
  170. package/src/routes/tile.json.ts +9 -2
  171. package/src/routes/tile.style.json.ts +89 -13
  172. package/src/routes/tile.wmts.ts +4 -3
  173. package/src/routes/tile.xyz.raster.ts +26 -22
  174. package/src/routes/tile.xyz.ts +1 -0
  175. package/src/routes/tile.xyz.vector.ts +5 -3
  176. package/src/routes/version.ts +3 -3
  177. package/src/util/__test__/config.loader.test.ts +38 -34
  178. package/src/util/__test__/filter.test.ts +19 -16
  179. package/src/util/__test__/validate.test.ts +28 -43
  180. package/src/util/assets.provider.ts +10 -9
  181. package/src/util/config.cache.ts +4 -3
  182. package/src/util/config.loader.ts +13 -13
  183. package/src/util/cotar.serve.ts +3 -2
  184. package/src/util/source.cache.ts +15 -26
  185. package/src/util/validate.ts +61 -14
  186. package/src/wmts.capability.ts +3 -3
  187. package/tsconfig.json +1 -0
  188. package/tsconfig.tsbuildinfo +1 -1
  189. package/build/__tests__/config.data.d.ts.map +0 -1
  190. package/build/__tests__/index.test.d.ts.map +0 -1
  191. package/build/__tests__/tile.style.json.test.d.ts.map +0 -1
  192. package/build/__tests__/wmts.capability.test.d.ts.map +0 -1
  193. package/build/__tests__/xyz.util.d.ts.map +0 -1
  194. package/build/cli/render.preview.d.ts.map +0 -1
  195. package/build/cli/render.tile.d.ts.map +0 -1
  196. package/build/index.d.ts.map +0 -1
  197. package/build/routes/__tests__/attribution.test.d.ts.map +0 -1
  198. package/build/routes/__tests__/fonts.test.d.ts.map +0 -1
  199. package/build/routes/__tests__/health.test.d.ts.map +0 -1
  200. package/build/routes/__tests__/imagery.test.d.ts.map +0 -1
  201. package/build/routes/__tests__/memory.fs.d.ts.map +0 -1
  202. package/build/routes/__tests__/preview.index.test.d.ts.map +0 -1
  203. package/build/routes/__tests__/sprites.test.d.ts.map +0 -1
  204. package/build/routes/__tests__/tile.json.test.d.ts.map +0 -1
  205. package/build/routes/__tests__/tile.style.json.test.d.ts.map +0 -1
  206. package/build/routes/__tests__/wmts.test.d.ts.map +0 -1
  207. package/build/routes/__tests__/xyz.test.d.ts.map +0 -1
  208. package/build/routes/attribution.d.ts.map +0 -1
  209. package/build/routes/config.d.ts.map +0 -1
  210. package/build/routes/fonts.d.ts.map +0 -1
  211. package/build/routes/health.d.ts.map +0 -1
  212. package/build/routes/imagery.d.ts.map +0 -1
  213. package/build/routes/ping.d.ts.map +0 -1
  214. package/build/routes/preview.d.ts.map +0 -1
  215. package/build/routes/preview.index.d.ts.map +0 -1
  216. package/build/routes/sprites.d.ts.map +0 -1
  217. package/build/routes/tile.json.d.ts.map +0 -1
  218. package/build/routes/tile.style.json.d.ts.map +0 -1
  219. package/build/routes/tile.wmts.d.ts.map +0 -1
  220. package/build/routes/tile.xyz.d.ts.map +0 -1
  221. package/build/routes/tile.xyz.raster.d.ts.map +0 -1
  222. package/build/routes/tile.xyz.vector.d.ts.map +0 -1
  223. package/build/routes/version.d.ts.map +0 -1
  224. package/build/util/__test__/config.loader.test.d.ts.map +0 -1
  225. package/build/util/__test__/filter.test.d.ts.map +0 -1
  226. package/build/util/__test__/validate.test.d.ts.map +0 -1
  227. package/build/util/assets.provider.d.ts.map +0 -1
  228. package/build/util/config.cache.d.ts.map +0 -1
  229. package/build/util/config.loader.d.ts.map +0 -1
  230. package/build/util/cotar.serve.d.ts.map +0 -1
  231. package/build/util/etag.d.ts.map +0 -1
  232. package/build/util/filter.d.ts.map +0 -1
  233. package/build/util/response.d.ts.map +0 -1
  234. package/build/util/source.cache.d.ts.map +0 -1
  235. package/build/util/source.tracer.d.ts +0 -18
  236. package/build/util/source.tracer.d.ts.map +0 -1
  237. package/build/util/source.tracer.js +0 -26
  238. package/build/util/source.tracer.js.map +0 -1
  239. package/build/util/swapping.lru.d.ts.map +0 -1
  240. package/build/util/validate.d.ts.map +0 -1
  241. package/build/wmts.capability.d.ts.map +0 -1
  242. package/src/util/source.tracer.ts +0 -38
@@ -1,8 +1,11 @@
1
+ import assert from 'node:assert';
2
+ import { describe, it } from 'node:test';
3
+
1
4
  import { ConfigImagery } from '@basemaps/config';
2
- import { GoogleTms, ImageFormat, Nztm2000QuadTms } from '@basemaps/geo';
5
+ import { GoogleTms, Nztm2000QuadTms } from '@basemaps/geo';
3
6
  import { V, VNodeElement } from '@basemaps/shared';
4
7
  import { roundNumbersInString } from '@basemaps/test/build/rounding.js';
5
- import o from 'ospec';
8
+
6
9
  import { WmtsCapabilities } from '../wmts.capability.js';
7
10
  import { Imagery2193, Imagery3857, Provider, TileSetAerial } from './config.data.js';
8
11
 
@@ -14,14 +17,14 @@ function listTag(node: VNodeElement | null | undefined, tag: string): string[] {
14
17
  return tags(node, tag).map((n) => n.toString());
15
18
  }
16
19
 
17
- o.spec('WmtsCapabilities', () => {
20
+ describe('WmtsCapabilities', () => {
18
21
  const apiKey = 'secret1234';
19
22
 
20
23
  const allImagery = new Map();
21
24
  allImagery.set(Imagery2193.id, Imagery2193);
22
25
  allImagery.set(Imagery3857.id, Imagery3857);
23
26
 
24
- o('should output the requested formats', () => {
27
+ it('should output the requested formats', () => {
25
28
  const wmts = new WmtsCapabilities({
26
29
  httpBase: 'https://basemaps.test',
27
30
  apiKey,
@@ -29,20 +32,21 @@ o.spec('WmtsCapabilities', () => {
29
32
 
30
33
  wmts.addTileMatrix(GoogleTms);
31
34
  for (const im of allImagery.values()) wmts.addImagery(im);
32
- wmts.addFormats(ImageFormat.Avif);
35
+ wmts.addFormats('avif');
33
36
  wmts.addProvider(Provider);
34
37
  wmts.addTileSet(TileSetAerial);
35
38
  const wmtsCapability = wmts.toVNode();
36
39
 
37
40
  const urls = tags(wmtsCapability, 'ResourceURL');
38
- o(urls.length).equals(1);
39
- o(urls[0].attrs.format).equals('image/avif');
40
- o(urls[0].attrs.template).equals(
41
+ assert.equal(urls.length, 1);
42
+ assert.equal(urls[0].attrs['format'], 'image/avif');
43
+ assert.equal(
44
+ urls[0].attrs['template'],
41
45
  'https://basemaps.test/v1/tiles/aerial/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.avif?api=secret1234',
42
46
  );
43
47
  });
44
48
 
45
- o('should include config location', () => {
49
+ it('should include config location', () => {
46
50
  const wmts = new WmtsCapabilities({
47
51
  httpBase: 'https://basemaps.test',
48
52
  apiKey,
@@ -51,20 +55,21 @@ o.spec('WmtsCapabilities', () => {
51
55
 
52
56
  wmts.addTileMatrix(GoogleTms);
53
57
  for (const im of allImagery.values()) wmts.addImagery(im);
54
- wmts.addFormats(ImageFormat.Avif);
58
+ wmts.addFormats('avif');
55
59
  wmts.addProvider(Provider);
56
60
  wmts.addTileSet(TileSetAerial);
57
61
  const wmtsCapability = wmts.toVNode();
58
62
 
59
63
  const urls = tags(wmtsCapability, 'ResourceURL');
60
- o(urls.length).equals(1);
61
- o(urls[0].attrs.format).equals('image/avif');
62
- o(urls[0].attrs.template).equals(
64
+ assert.equal(urls.length, 1);
65
+ assert.equal(urls[0].attrs['format'], 'image/avif');
66
+ assert.equal(
67
+ urls[0].attrs['template'],
63
68
  'https://basemaps.test/v1/tiles/aerial/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.avif?api=secret1234&config=s3%3A%2F%2Flinz-basemaps%2Fconfig.json',
64
69
  );
65
70
  });
66
71
 
67
- o('should be adding encoding to utf-8', () => {
72
+ it('should be adding encoding to utf-8', () => {
68
73
  const wmts = new WmtsCapabilities({
69
74
  httpBase: 'https://basemaps.test',
70
75
  apiKey,
@@ -75,14 +80,14 @@ o.spec('WmtsCapabilities', () => {
75
80
  tileMatrix: [GoogleTms],
76
81
  tileSet: TileSetAerial,
77
82
  imagery: allImagery,
78
- formats: [ImageFormat.Avif],
83
+ formats: ['avif'],
79
84
  });
80
85
  const xml = wmts.toXml();
81
86
 
82
- o(xml.split('\n')[0]).deepEquals('<?xml version="1.0" encoding="utf-8"?>');
87
+ assert.deepEqual(xml.split('\n')[0], '<?xml version="1.0" encoding="utf-8"?>');
83
88
  });
84
89
 
85
- o('should support unicorns and rainbows', () => {
90
+ it('should support unicorns and rainbows', () => {
86
91
  const tileSet = { ...TileSetAerial };
87
92
  tileSet.name = '🦄_🌈_2022_0-5m';
88
93
  tileSet.title = '🦄 🌈 Imagery (2022)';
@@ -95,30 +100,31 @@ o.spec('WmtsCapabilities', () => {
95
100
 
96
101
  wmts.addTileMatrix(GoogleTms);
97
102
  for (const im of allImagery.values()) wmts.addImagery(im);
98
- wmts.addFormats(ImageFormat.Avif);
103
+ wmts.addFormats('avif');
99
104
  wmts.addProvider(Provider);
100
105
  wmts.addTileSet(tileSet);
101
106
  const wmtsCapability = wmts.toVNode();
102
107
 
103
108
  const urls = tags(wmtsCapability, 'ResourceURL');
104
- o(urls.length).equals(1);
105
- o(urls[0].attrs.template).equals(
109
+ assert.equal(urls.length, 1);
110
+ assert.equal(
111
+ urls[0].attrs['template'],
106
112
  'https://basemaps.test/v1/tiles/🦄-🌈-2022-0.5m/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.avif?api=secret1234',
107
113
  );
108
114
 
109
115
  const layer = tags(wmtsCapability, 'Layer')[0];
110
116
 
111
117
  const title = layer.find('ows:Title')?.toString();
112
- o(title).equals('<ows:Title>🦄 🌈 Imagery (2022)</ows:Title>');
118
+ assert.equal(title, '<ows:Title>🦄 🌈 Imagery (2022)</ows:Title>');
113
119
 
114
120
  const abstract = layer.find('ows:Abstract')?.toString();
115
- o(abstract).equals('<ows:Abstract>🦄 🌈 Description</ows:Abstract>');
121
+ assert.equal(abstract, '<ows:Abstract>🦄 🌈 Description</ows:Abstract>');
116
122
 
117
123
  const identifier = layer.find('ows:Identifier')?.toString();
118
- o(identifier).equals('<ows:Identifier>🦄-🌈-2022-0.5m</ows:Identifier>');
124
+ assert.equal(identifier, '<ows:Identifier>🦄-🌈-2022-0.5m</ows:Identifier>');
119
125
  });
120
126
 
121
- o('should sort the sub imagery layers', () => {
127
+ it('should sort the sub imagery layers', () => {
122
128
  const imageryA = { ...Imagery3857 };
123
129
  imageryA.id = 'im_a';
124
130
  imageryA.name = 'aaaa';
@@ -157,10 +163,10 @@ o.spec('WmtsCapabilities', () => {
157
163
  const layers = tags(wmtsCapability, 'Layer').map((c) => c.find('ows:Title')?.textContent);
158
164
 
159
165
  // The base layer "Aerial Imagery" should always be first then all sub layers after
160
- o(layers).deepEquals(['Aerial Imagery', 'aaaa', 'bbbb', 'Ōtorohanga 0.1m Urban Aerial Photos (2021)']);
166
+ assert.deepEqual(layers, ['Aerial Imagery', 'aaaa', 'bbbb', 'Ōtorohanga 0.1m Urban Aerial Photos (2021)']);
161
167
  });
162
168
 
163
- o('should build capability xml for tileSet and projection', () => {
169
+ it('should build capability xml for tileSet and projection', () => {
164
170
  const imagery = new Map();
165
171
  imagery.set(Imagery3857.id, Imagery3857);
166
172
 
@@ -177,45 +183,53 @@ o.spec('WmtsCapabilities', () => {
177
183
  const raw = wmts.toVNode();
178
184
  const serviceId = raw.find('ows:ServiceIdentification');
179
185
 
180
- o(serviceId?.find('ows:Abstract')?.textContent).equals('the description');
181
- o(serviceId?.find('ows:Title')?.textContent).equals('the title');
186
+ assert.equal(serviceId?.find('ows:Abstract')?.textContent, 'the description');
187
+ assert.equal(serviceId?.find('ows:Title')?.textContent, 'the title');
182
188
 
183
- o(raw.find('TileMatrixSetLink')?.toString()).deepEquals(
189
+ assert.deepEqual(
190
+ raw.find('TileMatrixSetLink')?.toString(),
184
191
  V('TileMatrixSetLink', [V('TileMatrixSet', 'WebMercatorQuad')]).toString(),
185
192
  );
186
193
 
187
194
  const layer = raw.find('Contents', 'Layer');
188
195
 
189
- o(listTag(layer, 'Format')).deepEquals([
196
+ assert.deepEqual(listTag(layer, 'Format'), [
190
197
  V('Format', 'image/jpeg').toString(),
191
198
  V('Format', 'image/webp').toString(),
192
199
  V('Format', 'image/png').toString(),
193
200
  ]);
194
201
 
195
- o(listTag(layer, 'ows:BoundingBox').map((s) => roundNumbersInString(s, 4))).deepEquals([
196
- '<ows:BoundingBox crs="urn:ogc:def:crs:EPSG::3857">\n' +
197
- ' <ows:LowerCorner>19457809.9203 -4609458.5537</ows:LowerCorner>\n' +
198
- ' <ows:UpperCorner>19509787.0995 -4578883.7424</ows:UpperCorner>\n' +
199
- '</ows:BoundingBox>',
200
- ]);
202
+ assert.deepEqual(
203
+ listTag(layer, 'ows:BoundingBox').map((s) => roundNumbersInString(s, 4)),
204
+ [
205
+ '<ows:BoundingBox crs="urn:ogc:def:crs:EPSG::3857">\n' +
206
+ ' <ows:LowerCorner>19457809.9203 -4609458.5537</ows:LowerCorner>\n' +
207
+ ' <ows:UpperCorner>19509787.0995 -4578883.7424</ows:UpperCorner>\n' +
208
+ '</ows:BoundingBox>',
209
+ ],
210
+ );
201
211
 
202
- o(listTag(layer, 'ows:WGS84BoundingBox').map((s) => roundNumbersInString(s, 4))).deepEquals([
203
- '<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">\n' +
204
- ' <ows:LowerCorner>174.7925 -38.2123</ows:LowerCorner>\n' +
205
- ' <ows:UpperCorner>175.2594 -37.9962</ows:UpperCorner>\n' +
206
- '</ows:WGS84BoundingBox>',
207
- ]);
212
+ assert.deepEqual(
213
+ listTag(layer, 'ows:WGS84BoundingBox').map((s) => roundNumbersInString(s, 4)),
214
+ [
215
+ '<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">\n' +
216
+ ' <ows:LowerCorner>174.7925 -38.2123</ows:LowerCorner>\n' +
217
+ ' <ows:UpperCorner>175.2594 -37.9962</ows:UpperCorner>\n' +
218
+ '</ows:WGS84BoundingBox>',
219
+ ],
220
+ );
208
221
 
209
- o(layer?.find('ows:Identifier')?.textContent).equals('aerial');
210
- o(layer?.find('ows:Title')?.textContent).equals('Aerial Imagery');
211
- o(layer?.find('ows:Abstract')?.textContent).equals('aerial__description');
222
+ assert.equal(layer?.find('ows:Identifier')?.textContent, 'aerial');
223
+ assert.equal(layer?.find('ows:Title')?.textContent, 'Aerial Imagery');
224
+ assert.equal(layer?.find('ows:Abstract')?.textContent, 'aerial__description');
212
225
 
213
- o(layer?.find('Style')?.toString()).equals(
226
+ assert.equal(
227
+ layer?.find('Style')?.toString(),
214
228
  V('Style', { isDefault: 'true' }, [V('ows:Title', 'Default Style'), V('ows:Identifier', 'default')]).toString(),
215
229
  );
216
230
  });
217
231
 
218
- o('should include output the correct TileMatrix', () => {
232
+ it('should include output the correct TileMatrix', () => {
219
233
  const wmts = new WmtsCapabilities({
220
234
  httpBase: 'https://basemaps.test',
221
235
  apiKey,
@@ -229,39 +243,41 @@ o.spec('WmtsCapabilities', () => {
229
243
 
230
244
  const layer = raw.find('Contents', 'Layer');
231
245
 
232
- o(layer?.find('TileMatrixSetLink', 'TileMatrixSet')?.textContent).equals('WebMercatorQuad');
246
+ assert.equal(layer?.find('TileMatrixSetLink', 'TileMatrixSet')?.textContent, 'WebMercatorQuad');
233
247
 
234
248
  const matrix = tags(raw, 'TileMatrixSet')[1];
235
249
  const matrixId = raw?.find('Contents', 'TileMatrixSet', 'ows:Identifier') ?? null;
236
- o(matrix.find('ows:Identifier')).equals(matrixId);
237
- o(matrixId?.textContent).equals('WebMercatorQuad');
250
+ assert.equal(matrix.find('ows:Identifier'), matrixId);
251
+ assert.equal(matrixId?.textContent, 'WebMercatorQuad');
238
252
 
239
- o(matrix.find('ows:SupportedCRS')?.textContent).deepEquals('urn:ogc:def:crs:EPSG::3857');
240
- o(matrix.find('WellKnownScaleSet')?.textContent).deepEquals(
253
+ assert.deepEqual(matrix.find('ows:SupportedCRS')?.textContent, 'urn:ogc:def:crs:EPSG::3857');
254
+ assert.deepEqual(
255
+ matrix.find('WellKnownScaleSet')?.textContent,
241
256
  'https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible',
242
257
  );
243
258
 
244
259
  const tileMatrices = Array.from(matrix.tags('TileMatrix'));
245
260
 
246
- o(tileMatrices.length).equals(25);
261
+ assert.equal(tileMatrices.length, 25);
247
262
 
248
263
  function compareMatrix(x: VNodeElement, id: string, tileCount: number, scale: number): void {
249
- o(x.find('ows:Identifier')?.toString()).equals(`<ows:Identifier>${id}</ows:Identifier>`);
250
- o(x.find('ScaleDenominator')?.toString()).equals(`<ScaleDenominator>${scale}</ScaleDenominator>`);
251
- o(x.find('TopLeftCorner')?.toString()).equals(
264
+ assert.equal(x.find('ows:Identifier')?.toString(), `<ows:Identifier>${id}</ows:Identifier>`);
265
+ assert.equal(x.find('ScaleDenominator')?.toString(), `<ScaleDenominator>${scale}</ScaleDenominator>`);
266
+ assert.equal(
267
+ x.find('TopLeftCorner')?.toString(),
252
268
  `<TopLeftCorner>-20037508.3427892 20037508.3427892</TopLeftCorner>`,
253
269
  );
254
- o(x.find('TileWidth')?.toString()).equals(`<TileWidth>256</TileWidth>`);
255
- o(x.find('TileHeight')?.toString()).equals(`<TileHeight>256</TileHeight>`);
256
- o(x.find('MatrixWidth')?.toString()).equals(`<MatrixWidth>${tileCount}</MatrixWidth>`);
257
- o(x.find('MatrixHeight')?.toString()).equals(`<MatrixHeight>${tileCount}</MatrixHeight>`);
270
+ assert.equal(x.find('TileWidth')?.toString(), `<TileWidth>256</TileWidth>`);
271
+ assert.equal(x.find('TileHeight')?.toString(), `<TileHeight>256</TileHeight>`);
272
+ assert.equal(x.find('MatrixWidth')?.toString(), `<MatrixWidth>${tileCount}</MatrixWidth>`);
273
+ assert.equal(x.find('MatrixHeight')?.toString(), `<MatrixHeight>${tileCount}</MatrixHeight>`);
258
274
  }
259
275
 
260
276
  compareMatrix(tileMatrices[0], '0', 1, 559082264.028717);
261
277
  compareMatrix(tileMatrices[10], '10', 1024, 545978.773465544);
262
278
  });
263
279
 
264
- o('should output individual imagery adds', () => {
280
+ it('should output individual imagery adds', () => {
265
281
  const imagery = new Map<string, ConfigImagery>();
266
282
  imagery.set(Imagery3857.id, Imagery3857);
267
283
  imagery.set(Imagery2193.id, Imagery2193);
@@ -276,37 +292,39 @@ o.spec('WmtsCapabilities', () => {
276
292
  tileSet: TileSetAerial,
277
293
  imagery,
278
294
  layers: TileSetAerial.layers,
279
- formats: [ImageFormat.Png],
295
+ formats: ['png'],
280
296
  });
281
297
 
282
298
  const raw = wmts.toVNode();
283
299
 
284
300
  const tms = raw?.find('TileMatrixSet', 'ows:Identifier');
285
301
 
286
- o(tms?.textContent).equals('WebMercatorQuad');
302
+ assert.equal(tms?.textContent, 'WebMercatorQuad');
287
303
 
288
304
  const urls = Array.from(raw ? raw.tags('ResourceURL') : []);
289
- o(urls.length).equals(2);
290
- o(urls[0].toString()).deepEquals(
305
+ assert.equal(urls.length, 2);
306
+ assert.deepEqual(
307
+ urls[0].toString(),
291
308
  '<ResourceURL format="image/png" resourceType="tile" ' +
292
309
  'template="https://basemaps.test/v1/tiles/aerial/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png" />',
293
310
  );
294
- o(urls[1].toString()).deepEquals(
311
+ assert.deepEqual(
312
+ urls[1].toString(),
295
313
  '<ResourceURL format="image/png" resourceType="tile" ' +
296
314
  'template="https://basemaps.test/v1/tiles/ōtorohanga-urban-2021-0.1m/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png" />',
297
315
  );
298
316
 
299
317
  const layers = [...raw.tags('Layer')];
300
318
 
301
- o(layers.length).equals(2);
302
- o(layers[0].find('ows:Title')?.textContent).equals('Aerial Imagery');
319
+ assert.equal(layers.length, 2);
320
+ assert.equal(layers[0].find('ows:Title')?.textContent, 'Aerial Imagery');
303
321
 
304
- o(layers[1].find('ows:Title')?.textContent).equals('Ōtorohanga 0.1m Urban Aerial Photos (2021)');
305
- o(layers[1].find('ows:Identifier')?.textContent).equals('ōtorohanga-urban-2021-0.1m');
306
- o(layers[1].find('ows:Keywords', 'ows:Keyword')?.textContent).equals('Urban Aerial Photos');
322
+ assert.equal(layers[1].find('ows:Title')?.textContent, 'Ōtorohanga 0.1m Urban Aerial Photos (2021)');
323
+ assert.equal(layers[1].find('ows:Identifier')?.textContent, 'ōtorohanga-urban-2021-0.1m');
324
+ assert.equal(layers[1].find('ows:Keywords', 'ows:Keyword')?.textContent, 'Urban Aerial Photos');
307
325
  });
308
326
 
309
- o('should support multiple projections', () => {
327
+ it('should support multiple projections', () => {
310
328
  const imagery = new Map<string, ConfigImagery>();
311
329
  imagery.set(Imagery3857.id, Imagery3857);
312
330
  imagery.set(Imagery2193.id, Imagery2193);
@@ -320,16 +338,16 @@ o.spec('WmtsCapabilities', () => {
320
338
  tileMatrix: [GoogleTms, Nztm2000QuadTms],
321
339
  tileSet: TileSetAerial,
322
340
  imagery: imagery,
323
- formats: [ImageFormat.Png],
341
+ formats: ['png'],
324
342
  });
325
343
 
326
344
  const raw = wmts.toVNode();
327
345
  const layers = tags(raw, 'Layer');
328
- o(layers.length).equals(1);
346
+ assert.equal(layers.length, 1);
329
347
  const layer = layers[0];
330
348
 
331
349
  // ensure order is valid
332
- o(layer?.children.map((c) => (c instanceof VNodeElement ? c.tag : null))).deepEquals([
350
+ assert.deepEqual(layer?.children.map((c) => (c instanceof VNodeElement ? c.tag : null)), [
333
351
  'ows:Title',
334
352
  'ows:Abstract',
335
353
  'ows:Identifier',
@@ -344,37 +362,38 @@ o.spec('WmtsCapabilities', () => {
344
362
  'ResourceURL',
345
363
  ]);
346
364
 
347
- o(layer.find('ows:Title')?.textContent).equals('Aerial Imagery');
348
- o(layer.find('ows:Keywords')?.toString()).equals(
365
+ assert.equal(layer.find('ows:Title')?.textContent, 'Aerial Imagery');
366
+ assert.equal(
367
+ layer.find('ows:Keywords')?.toString(),
349
368
  '<ows:Keywords>\n <ows:Keyword>Basemap</ows:Keyword>\n</ows:Keywords>',
350
369
  );
351
- o(layer.find('ows:Identifier')?.textContent).equals('aerial');
370
+ assert.equal(layer.find('ows:Identifier')?.textContent, 'aerial');
352
371
 
353
372
  const adds = tags(layer, 'TileMatrixSet');
354
373
 
355
- o(adds.length).equals(2);
356
- o(adds[0].toString()).equals('<TileMatrixSet>WebMercatorQuad</TileMatrixSet>');
357
- o(adds[1].toString()).equals('<TileMatrixSet>NZTM2000Quad</TileMatrixSet>');
374
+ assert.equal(adds.length, 2);
375
+ assert.equal(adds[0].toString(), '<TileMatrixSet>WebMercatorQuad</TileMatrixSet>');
376
+ assert.equal(adds[1].toString(), '<TileMatrixSet>NZTM2000Quad</TileMatrixSet>');
358
377
 
359
378
  const boundingBoxes = tags(layer, 'ows:BoundingBox');
360
- o(boundingBoxes.length).equals(2);
361
- o(boundingBoxes[0].attrs.crs).equals('urn:ogc:def:crs:EPSG::3857');
362
- o(boundingBoxes[0].children.map((c) => c.textContent)).deepEquals([
363
- '19457809.9203 -4609458.5537',
364
- '19509787.0995 -4578883.7424',
365
- ]);
366
- o(boundingBoxes[1].attrs.crs).equals('urn:ogc:def:crs:EPSG::2193');
367
- o(boundingBoxes[1].children.map((c) => c.textContent)).deepEquals([
368
- '5766358.9964 1757351.3045',
369
- '5793264.8304 1798321.5516',
370
- ]);
379
+ assert.equal(boundingBoxes.length, 2);
380
+ assert.equal(boundingBoxes[0].attrs['crs'], 'urn:ogc:def:crs:EPSG::3857');
381
+ assert.deepEqual(
382
+ boundingBoxes[0].children.map((c) => c.textContent),
383
+ ['19457809.9203 -4609458.5537', '19509787.0995 -4578883.7424'],
384
+ );
385
+ assert.equal(boundingBoxes[1].attrs['crs'], 'urn:ogc:def:crs:EPSG::2193');
386
+ assert.deepEqual(
387
+ boundingBoxes[1].children.map((c) => c.textContent),
388
+ ['5766358.9964 1757351.3045', '5793264.8304 1798321.5516'],
389
+ );
371
390
 
372
391
  const wgs84 = layer.find('ows:WGS84BoundingBox');
373
- o(wgs84?.attrs.crs).equals('urn:ogc:def:crs:OGC:2:84');
374
- o(wgs84?.children.map((c) => c.textContent)).deepEquals(['174.79248 -38.212288', '175.259399 -37.996163']);
392
+ assert.equal(wgs84?.attrs['crs'], 'urn:ogc:def:crs:OGC:2:84');
393
+ assert.deepEqual(wgs84?.children.map((c) => c.textContent), ['174.79248 -38.212288', '175.259399 -37.996163']);
375
394
  });
376
395
 
377
- o('should only output imagery if exists', () => {
396
+ it('should only output imagery if exists', () => {
378
397
  const imagery = new Map<string, ConfigImagery>();
379
398
  const wmtsA = new WmtsCapabilities({
380
399
  httpBase: 'https://basemaps.test',
@@ -385,14 +404,14 @@ o.spec('WmtsCapabilities', () => {
385
404
  tileMatrix: [Nztm2000QuadTms],
386
405
  tileSet: TileSetAerial,
387
406
  imagery: imagery,
388
- formats: [ImageFormat.Png],
407
+ formats: ['png'],
389
408
  layers: TileSetAerial.layers,
390
409
  });
391
410
 
392
411
  const rawA = wmtsA.toVNode();
393
412
 
394
413
  const layers = tags(rawA, 'Layer');
395
- o(layers.length).equals(1);
414
+ assert.equal(layers.length, 1);
396
415
 
397
416
  imagery.set(Imagery3857.id, Imagery3857);
398
417
  const wmtsB = new WmtsCapabilities({
@@ -403,16 +422,16 @@ o.spec('WmtsCapabilities', () => {
403
422
  tileMatrix: [Nztm2000QuadTms],
404
423
  tileSet: TileSetAerial,
405
424
  imagery: imagery,
406
- formats: [ImageFormat.Png],
425
+ formats: ['png'],
407
426
  layers: TileSetAerial.layers,
408
427
  });
409
428
 
410
429
  const rawB = wmtsB.toVNode();
411
430
  const layersB = tags(rawB, 'Layer');
412
- o(layersB.length).equals(1);
431
+ assert.equal(layersB.length, 1);
413
432
  });
414
433
 
415
- o('should cover the entire WebMercatorBounds', () => {
434
+ it('should cover the entire WebMercatorBounds', () => {
416
435
  const halfSize = GoogleTms.extent.width / 2;
417
436
  // Create two fake imagery adds one covers tile z1 x0 y0 another covers tile z1 x1 y1
418
437
  // so the entire bounding box should be tile z0 x0 y0 or the full extent
@@ -439,7 +458,7 @@ o.spec('WmtsCapabilities', () => {
439
458
  tileMatrix: [GoogleTms],
440
459
  tileSet,
441
460
  imagery,
442
- formats: [ImageFormat.Png],
461
+ formats: ['png'],
443
462
  layers: tileSet.layers,
444
463
  });
445
464
 
@@ -451,17 +470,17 @@ o.spec('WmtsCapabilities', () => {
451
470
  .split('\n')
452
471
  .map((c) => c.trim()),
453
472
  );
454
- o(boundingBox[0][1]).deepEquals('<ows:LowerCorner>-180 -85.051129</ows:LowerCorner>');
455
- o(boundingBox[0][2]).equals('<ows:UpperCorner>180 85.051129</ows:UpperCorner>');
473
+ assert.deepEqual(boundingBox[0][1], '<ows:LowerCorner>-180 -85.051129</ows:LowerCorner>');
474
+ assert.equal(boundingBox[0][2], '<ows:UpperCorner>180 85.051129</ows:UpperCorner>');
456
475
 
457
- o(boundingBox[1][1]).deepEquals('<ows:LowerCorner>-180 0</ows:LowerCorner>');
458
- o(boundingBox[1][2]).equals('<ows:UpperCorner>0 85.051129</ows:UpperCorner>');
476
+ assert.deepEqual(boundingBox[1][1], '<ows:LowerCorner>-180 0</ows:LowerCorner>');
477
+ assert.equal(boundingBox[1][2], '<ows:UpperCorner>0 85.051129</ows:UpperCorner>');
459
478
 
460
- o(boundingBox[2][1]).deepEquals('<ows:LowerCorner>0 -85.051129</ows:LowerCorner>');
461
- o(boundingBox[2][2]).equals('<ows:UpperCorner>180 0</ows:UpperCorner>');
479
+ assert.deepEqual(boundingBox[2][1], '<ows:LowerCorner>0 -85.051129</ows:LowerCorner>');
480
+ assert.equal(boundingBox[2][2], '<ows:UpperCorner>180 0</ows:UpperCorner>');
462
481
  });
463
482
 
464
- o('should work when crossing anti meridian', () => {
483
+ it('should work when crossing anti meridian', () => {
465
484
  const halfSize = GoogleTms.extent.width / 2;
466
485
 
467
486
  const imagery = new Map();
@@ -482,7 +501,7 @@ o.spec('WmtsCapabilities', () => {
482
501
  tileMatrix: [GoogleTms],
483
502
  tileSet,
484
503
  imagery,
485
- formats: [ImageFormat.Png],
504
+ formats: ['png'],
486
505
  layers: tileSet.layers,
487
506
  });
488
507
 
@@ -493,28 +512,28 @@ o.spec('WmtsCapabilities', () => {
493
512
  .split('\n')
494
513
  .map((c) => c.trim()),
495
514
  );
496
- o(boundingBox[0][1]).deepEquals('<ows:LowerCorner>-180 -85.0511</ows:LowerCorner>');
497
- o(boundingBox[0][2]).equals('<ows:UpperCorner>180 0</ows:UpperCorner>');
515
+ assert.deepEqual(boundingBox[0][1], '<ows:LowerCorner>-180 -85.0511</ows:LowerCorner>');
516
+ assert.equal(boundingBox[0][2], '<ows:UpperCorner>180 0</ows:UpperCorner>');
498
517
 
499
- o(boundingBox[1][1]).deepEquals('<ows:LowerCorner>-180 -85.0511</ows:LowerCorner>');
500
- o(boundingBox[1][2]).equals('<ows:UpperCorner>180 0</ows:UpperCorner>');
518
+ assert.deepEqual(boundingBox[1][1], '<ows:LowerCorner>-180 -85.0511</ows:LowerCorner>');
519
+ assert.equal(boundingBox[1][2], '<ows:UpperCorner>180 0</ows:UpperCorner>');
501
520
  });
502
521
 
503
- o('should work with NZTM2000Quad', () => {
522
+ it('should work with NZTM2000Quad', () => {
504
523
  const wmts = new WmtsCapabilities({ tileMatrix: [] } as any);
505
524
 
506
525
  // Full NZTM200Quad coverage
507
526
  const bbox = wmts.buildWgs84BoundingBox(Nztm2000QuadTms, []);
508
- o(bbox.children[0].textContent).equals('-180 -49.929855');
509
- o(bbox.children[1].textContent).equals('180 2.938603');
527
+ assert.equal(bbox.children[0].textContent, '-180 -49.929855');
528
+ assert.equal(bbox.children[1].textContent, '180 2.938603');
510
529
 
511
530
  // Full NZTM200Quad coverage at z1
512
531
  const bboxB = wmts.buildWgs84BoundingBox(Nztm2000QuadTms, [
513
532
  Nztm2000QuadTms.tileToSourceBounds({ z: 1, x: 0, y: 0 }),
514
533
  Nztm2000QuadTms.tileToSourceBounds({ z: 1, x: 1, y: 1 }),
515
534
  ]);
516
- o(bboxB.children[0].textContent).equals('-180 -49.929855');
517
- o(bboxB.children[1].textContent).equals('180 2.938603');
535
+ assert.equal(bboxB.children[0].textContent, '-180 -49.929855');
536
+ assert.equal(bboxB.children[1].textContent, '180 2.938603');
518
537
 
519
538
  // Full NZTM200Quad coverage at z5
520
539
  const tileCount = Nztm2000QuadTms.zooms[5].matrixWidth;
@@ -522,7 +541,7 @@ o.spec('WmtsCapabilities', () => {
522
541
  Nztm2000QuadTms.tileToSourceBounds({ z: 5, x: 0, y: 0 }),
523
542
  Nztm2000QuadTms.tileToSourceBounds({ z: 5, x: tileCount - 1, y: tileCount - 1 }),
524
543
  ]);
525
- o(bboxC.children[0].textContent).equals('-180 -49.929855');
526
- o(bboxC.children[1].textContent).equals('180 2.938603');
544
+ assert.equal(bboxC.children[0].textContent, '-180 -49.929855');
545
+ assert.equal(bboxC.children[1].textContent, '180 2.938603');
527
546
  });
528
547
  });
@@ -1,18 +1,17 @@
1
1
  import { ConfigProviderMemory } from '@basemaps/config';
2
- import { initConfigFromUrls } from '@basemaps/config/build/json/tiff.config.js';
3
- import { ImageFormat, TileMatrixSet, TileMatrixSets } from '@basemaps/geo';
4
- import { LogConfig, setDefaultConfig } from '@basemaps/shared';
5
- import { fsa } from '@chunkd/fs';
2
+ import { initConfigFromUrls } from '@basemaps/config-loader';
3
+ import { TileMatrixSet, TileMatrixSets } from '@basemaps/geo';
4
+ import { fsa, LogConfig, setDefaultConfig } from '@basemaps/shared';
6
5
  import { LambdaHttpRequest, LambdaUrlRequest, UrlEvent } from '@linzjs/lambda';
7
6
  import { Context } from 'aws-lambda';
8
- import { pathToFileURL } from 'url';
7
+
9
8
  import { renderPreview } from '../routes/preview.js';
10
9
 
11
- const target = pathToFileURL(`/home/blacha/tmp/basemaps/bm-724/test-north-island_20230220_10m/`);
10
+ const target = fsa.toUrl(`/home/blacha/tmp/basemaps/bm-724/test-north-island_20230220_10m/`);
12
11
  const location = { lat: -39.0852555, lon: 177.3998405 };
13
12
  const z = 12;
14
13
 
15
- const outputFormat = ImageFormat.Webp;
14
+ const outputFormat = 'webp';
16
15
  let tileMatrix: TileMatrixSet | null = null;
17
16
 
18
17
  async function main(): Promise<void> {
@@ -35,8 +34,14 @@ async function main(): Promise<void> {
35
34
  if (tileMatrix == null) throw new Error('No tileMatrix found');
36
35
 
37
36
  const req = new LambdaUrlRequest({ headers: {} } as UrlEvent, {} as Context, LogConfig.get()) as LambdaHttpRequest;
38
- const res = await renderPreview(req, { tileMatrix, tileSet, location, z, outputFormat });
39
- const previewFile = `./z${z}_${location.lon}_${location.lat}.${outputFormat}`;
37
+ const res = await renderPreview(req, {
38
+ tileMatrix,
39
+ tileSet,
40
+ location,
41
+ z,
42
+ output: { title: outputFormat, format: [outputFormat], name: 'rgba' },
43
+ });
44
+ const previewFile = fsa.toUrl(`./z${z}_${location.lon}_${location.lat}.${outputFormat}`);
40
45
  await fsa.write(previewFile, Buffer.from(res.body, 'base64'));
41
46
  log.info({ path: previewFile }, 'Tile:Write');
42
47
  }