Skip to content

Commit f77cda7

Browse files
feat: improve diffing between tilesets (#3555)
### Motivation Our **basemaps-config** [preview links] for Elevation inserts don’t show anything in Basemaps. You can’t see the imagery until you add the following parameters: [preview links]: linz/basemaps-config#1323 (comment) ``` pipeline=terrain-rgb&format=png ``` We need to update the code that generates the markdown QA URLs to add the `pipeline` and `format` key-value parameters automatically. The code lives in the **cli-config** package’s [import] command. ### Modifications The code for the **cli-config** package's `import` command needs some re-work. We've opted to rebuild the code with a focus on improving the _diffing_ logic and test suite. We've captured the rebuild as a new `diff` command. **packages/cli-config/src/** - **`index.ts`** - Added the new `diff` command to the `ConfigCli` list of sub commands. - **\_\_tests\_\_/** - **`config.diff.data.ts`** & **`config.diff.test.ts`** - Added mock data and a test suite and for validating the behaviour of the new _diffing_ functionalities provided by the `config.diff.ts` and `config.diff.markdown.ts` files. - **cli/** - **diff/** - **`config.diff.ts`** - Implemented a new strategy for capturing the raster differences between two bundled configs. We will extend this work in the near future to capture vector differences, too. - **`config.diff.markdown.ts`** - Implemented a suite of functions for rendering the captured raster differences as markdown. - **`action.diff.ts`** - Added a new `diff` command to capture the raster and vector differences between two bundled config JSON files. The command also generates new and improved markdown denoting the detected configuration changes. This command will come to replace the _QA markdown_ role played by the `import` command. - **`action.import.ts`** - Fixed a typo in the markdown produced by the `outputAnalyseReports` function. - **`config.diff.ts`** - Added the `virtual` string to the `IgnoredProperties` array. - **config/src/memory/** - **`memory.config.ts`** - Added an optional `source` property to the `ConfigProviderMemory` class to store the `URL` of the bundled config. - Extended the `fromJson` function to support a new `sourceUrl?: URL` parameter. <!-- TODO: Say what changes you made. --> <!-- TODO: Attach screenshots if you changed the UI. --> ### Verification - We have a test suite for validating the behaviour of the raster-based _diffing_ functions. - We don't have any tests for _vector diffing_ as we intend to re-build that code in the near future. - I have a **basemaps-config** pull request [here] that I've been using to simulate layer additions, updates, and deletions for various tilesets so that I can inspect the generated markdown. [here]: linz/basemaps-config#1374 --------- Co-authored-by: Tawera Manaena <TManaena@linz.govt.nz>
1 parent 1fc339c commit f77cda7

File tree

9 files changed

+1192
-79
lines changed

9 files changed

+1192
-79
lines changed

packages/cli-config/src/__tests__/config.diff.data.ts

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConfigLayer, TileSetType } from '@basemaps/config';
1+
import { TileSetType } from '@basemaps/config';
22
import { TileSetConfigSchema } from '@basemaps/config-loader/build/json/parse.tile.set.js';
33

44
export const TsAerial: TileSetConfigSchema = {
@@ -31,5 +31,85 @@ export const TsAerial: TileSetConfigSchema = {
3131
category: 'Urban Aerial Photos',
3232
minZoom: 14,
3333
},
34-
] as ConfigLayer[],
34+
],
35+
} as const;
36+
37+
export const TsVector: TileSetConfigSchema = {
38+
type: 'vector' as TileSetType.Vector,
39+
id: 'ts_topographic-v2',
40+
title: 'New Zealand Topographic Vector Map',
41+
maxZoom: 15,
42+
format: 'pbf',
43+
layers: [
44+
{
45+
'2193': 's3://linz-basemaps/vector/2193/topographic/01K07MGSVMXKP39SVR4RF63NQ4/topographic-v2.tar.co',
46+
'3857': 's3://linz-basemaps/vector/3857/topographic/01K07MN7NQR1WTBS5W9VW49EW2/topographic-v2.tar.co',
47+
name: 'topographic-v2',
48+
title: 'Topographic V2',
49+
},
50+
],
51+
};
52+
53+
export const TsIndividual: TileSetConfigSchema = {
54+
type: 'raster' as TileSetType.Raster,
55+
id: 'ts_top-of-the-south-flood-2022-0.15m',
56+
title: 'Top of the South Flood 0.15m Aerial Photos (2022)',
57+
category: 'Event',
58+
layers: [
59+
{
60+
'2193': 's3://linz-basemaps/2193/top-of-the-south_flood_2022_0.15m/01GGDTRTDV2BA47P4TQ6CGWMFR/',
61+
'3857': 's3://linz-basemaps/3857/top-of-the-south_flood_2022_0.15m/01GGDTSGRK0Z4C70WXBYMEXK4X/',
62+
name: 'top-of-the-south-flood-2022-0.15m',
63+
title: 'Top of the South Flood 0.15m Aerial Photos (2022)',
64+
category: 'Event',
65+
minZoom: 0,
66+
maxZoom: 32,
67+
},
68+
],
69+
};
70+
71+
export const TsElevation: TileSetConfigSchema = {
72+
id: 'ts_elevation',
73+
type: 'raster' as TileSetType.Raster,
74+
description: 'Elevation Basemap',
75+
title: 'Elevation',
76+
category: 'Elevation',
77+
layers: [
78+
{
79+
'2193': 's3://nz-elevation/new-zealand/new-zealand-contour/dem_8m/2193/',
80+
'3857': 's3://linz-basemaps/elevation/3857/new-zealand_2012_dem_8m/01HZ0YNQPGH5RJ01S5R5T2VAPM/',
81+
title: 'New Zealand 8m DEM (2012)',
82+
name: 'new-zealand_2012_dem_8m',
83+
},
84+
{
85+
'2193': 's3://nz-elevation/wellington/wellington_2013-2014/dem_1m/2193/',
86+
'3857': 's3://linz-basemaps/elevation/3857/wellington_2013-2014_dem_1m/01HZ67MBQJ8VASM6Z69PMATPHH/',
87+
minZoom: 9,
88+
title: 'Wellington LiDAR 1m DEM (2013-2014)',
89+
name: 'wellington_2013-2014_dem_1m',
90+
},
91+
{
92+
'2193': 's3://nz-elevation/manawatu-whanganui/manawatu-whanganui_2015-2016/dem_1m/2193/',
93+
'3857': 's3://linz-basemaps/elevation/3857/manawatu-whanganui_2015-2016_dem_1m/01HZ65XSK73Z8GBSTWJ6SKYGGV/',
94+
minZoom: 9,
95+
title: 'Manawatū-Whanganui LiDAR 1m DEM (2015-2016)',
96+
name: 'manawatu-whanganui_2015-2016_dem_1m',
97+
},
98+
],
99+
outputs: [
100+
{
101+
title: 'Terrain RGB',
102+
name: 'terrain-rgb',
103+
pipeline: [{ type: 'terrain-rgb' }],
104+
format: ['png'],
105+
background: { r: 1, g: 134, b: 160, alpha: 1 },
106+
resizeKernel: { in: 'nearest', out: 'nearest' },
107+
},
108+
{
109+
title: 'Color ramp',
110+
name: 'color-ramp',
111+
pipeline: [{ type: 'color-ramp' }],
112+
background: { r: 172, g: 204, b: 226, alpha: 1 },
113+
},
114+
],
35115
};

0 commit comments

Comments
 (0)