@rcpch/imd-map 0.2.0 → 0.3.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 +9 -1
- package/README.md +45 -2
- package/dist/index.esm.js +13 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/rcpch-imd-map.min.js +8 -8
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,13 +8,21 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.3.0] — 2026-04-27
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Updated all-UK era resolution so `initialNation: 'all'` honours the requested era instead of always forcing `2011`.
|
|
16
|
+
- Documented the mixed-vintage `uk_master_2021_*` UK tiles, where England uses 2021 LSOA boundaries with 2025 IMD data while Wales, Scotland, and Northern Ireland remain on their current older datasets.
|
|
17
|
+
- Clarified in the public docs that `era` refers to the LSOA boundary year, not the IMD publication year, and documented the England pairings of `2011` → 2011 LSOAs + 2019 IMD and `2021` → 2021 LSOAs + 2025 IMD.
|
|
18
|
+
|
|
11
19
|
## [0.2.0] — 2026-04-26
|
|
12
20
|
|
|
13
21
|
### Changed
|
|
14
22
|
|
|
15
23
|
- Switched local authority boundary overlay to zoom-tiered pg_tileserv tables (`public.la_tiles_z0_4`, `public.la_tiles_z5_7`, `public.la_tiles_z8_10`, `public.la_tiles_z11_14`) with tier-matched layer zoom windows.
|
|
16
24
|
- Switched health boundary overlays to zoom-tiered pg_tileserv tables for NHS England regions (`public.nhser_tiles_2021_*`), ICBs (`public.icb_tiles_2023_*`), and Welsh LHBs (`public.lhb_tiles_2022_*`).
|
|
17
|
-
- Corrected overlay `source-layer` usage to match
|
|
25
|
+
- Corrected overlay `source-layer` usage to match deployed overlay vector tiles by using schema-qualified layer names (for example `public.la_tiles_z5_7`) and keeping `source-layer` equal to the URL table id.
|
|
18
26
|
- Updated overlay visibility handling so hide/show applies across all zoom-tier boundary layers.
|
|
19
27
|
|
|
20
28
|
### Added
|
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ The UMD bundle includes MapLibre GL. No separate script tag required.
|
|
|
69
69
|
```html
|
|
70
70
|
<div id="map" style="height: 600px"></div>
|
|
71
71
|
|
|
72
|
-
<script src="https://cdn.jsdelivr.net/npm/@rcpch/imd-map@0.
|
|
72
|
+
<script src="https://cdn.jsdelivr.net/npm/@rcpch/imd-map@0.3.0/dist/umd/rcpch-imd-map.min.js"></script>
|
|
73
73
|
<script>
|
|
74
74
|
const map = RcpchImdMap.createImdMap({
|
|
75
75
|
container: 'map',
|
|
@@ -201,13 +201,31 @@ Tile URL resolution precedence:
|
|
|
201
201
|
|
|
202
202
|
The library source contains **no hardcoded tile URLs**.
|
|
203
203
|
|
|
204
|
+
### Overlay boundary tile contract
|
|
205
|
+
|
|
206
|
+
Boundary overlays (local authority, NHSER, ICB, LHB) are requested from schema-qualified table ids and rendered with the same schema-qualified `source-layer` name. Example:
|
|
207
|
+
|
|
208
|
+
- URL table id: `public.la_tiles_z5_7`
|
|
209
|
+
- `source-layer`: `public.la_tiles_z5_7`
|
|
210
|
+
|
|
211
|
+
If you self-host boundary tiles, ensure each overlay PBF exposes the exact same layer name string as the table id used in the URL path.
|
|
212
|
+
|
|
213
|
+
Bring your own overlay configuration (custom overlay table/layer names via library options) could be enabled in a future release. If you need this, please open a GitHub issue so contributors can prioritise and scope it.
|
|
214
|
+
|
|
204
215
|
---
|
|
205
216
|
|
|
206
217
|
## Nation and era rules
|
|
207
218
|
|
|
219
|
+
The `era` option refers to the boundary year used for the LSOA geography, not the IMD publication year.
|
|
220
|
+
|
|
221
|
+
For England, the supported pairings are:
|
|
222
|
+
|
|
223
|
+
- `2011` era = 2011 LSOA boundaries + 2019 IMD data
|
|
224
|
+
- `2021` era = 2021 LSOA boundaries + 2025 IMD data
|
|
225
|
+
|
|
208
226
|
| Nation | Requested era | Effective era |
|
|
209
227
|
|---|---|---|
|
|
210
|
-
| `all` |
|
|
228
|
+
| `all` | `2011` or `2021` | as requested |
|
|
211
229
|
| `england` | `2011` or `2021` | as requested |
|
|
212
230
|
| `wales` | any | always `2011` |
|
|
213
231
|
| `scotland` | any | always `2011` |
|
|
@@ -215,6 +233,31 @@ The library source contains **no hardcoded tile URLs**.
|
|
|
215
233
|
|
|
216
234
|
When the effective era differs from the requested era, `onWarning` is called with code `ERA_OVERRIDE`.
|
|
217
235
|
|
|
236
|
+
For all-UK maps, `initialEra: '2021'` now uses the mixed-vintage `uk_master_2021_*` tables: England renders with 2021 LSOA boundaries and 2025 IMD data, while Wales, Scotland, and Northern Ireland continue to render from their existing older datasets within the same UK tile family. Use `initialEra: '2011'` when you want the older England 2011 LSOA + 2019 IMD view alongside the existing Welsh and other nation data.
|
|
237
|
+
|
|
238
|
+
This means you can instantiate two separate UK maps in the same application, choosing the England boundary/IMD pairing by era:
|
|
239
|
+
|
|
240
|
+
```js
|
|
241
|
+
const historicalMap = createImdMap({
|
|
242
|
+
container: 'map-2011',
|
|
243
|
+
tilesBaseUrl: 'https://your-tile-server.example.com',
|
|
244
|
+
initialNation: 'all',
|
|
245
|
+
initialEra: '2011',
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
const currentMap = createImdMap({
|
|
249
|
+
container: 'map-2021',
|
|
250
|
+
tilesBaseUrl: 'https://your-tile-server.example.com',
|
|
251
|
+
initialNation: 'all',
|
|
252
|
+
initialEra: '2021',
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
In a patient-facing application, a common pattern would be:
|
|
257
|
+
|
|
258
|
+
- patients before 2025 or 2026 cutoff: `initialEra: '2011'`
|
|
259
|
+
- patients in the newer cohort: `initialEra: '2021'`
|
|
260
|
+
|
|
218
261
|
---
|
|
219
262
|
|
|
220
263
|
## Styling
|
package/dist/index.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Map, AttributionControl, Popup, VectorTileSource, GeoJSONSource } from
|
|
|
6
6
|
function resolveEffectiveEra(nation, requestedEra) {
|
|
7
7
|
switch (nation) {
|
|
8
8
|
case "all":
|
|
9
|
-
return
|
|
9
|
+
return requestedEra;
|
|
10
10
|
case "england":
|
|
11
11
|
return requestedEra;
|
|
12
12
|
case "wales":
|
|
@@ -882,6 +882,14 @@ function normalizeLeadCentreInput(data) {
|
|
|
882
882
|
properties: { label }
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
|
+
|
|
886
|
+
// src/overlays/mvtLayerName.ts
|
|
887
|
+
var DEFAULT_TILES_SCHEMA = "public";
|
|
888
|
+
function buildMvtLayerName(baseName, tier, schema = DEFAULT_TILES_SCHEMA) {
|
|
889
|
+
return `${schema}.${baseName}_${tier}`;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// src/overlays/localAuthority.ts
|
|
885
893
|
var LOCAL_AUTHORITY_SOURCE_ID = "rcpch-imd-la-overlay";
|
|
886
894
|
var LOCAL_AUTHORITY_LAYER_ID = "rcpch-imd-la-overlay-line";
|
|
887
895
|
var LOCAL_AUTHORITY_TABLE_PREFIX = "la_tiles";
|
|
@@ -895,8 +903,8 @@ function addOrUpdateLocalAuthorityOverlay(map, tilesBaseUrl, style) {
|
|
|
895
903
|
for (const { tier, minzoom, maxzoom } of ZOOM_TIERS) {
|
|
896
904
|
const sourceId = localAuthoritySourceId(tier);
|
|
897
905
|
const layerId = localAuthorityLayerId(tier);
|
|
898
|
-
const fullTableName =
|
|
899
|
-
const sourceLayer =
|
|
906
|
+
const fullTableName = buildMvtLayerName(LOCAL_AUTHORITY_TABLE_PREFIX, tier);
|
|
907
|
+
const sourceLayer = fullTableName;
|
|
900
908
|
const tileUrl = buildTileUrl(tilesBaseUrl, fullTableName);
|
|
901
909
|
const existing = map.getSource(sourceId);
|
|
902
910
|
if (existing instanceof VectorTileSource) {
|
|
@@ -968,8 +976,8 @@ function addOrUpdateBoundaryOverlay(map, tilesBaseUrl, input) {
|
|
|
968
976
|
for (const { tier, minzoom, maxzoom } of ZOOM_TIERS) {
|
|
969
977
|
const sourceId = overlaySourceId(input.sourceId, tier);
|
|
970
978
|
const layerId = overlayLayerId(input.layerId, tier);
|
|
971
|
-
const fullTableName =
|
|
972
|
-
const sourceLayer =
|
|
979
|
+
const fullTableName = buildMvtLayerName(input.tablePrefix, tier);
|
|
980
|
+
const sourceLayer = fullTableName;
|
|
973
981
|
const tileUrl = buildTileUrl(tilesBaseUrl, fullTableName);
|
|
974
982
|
const existing = map.getSource(sourceId);
|
|
975
983
|
if (existing instanceof VectorTileSource) {
|