@rcpch/imd-map 0.2.0 → 0.2.1

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 CHANGED
@@ -14,7 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
14
14
 
15
15
  - 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
16
  - 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 pg_tileserv behavior (table name without `public.` schema prefix).
17
+ - 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
18
  - Updated overlay visibility handling so hide/show applies across all zoom-tier boundary layers.
19
19
 
20
20
  ### Added
package/README.md CHANGED
@@ -201,6 +201,17 @@ 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
package/dist/index.esm.js CHANGED
@@ -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 = `public.${LOCAL_AUTHORITY_TABLE_PREFIX}_${tier}`;
899
- const sourceLayer = `${LOCAL_AUTHORITY_TABLE_PREFIX}_${tier}`;
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 = `public.${input.tablePrefix}_${tier}`;
972
- const sourceLayer = `${input.tablePrefix}_${tier}`;
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) {