In this section
- Substation Intelligence V9 63 geodesy · code-generator / apps/substation-finder/Si/202609062358-substation-intelligence-v9-63.js lines 8401–8590
- Substation Finder — Si Page geodesy · code-generator / apps/substation-finder/Si/index.html lines 1–510
Substation Intelligence V9 63
A JavaScript file in the substation finder folder of Code Generator that maps elizabeth line and uses data from the ventus-grid-engine repository. Served with the page at https://ventusltd.github.io/code-generator/apps/substation-finder/Si/.
Set aside from the main view: 100% of its lines are the same as atlas/cartridges/202611180026-substation-intelligence-v9-63.js (gridatlas), which stays. (near-copy-of, proposed by families.py). 99% of lines shared with Substation Intelligence V9 63; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9974 to gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atlas/cartridges/202611180026-substation-intelligence-v9-63.js:1-8609 c6f9632fdb6e803baae03a54a542fe508431d153
- sha256 d94b0de50deddac77643325b10fbe490ce44b8c406dbc6c67e6e7cadbdaa8ec6
- target sha256 88c538b97bf426776cda436151741f17500a2136867d28362407550d72f9038f
- group of 4 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
geodesycode-generator / apps/substation-finder/Si/202609062358-substation-intelligence-v9-63.js · lines 8401–8590 of 8590 · version 2026-09-06 23:58 (continued from section 283) · Not reached from any entry point (candidate for review) · pattern switchOn (shared by 4 files)
- What it does
- It maps elizabeth line, london underground, UK metros trams and hs2. Defines 238 functions or classes, including deepFreeze, escapeHTML, normalizeStatus, fmt, haversine. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'substation'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV.
- Inputs & outputs
- In: data source: ventus-grid-engine data; data source: data-federation-map-for-globalgrid2050-all-repos data; data source: spiders data; data source: npm data; GeoJSON file elizabeth_line.geojson; GeoJSON file london_underground.geojson; GeoJSON file uk_metros_trams.geojson; GeoJSON file hs2.geojson. Out: downloaded file gridatlas-; downloaded file globalgrid2050-grid-atlas-; interactive map; canvas drawing; SVG drawing. Voltage levels named: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV, 11kV.
- What it achieves
- It normalizes status (`normalizeStatus`), toggles zone draw mode (`toggleZoneDrawMode`) and opens popup (`openPopup`). ASSEMBLED by `tools/build-cartridge.mjs` from the parts below. Its code works with 400 kV, 100 MVA and 132 kV. It responds to fullscreenchange, webkitfullscreenchange and click events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- code-generator · apps/substation-finder/Si · script
- VEDIC
- SNAP LINE ENDS TO SUBSTATIONS (GG2050-VEDIC-000106): GridAtlas / Substations · Geospatial data processing. line_features, substation_point_features → Line features whose first and last vertices are moved onto the nearest substation point within tolerance; other geometry unchanged.
- VEDIC
- MEASURE (GG2050-VEDIC-000001): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, coordinate_pair → distance_km
- VEDIC
- REPRESENT (GG2050-VEDIC-000002): GridAtlas / Geodesy · Computer science / Geometry processing. geojson_geometry → coordinate_pair_or_null
- Uses
- Spider Full Po Test (estate URL), Data — Grid Studies Public Page (estate URL)
- Used by
- none found
- Produces
- deepFreeze, escapeHTML, normalizeStatus, fmt, haversine, _zoneDrawGetRadius, _zoneDrawCirclePoints, _zoneDrawCalcArea, _zoneDrawUpdateLayers, _zoneDrawShowPopup, _zoneDrawShowPopupDebounced, _zoneDrawClear
- Defines here
- eligible, unitCount
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- code-generator@3897d83efcd0259d21dce87704b0c33118fe2c2e apps/substation-finder/Si/202609062358-substation-intelligence-v9-63.js:8401-8590 · blob 2c8121b277e1b152a96688f6a2e0d7ef83471376 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: duplicate_candidate
for (const point of located) {
if (Math.max(...point.voltages_kv) < minimumKv) continue;
found.push({ point, km: distanceKm(lon, lat, point.location.lon, point.location.lat) });
}
found.sort((a, b) => a.km - b.km);
return limit === 1 ? (found[0] || null) : found.slice(0, limit);
};
/* One line a card can print, built only from what is published, or null
when nothing is. An empty sentence about a substation is worse than
silence. */
/* connectionKv is the voltage the connection is actually made at: the
declared point of connection's class, or the class of the substation
being measured to. Given one, the fault current is quoted at THAT
busbar group rather than across the site.
An outside review put the reason plainly: fault duty at a 400 kV
busbar and at a 132 kV busbar are different physical quantities
governing different switchgear, so a range spanning both is
meaningless to the engineer reading it - and the more correctly the
metric is named, the more readily the eye trusts it. */
/* WHAT A DISTANCE SEARCH COULD SEE, at the voltage it was asked for.
------------------------------------------------------------------
ETYS names substations and does not locate them; the only geometry
this estate holds comes from OpenStreetMap through a GridAtlas
release. So a proportion of what the operator publishes is invisible
to any search by distance, and a card that says "nearest" without
saying that is asserting something it cannot know.
COMPUTED, never written down. The numbers move when the product moves
- Codex's join correction takes located from 502 to 489 - and a
sentence with a literal in it would go quietly false the day the pin
is bumped. This counts the payload that was actually fetched, using
exactly the predicate state.nearest uses to decide what is eligible,
so the denominator on the card is the denominator of the search. */
state.coverage = (minimumKv) => {
if (!state.loaded) return null;
const floor = Number(minimumKv) || 0;
const eligible = (point) => Array.isArray(point.voltages_kv)
&& point.voltages_kv.length
&& Math.max(...point.voltages_kv) >= floor;
const inBand = published.filter(eligible);
const seen = located.filter(eligible);
return {
minimum_kv: floor,
published: inBand.length,
located: seen.length,
unlocated: inBand.length - seen.length,
/* Named rather than computed by the reader, and never graded. */
basis: 'counted from the connection-points payload this session fetched'
};
};
state.summarise = (name, options) => {
const point = state.byName(name);
if (!point) return null;
const connectionKv = options && Number(options.connectionKv);
/* connection-points.v3 publishes `circuits` and `transformers` as
LANDINGS - one per node-end at the site - not as machines. A
transformer's two windings are both at the site by construction, so
almost every transformer is counted twice: Cowley publishes 10 for
its five machines, and 484 of the 525 sites that hold a transformer
are overstated, 2,944 landings against 1,550 units (1.90x).
This cartridge holds no node pairs, so it cannot deduplicate on its
own; the caller may pass `units` derived from the node/branch model
by the network-topology module, which does hold them. Where it does,
the machine count is stated. Where it does not, the published figure
is still shown but is named for what it is, because a landing tally
presented as a machine count is the defect, not the tally. */
/* Number(null) is 0, not NaN, so `Number(units && units.x)` reports a
finite ZERO the moment no units are passed - which is every call
that does not supply them. The proof caught it saying "0 circuits"
for a site publishing eight. Read the field only when there is one. */
const units = (options && options.units) || null;
const unitCount = (field) => {
if (!units) return null;
const value = Number(units[field]);
return Number.isFinite(value) ? value : null;
};
const transformerUnits = unitCount('transformers');
const circuitUnits = unitCount('circuits');
const parts = [];
if (circuitUnits !== null) {
parts.push(circuitUnits + (circuitUnits === 1 ? ' circuit' : ' circuits'));
} else if (point.circuits) {
parts.push(point.circuits + (point.circuits === 1 ? ' circuit' : ' circuits'));
}
if (transformerUnits !== null) {
parts.push(transformerUnits
+ (transformerUnits === 1 ? ' transformer' : ' transformers'));
} else if (point.transformers) {
parts.push(point.transformers + ' transformer winding connections at the site '
+ '(a transformer whose windings are both here is published at each of them, '
+ 'so this is not a count of machines)');
}
const rating = point.circuit_winter_rating_mva;
if (rating) {
/* The product does not split ratings by voltage, and a site with
several voltages will show a range no single circuit could span -
Blackhillock publishes 23 to 1,995 MVA. So it is marked site-wide
wherever it appears, rather than sitting beside a bus-specific
fault figure as though it shared its scope. */
parts.push('circuit winter ratings across the site '
+ rating.min.toLocaleString('en-GB')
+ '\u2013' + rating.max.toLocaleString('en-GB') + ' MVA');
}
/* Prefer the busbar group the connection is made at. Fall back to the
site-wide envelope only when the voltage is unknown or the product
does not publish that group, and say which was used either way. */
const byVoltage = point.fault_current_by_voltage || null;
let peak = point.fault_current?.peak || null;
let faultScope = 'site';
let faultKv = null;
if (Number.isFinite(connectionKv) && byVoltage) {
const key = Object.keys(byVoltage)
.find(k => Math.abs(Number(k) - connectionKv) < 0.5);
if (key && byVoltage[key]?.peak) {
peak = byVoltage[key].peak;
faultScope = 'bus';
faultKv = Number(key);
}
}
const metric = peak?.metrics?.[QUOTED_METRIC];
if (metric) {
parts.push(QUOTED_METRIC_LABEL + ' ' + metric.min.toFixed(1) + '\u2013'
+ metric.max.toFixed(1) + ' ' + metric.unit
+ (faultScope === 'bus'
? ' at the ' + faultKv + ' kV busbars'
: ' across every busbar at this site')
+ ' over ' + peak.scenarios + ' peak-demand rows'
+ (peak.locations?.length ? ' at ' + peak.locations.length
+ (peak.locations.length === 1 ? ' bus' : ' buses') : '')
+ (peak.winters?.length
? ' (' + peak.winters[0] + ' to ' + peak.winters[peak.winters.length - 1] + ')'
: ''));
}
if (point.reactive_compensation?.units) {
parts.push(point.reactive_compensation.units + ' reactive compensation units');
}
if (point.planned_changes) {
const years = point.planned_change_years || [];
parts.push(point.planned_changes + ' changes published for '
+ (years.length ? years[0] + '\u2013' + years[years.length - 1] : 'later years'));
}
if (!parts.length) return null;
/* Everything above is aggregated at SITE CODE, not selected for a
bus. Where a site carries more than one voltage the numbers span
them, so the reader is told that before reading any of them -
otherwise a sentence under a 400 kV point of connection reads as a
400 kV result. West Burton is exactly this case: WBUR1 is 132 kV
and WBUR4 is 400 kV, and its published fault range spans both. */
const voltages = point.voltages_kv || [];
/* Site-wide is now about what remains site-wide. Once the fault
current is quoted at a busbar group, the label must not claim the
whole sentence is site-wide - only the parts that still are. */
const siteWide = voltages.length > 1;
const busLocations = point.fault_current?.peak?.locations || [];
return {
site_code: point.site_code,
transmission_owner: point.transmission_owner,
voltages_kv: voltages,
site_wide: siteWide,
bus_locations: busLocations,
fault_scope: faultScope,
fault_kv: faultKv,
scope_label: faultScope === 'bus'
? ('Fault current is quoted at the ' + faultKv + ' kV busbars, the '
+ 'voltage this connection is made at. Circuit counts, ratings, '
+ 'transformers and planned changes remain site-wide across the '
+ voltages.slice().sort((a, b) => b - a).join('/') + ' kV buses here')
: (siteWide
? ('Site-wide published envelope across the '
+ voltages.slice().sort((a, b) => b - a).join('/') + ' kV buses at this site, '
+ 'not a value for any one bus')
: ('Published for this site, which carries one voltage: '
+ (voltages[0] || '?') + ' kV')),
sentence: parts.join(' \u00b7 '),
metric_named: QUOTED_METRIC_LABEL,
metrics_not_interchangeable: 'Appendix D publishes eight current '
+ 'metrics and they are not interchangeable; this is one published '
+ 'breaker-duty metric, and switchgear carries several relevant '
+ 'ratings besides it.',
attribution: 'NESO Electricity Ten Year Statement 2025, appendices B and D, '
+ 'via Ventusltd/data-grid-gb',
not_an_assessment: 'Published parameters. Not a statement about whether '
+ 'any project can connect here.'
};
};
})();Substation Finder — Si Page
A map page in Code Generator that maps grid 400kV, grid 275kV, grid 220kV and grid 132kV, using haversine. Published at https://ventusltd.github.io/code-generator/apps/substation-finder/Si/.
geodesycode-generator / apps/substation-finder/Si/index.html · lines 1–510 of 5013 · Entry point · pattern enterFullscreen (shared by 2 files)
- What it does
- It maps grid 400kV, grid 275kV, grid 220kV and grid 132kV. Defines 104 functions or classes, including deepFreeze, escapeHTML, normalizeStatus, enterFullscreen, exitFullscreen. Side effects: changes the web page (DOM); reads or writes files; makes network requests.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'substation'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: 400kV, 275kV, 220kV, 132kV, 66kV, 11kV.
- Inputs & outputs
- In: GeoJSON file grid_400kv.geojson; GeoJSON file grid_275kv.geojson; GeoJSON file grid_220kv.geojson; GeoJSON file grid_132kv.geojson; GeoJSON file grid_66kv.geojson; GeoJSON file grid_11kv_ukpn.geojson; GeoJSON file grid_substations.geojson; GeoJSON file power_plants.geojson. Out: JSON file manifest_v4.json; web page; interactive map. Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid), WGS84 / EPSG:4326. Voltage levels named: 400kV, 275kV, 220kV, 132kV, 66kV, 11kV.
- Downstream impact
- It is itself an entry point, published at https://ventusltd.github.io/code-generator/apps/substation-finder/Si/.
- What it achieves
- It normalizes status (`normalizeStatus`), toggles curtain (`toggleCurtain`) and gets radius (`getRadiusValue`). Its `snapLines` function gives line features whose first and last vertices are moved onto the nearest substation point within tolerance; other geometry unchanged from line features and substation point features (VEDIC: snap line ends to substations). Its code works with 132 kV, 220 kV and 275 kV. It responds to fullscreenchange, webkitfullscreenchange and click events.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- code-generator · apps/substation-finder/Si · page
- VEDIC
- SNAP LINE ENDS TO SUBSTATIONS (GG2050-VEDIC-000106): GridAtlas / Substations · Geospatial data processing. line_features, substation_point_features → Line features whose first and last vertices are moved onto the nearest substation point within tolerance; other geometry unchanged.
- Uses
- https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css, https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js, https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css, https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js, https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.4.1/papaparse.min.js
- Used by
- mentioned in Standalone (comment link)
- Produces
- deepFreeze, escapeHTML, normalizeStatus, enterFullscreen, exitFullscreen, toggleCurtain, getRadiusValue, validateRadiusInput, fmt, updateMeasureDisplay, updateMeasureLayers, clearMeasure
- Defines here
- deepFreeze, escapeHTML, normalizeStatus, enterFullscreen, exitFullscreen, toggleCurtain, getRadiusValue, validateRadiusInput, fmt, updateMeasureDisplay, updateMeasureLayers, clearMeasure, toggleMeasureMode
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- code-generator@3897d83efcd0259d21dce87704b0c33118fe2c2e apps/substation-finder/Si/index.html:1-510 · blob 4e9b8b6a923698ac72c91325688593fcae31ffb3 · GitHub at these lines
- State
- achieves: code · context: readme_derived · stage: output · effects: dom, filesystem, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
supermarkets layer added
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>GlobalGrid2050 | Ventus Core</title>
<link href="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css" rel="stylesheet" />
<style>
html, body { margin: 0; padding: 0; width: 100%; height: 100%; background: #000; font-family: 'Courier New', monospace; color: white; overflow: hidden; }
.dashboard { display: flex; flex-direction: column; height: 100vh; height: 100dvh; width: 100vw; padding: 4px; gap: 4px; box-sizing: border-box; }
#fatal-banner { display: none; position: fixed; top: 0; left: 0; width: 100%; background: #ff0000; color: #fff; text-align: center; padding: 10px; font-weight: bold; z-index: 9999; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
.hud-header { background: #0a0a0a; border: 1px solid #333; border-radius: 6px; padding: 6px 12px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.hud-val { font-size: 16px; font-weight: bold; color: #00ffff; text-shadow: 0 0 5px #00ffff; }
.ventus-brand { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.ventus-main { font-family: -apple-system, sans-serif; font-size: 17px; font-weight: 800; color: #fff; letter-spacing: 5px; text-transform: uppercase; margin-bottom: 2px; }
.ventus-sub { font-family: -apple-system, sans-serif; font-size: 6.5px; color: #888; letter-spacing: 2px; text-transform: uppercase; }
.map-container { position: relative; flex-grow: 1; min-height: 0; border: 1px solid #222; border-radius: 6px; overflow: hidden; background: #0b0e14; }
#map { width: 100%; height: 100%; }
.podcast-shoutout { position: absolute; bottom: 6px; right: 8px; font-family: -apple-system, sans-serif; font-size: 8px; color: #fff; opacity: 0.5; text-align: right; text-transform: uppercase; letter-spacing: 1px; pointer-events: none; z-index: 10; text-shadow: 1px 1px 2px #000; }
.scada-wrapper { background: #050505; border: 1px solid #444; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; flex-shrink: 0; max-height: 38vh; }
.scada-brand { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #222; flex-shrink: 0; }
.scada-brand-main { font-family: -apple-system, sans-serif; font-size: 11px; font-weight: 800; color: #fff; letter-spacing: 4px; text-transform: uppercase; }
.scada-brand-sub { font-family: -apple-system, sans-serif; font-size: 6px; color: #555; letter-spacing: 2px; text-transform: uppercase; }
.scada-brand-tag { margin-left: auto; font-family: 'Courier New', monospace; font-size: 7px; color: #333; text-transform: uppercase; letter-spacing: 1px; }
.scada-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; overflow-y: auto; padding-bottom: 5px; }
.key-group { border-left: 2px solid #333; padding-left: 10px; margin-bottom: 4px; }
.key-title { font-size: 10px; color: #66ccff; text-transform: uppercase; margin-bottom: 6px; font-weight: bold; }
.key-item { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { transform: scale(1.3); margin-right: 4px; accent-color: #00ffff; }
.maplibregl-popup-content { background: #000; color: #00ffff; border: 1px solid #444; font-family: monospace; font-size: 12px; padding: 8px; }
.disclaimer-box { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; text-align: justify; font-size: 9px; line-height: 1.5; color: #666; margin-top: 10px; padding-top: 10px; border-top: 1px solid #222; user-select: none; pointer-events: none; flex-shrink: 0; }
.custom-map-attrib { position: absolute; top: 10px; left: 10px; background: rgba(5, 5, 5, 0.7); color: #888; font-family: 'Courier New', monospace; font-size: 9px; border-radius: 4px; padding: 4px 8px; z-index: 10; border: 1px solid #333; pointer-events: auto; max-width: calc(100% - 60px); line-height: 1.6; }
.custom-map-attrib a { color: #00ffff; text-decoration: none; }
.custom-map-attrib a:hover { text-decoration: underline; }
body.fs-active .custom-map-attrib { top: 44px; }
.popup-search-btns { display: flex; gap: 6px; margin-top: 8px; }
.popup-btn { flex: 1; padding: 5px 0; font-family: monospace; font-size: 11px; font-weight: bold; border: 1px solid #444; border-radius: 3px; cursor: pointer; text-align: center; text-decoration: none; display: block; transition: border-color 0.15s, color 0.15s; }
.popup-btn-news { background: #0a0a0a; color: #ffae00; border-color: #ffae00; }
.popup-btn-news:hover { background: #ffae00; color: #000; }
.popup-btn-images { background: #0a0a0a; color: #00ffff; border-color: #00ffff; }
.popup-btn-images:hover { background: #00ffff; color: #000; }
.search-bar-wrapper { position: absolute; top: 72px; right: 10px; z-index: 20; display: flex; gap: 6px; }
body.fs-active .search-bar-wrapper { top: 100px; }
.search-input { background: rgba(5,5,5,0.85); border: 1px solid #444; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 10px; width: 220px; outline: none; }
.search-input::placeholder { color: #444; }
.search-input:focus { border-color: #00ffff; }
.search-btn { background: #0a0a0a; border: 1px solid #00ffff; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 10px; cursor: pointer; }
.search-btn:hover { background: #00ffff; color: #000; }
.search-results { position: absolute; top: 36px; right: 0; background: #050505; border: 1px solid #333; border-radius: 4px; width: 300px; max-height: 220px; overflow-y: auto; z-index: 21; display: none; }
.search-result-item { padding: 7px 10px; font-family: 'Courier New', monospace; font-size: 10px; color: #888; cursor: pointer; border-bottom: 1px solid #111; line-height: 1.5; }
.search-result-item:hover { background: #111; color: #00ffff; }
.search-result-item b { color: #ffcc00; }
.search-no-results { padding: 8px 10px; font-family: 'Courier New', monospace; font-size: 10px; color: #444; }
.map-controls { position: absolute; bottom: 30px; left: 10px; z-index: 20; display: flex; flex-direction: column; gap: 4px; }
.map-ctrl-btn { background: rgba(5,5,5,0.85); border: 1px solid #333; border-radius: 4px; color: #888; font-family: 'Courier New', monospace; font-size: 9px; padding: 5px 8px; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.map-ctrl-btn:hover { border-color: #00ffff; color: #00ffff; }
.map-ctrl-btn.active { border-color: #00ffff; color: #00ffff; background: rgba(0,255,255,0.08); }
.radius-popup { position: absolute; bottom: 30px; left: 120px; z-index: 20; background: #050505; border: 1px solid #444; border-radius: 4px; padding: 8px 12px; display: none; }
.radius-popup label { font-size: 9px; color: #888; text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 4px; }
.radius-input-row { display: flex; align-items: center; gap: 4px; }
#radius-input { background: #0a0a0a; border: 1px solid #333; color: #00ffff; font-family: 'Courier New', monospace; font-size: 12px; font-weight: bold; padding: 3px 6px; border-radius: 3px; width: 56px; outline: none; text-align: right; -moz-appearance: textfield; }
#radius-input::-webkit-outer-spin-button, #radius-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#radius-input:focus { border-color: #00ffff; }
#radius-input.invalid { border-color: #ff4444; color: #ff4444; }
.radius-unit { font-size: 10px; color: #555; font-family: 'Courier New', monospace; white-space: nowrap; }
.radius-hint { font-size: 8px; color: #444; margin-top: 4px; letter-spacing: 0.5px; }
/* Measure display */
#measure-display { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 20; background: rgba(5,5,5,0.92); border: 1px solid #00ffff; border-radius: 4px; padding: 8px 14px; display: none; font-family: 'Courier New', monospace; font-size: 10px; color: #00ffff; text-align: center; white-space: nowrap; pointer-events: none; }
#measure-display .m-row { margin-bottom: 2px; color: #888; }
#measure-display .m-row span { color: #00ffff; }
#measure-display .m-hint { font-size: 8px; color: #444; margin-top: 4px; }
/* Fullscreen letterhead */
#fs-letterhead { display: none; position: fixed; top: 8px; right: 12px; z-index: 512; text-align: right; pointer-events: none; }
#fs-letterhead .ventus-main { font-family: -apple-system, sans-serif; font-size: 15px; font-weight: 800; color: #fff; letter-spacing: 5px; text-transform: uppercase; margin-bottom: 1px; }
#fs-letterhead .ventus-sub { font-family: -apple-system, sans-serif; font-size: 6px; color: #888; letter-spacing: 2px; text-transform: uppercase; }
body.fs-active #fs-letterhead { display: block; }
.status-legend { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 6px 0; border-bottom: 1px solid #222; margin-bottom: 6px; flex-shrink: 0; }
.status-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 8px; color: #555; }
.status-dot span { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.map-container.is-fullscreen { position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; border-radius: 0; border: none; z-index: 500; }
#btn-fullscreen { position: absolute; top: 10px; right: 10px; z-index: 25; background: rgba(5,5,5,0.85); border: 1px solid #333; border-radius: 4px; color: #888; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 8px; cursor: pointer; letter-spacing: 1px; line-height: 1; }
#btn-fullscreen:hover { border-color: #00ffff; color: #00ffff; }
#btn-fullscreen-exit { display: none; position: fixed; top: 8px; left: 12px; z-index: 510; background: rgba(5,5,5,0.9); border: 1px solid #00ffff; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 10px; padding: 5px 10px; cursor: pointer; letter-spacing: 1px; }
.is-fullscreen ~ #btn-fullscreen-exit, body.fs-active #btn-fullscreen-exit { display: block; }
#fs-curtain { display: none; position: fixed; top: 0; left: 0; width: 100vw; z-index: 505; background: rgba(5, 5, 5, 0.96); border-bottom: 1px solid #333; transform: translateY(-100%); transition: transform 0.3s ease; max-height: 70dvh; overflow-y: auto; padding: 48px 16px 16px 16px; box-sizing: border-box; }
#fs-curtain.curtain-open { transform: translateY(0); }
body.fs-active #fs-curtain { display: block; }
#fs-curtain-tab { display: none; position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 510; background: rgba(5,5,5,0.9); border: 1px solid #333; border-top: none; border-radius: 0 0 6px 6px; color: #555; font-family: 'Courier New', monospace; font-size: 9px; padding: 4px 16px 5px 16px; cursor: pointer; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; … [line shortened here: 447 characters; full line on GitHub]
#fs-curtain-tab:hover { color: #00ffff; border-color: #00ffff; }
body.fs-active #fs-curtain-tab { display: block; }
.map-container.is-fullscreen #fs-curtain-tab { display: block; }
#fs-curtain-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
</style>
</head>
<body>
<div id="fatal-banner">CRITICAL ERROR: SYSTEM DEPENDENCIES FAILED TO LOAD</div>
<button id="btn-fullscreen-exit" onclick="exitFullscreen()">✕ Exit</button>
<div id="fs-curtain-tab">⬇ Layers</div>
<div id="fs-curtain"><div id="fs-curtain-keys"></div></div>
<div id="fs-letterhead">
<div class="ventus-main">Ventus</div>
<div class="ventus-sub">Cables & Connectivity®</div>
</div>
<div class="dashboard">
<div class="hud-header">
<div>
<small style="color:#888">SYSTEM TIME</small><br>
<span class="hud-val" id="clock">--:--:--</span><br>
<span id="date" style="font-size: 11px; color: #888;">--/--/----</span>
</div>
<div class="ventus-brand">
<div class="ventus-main">Ventus</div>
<div class="ventus-sub">Cables & Connectivity®</div>
</div>
<div style="text-align:right"><small style="color:#888">2050 TARGET</small><br><span class="hud-val" id="days" style="color:#ff9d00">-- DAYS</span></div>
</div>
<div class="map-container" id="map-container">
<div id="map"></div>
<div class="custom-map-attrib">
Data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap contributors</a> | © CARTO | EV data © <a href="https://openchargemap.org" target="_blank" rel="noopener noreferrer">Open Charge Map</a>
</div>
<button id="btn-fullscreen" onclick="enterFullscreen()" title="Fullscreen">⛶</button>
<div class="search-bar-wrapper">
<div style="position:relative">
<input class="search-input" id="search-input" type="text" placeholder="Search project name..." autocomplete="off" />
<div class="search-results" id="search-results"></div>
</div>
<button class="search-btn" id="search-btn">GO</button>
</div>
<div class="map-controls">
<button class="map-ctrl-btn" id="btn-export">⬇ Export CSV</button>
<button class="map-ctrl-btn" id="btn-radius">◎ Radius Search</button>
<button class="map-ctrl-btn" id="btn-status">◑ Status Colours</button>
<button class="map-ctrl-btn" id="btn-measure">📏 Measure</button>
</div>
<div class="radius-popup" id="radius-popup">
<label>Radius from click</label>
<div class="radius-input-row">
<input type="number" id="radius-input" value="10" min="1" max="160" step="1" />
<span class="radius-unit">km</span>
</div>
<div class="radius-hint">1 – 160 km (100 mi) · press Enter to apply</div>
</div>
<div id="measure-display">
<div class="m-row" id="m-line" style="display:none">━━ <span id="m-km"></span> km | <span id="m-m"></span> m | <span id="m-mi"></span> mi</div>
<div class="m-row" id="m-perim" style="display:none">Perimeter: <span id="m-pkm"></span> km | <span id="m-pm"></span> m</div>
<div class="m-row" id="m-area" style="display:none">Area: <span id="m-km2"></span> km² | <span id="m-ha"></span> ha | <span id="m-ac"></span> ac</div>
<div class="m-hint" id="m-hint">Click to add points · Double-click to close polygon</div>
</div>
<div class="podcast-shoutout">In support of The Future of Solar Photovoltaics podcast<br>& all participants to date</div>
</div>
<div class="scada-wrapper">
<div class="scada-brand">
<div>
<div class="scada-brand-main">Ventus</div>
<div class="scada-brand-sub">Cables & Connectivity®</div>
</div>
<div class="scada-brand-tag">globalgrid2050.com | open infrastructure intelligence</div>
</div>
<div class="status-legend">
<div class="status-dot"><span style="background:#00ff88"></span>Operational</div>
<div class="status-dot"><span style="background:#ffcc00"></span>Under Construction</div>
<div class="status-dot"><span style="background:#ff8800"></span>Consented</div>
<div class="status-dot"><span style="background:#8888ff"></span>Applied</div>
</div>
<div class="scada-keys" id="scada-ui-container"></div>
<div class="disclaimer-box">
This interface is based on publicly available and open source infrastructure data, including public energy datasets such as REPD where applicable. It is presented for analytical and visualisation purposes only and does not include live operational or other non public operational data.
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js"></script>
<script>
'use strict';
if (typeof maplibregl === 'undefined') {
document.getElementById('fatal-banner').style.display = 'block';
throw new Error('CRITICAL: MapLibre failed to load.');
}
function deepFreeze(obj) {
Object.keys(obj).forEach(prop => {
if (typeof obj[prop] === 'object' && obj[prop] !== null) deepFreeze(obj[prop]);
});
return Object.freeze(obj);
}
function escapeHTML(value) {
return String(value ?? '')
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
.replace(/"/g, '"').replace(/'/g, ''');
}
function normalizeStatus(status) {
return String(status ?? '').trim().toLowerCase();
}
let fsActive = false;
let curtainOpen = false;
function enterFullscreen() {
fsActive = true;
document.body.classList.add('fs-active');
document.documentElement.classList.add('fs-active');
document.getElementById('map-container').classList.add('is-fullscreen');
document.getElementById('btn-fullscreen').style.display = 'none';
const el = document.getElementById('map-container');
if (el.requestFullscreen) { el.requestFullscreen().catch(() => {}); }
else if (el.webkitRequestFullscreen) { el.webkitRequestFullscreen(); }
setTimeout(() => map.resize(), 50);
}
function exitFullscreen() {
fsActive = false;
curtainOpen = false;
document.body.classList.remove('fs-active');
document.documentElement.classList.remove('fs-active');
document.getElementById('map-container').classList.remove('is-fullscreen');
document.getElementById('btn-fullscreen').style.display = '';
document.getElementById('fs-curtain').classList.remove('curtain-open');
if (document.fullscreenElement || document.webkitFullscreenElement) {
if (document.exitFullscreen) document.exitFullscreen().catch(() => {});
else if (document.webkitExitFullscreen) document.webkitExitFullscreen();
}
setTimeout(() => map.resize(), 50);
}
function toggleCurtain() {
curtainOpen = !curtainOpen;
const curtain = document.getElementById('fs-curtain');
const tab = document.getElementById('fs-curtain-tab');
curtain.classList.toggle('curtain-open', curtainOpen);
tab.innerText = curtainOpen ? '⬆ Close' : '⬇ Layers';
}
document.addEventListener('fullscreenchange', () => { if (!document.fullscreenElement && fsActive) exitFullscreen(); });
document.addEventListener('webkitfullscreenchange', () => { if (!document.webkitFullscreenElement && fsActive) exitFullscreen(); });
const RADIUS_MIN = 1;
const RADIUS_MAX = 160;
function getRadiusValue() {
const raw = parseFloat(document.getElementById('radius-input').value);
if (isNaN(raw) || raw < RADIUS_MIN) return RADIUS_MIN;
if (raw > RADIUS_MAX) return RADIUS_MAX;
return raw;
}
function validateRadiusInput() {
const input = document.getElementById('radius-input');
const raw = parseFloat(input.value);
const invalid = isNaN(raw) || raw < RADIUS_MIN || raw > RADIUS_MAX;
input.classList.toggle('invalid', invalid);
return !invalid;
}
// ── Measure tool state ──────────────────────────────────────────────
let measureMode = false;
let measurePoints = [];
let measureClosed = false;
function fmt(n, decimals) {
return n.toLocaleString('en-GB', { maximumFractionDigits: decimals, minimumFractionDigits: decimals });
}
function updateMeasureDisplay() {
const disp = document.getElementById('measure-display');
const lineEl = document.getElementById('m-line');
const perimEl = document.getElementById('m-perim');
const areaEl = document.getElementById('m-area');
const hint = document.getElementById('m-hint');
if (measurePoints.length < 2) {
lineEl.style.display = 'none';
perimEl.style.display = 'none';
areaEl.style.display = 'none';
hint.innerText = 'Click to add points · Double-click to close polygon';
return;
}
// Total line length
let totalKm = 0;
for (let i = 1; i < measurePoints.length; i++) {
totalKm += haversine(
measurePoints[i-1][0], measurePoints[i-1][1],
measurePoints[i][0], measurePoints[i][1]
);
}
if (!measureClosed) {
lineEl.style.display = 'block';
perimEl.style.display = 'none';
areaEl.style.display = 'none';
document.getElementById('m-km').innerText = fmt(totalKm, 2);
document.getElementById('m-m').innerText = fmt(totalKm * 1000, 0);
document.getElementById('m-mi').innerText = fmt(totalKm * 0.621371, 2);
hint.innerText = 'Double-click last point to close polygon';
} else {
// Closed polygon — add closing segment
const closingKm = haversine(
measurePoints[measurePoints.length-1][0], measurePoints[measurePoints.length-1][1],
measurePoints[0][0], measurePoints[0][1]
);
const perimKm = totalKm + closingKm;
// Shoelace area in km²
let area = 0;
const R = 6371;
const pts = measurePoints;
for (let i = 0; i < pts.length; i++) {
const j = (i + 1) % pts.length;
const xi = pts[i][0] * Math.PI / 180;
const yi = pts[i][1] * Math.PI / 180;
const xj = pts[j][0] * Math.PI / 180;
const yj = pts[j][1] * Math.PI / 180;
area += (xj - xi) * (2 + Math.sin(yi) + Math.sin(yj));
}
const areaKm2 = Math.abs(area) * R * R / 2;
const areaHa = areaKm2 * 100;
const areaAc = areaKm2 * 247.105;
lineEl.style.display = 'none';
perimEl.style.display = 'block';
areaEl.style.display = 'block';
document.getElementById('m-pkm').innerText = fmt(perimKm, 2);
document.getElementById('m-pm').innerText = fmt(perimKm * 1000, 0);
document.getElementById('m-km2').innerText = fmt(areaKm2, 3);
document.getElementById('m-ha').innerText = fmt(areaHa, 1);
document.getElementById('m-ac').innerText = fmt(areaAc, 1);
hint.innerText = 'Click 📏 Measure again to reset';
}
}
function updateMeasureLayers() {
if (!map.getSource('src-measure-line')) return;
const lineCoords = [...measurePoints];
if (measureClosed && measurePoints.length > 2) lineCoords.push(measurePoints[0]);
map.getSource('src-measure-line').setData({
type: 'FeatureCollection',
features: lineCoords.length > 1 ? [{
type: 'Feature',
geometry: { type: 'LineString', coordinates: lineCoords }
}] : []
});
map.getSource('src-measure-fill').setData({
type: 'FeatureCollection',
features: measureClosed && measurePoints.length > 2 ? [{
type: 'Feature',
geometry: { type: 'Polygon', coordinates: [[...measurePoints, measurePoints[0]]] }
}] : []
});
map.getSource('src-measure-points').setData({
type: 'FeatureCollection',
features: measurePoints.map(c => ({
type: 'Feature',
geometry: { type: 'Point', coordinates: c }
}))
});
}
function clearMeasure() {
measurePoints = [];
measureClosed = false;
updateMeasureLayers();
updateMeasureDisplay();
document.getElementById('measure-display').style.display = 'none';
}
function toggleMeasureMode() {
measureMode = !measureMode;
document.getElementById('btn-measure').classList.toggle('active', measureMode);
map.getCanvas().style.cursor = measureMode ? 'crosshair' : '';
if (!measureMode) {
clearMeasure();
} else {
// Exit radius mode if active
if (radiusMode) toggleRadiusMode();
document.getElementById('measure-display').style.display = 'block';
updateMeasureDisplay();
}
}
const GRID_CONFIG = deepFreeze([
{
group: "Topology (GeoJSON)",
layers: [
{ id: "400", label: "400kV", color: "#0054ff", type: "line", width: 2.5, url: "/grid_400kv.geojson", snap: true, preload: true },
{ id: "275", label: "275kV", color: "#ff0000", type: "line", width: 2.0, url: "/grid_275kv.geojson", snap: true, preload: true },
{ id: "220", label: "220kV", color: "#ff9900", type: "line", width: 1.8, url: "/grid_220kv.geojson", snap: true, preload: true },
{ id: "132", label: "132kV", color: "#00cc00", type: "line", width: 1.5, url: "/grid_132kv.geojson", snap: true, preload: true },
{ id: "66", label: "66kV", color: "#b200ff", type: "line", width: 1.2, url: "/grid_66kv.geojson", snap: true, preload: true },
{ id: "11kv", label: "11kV (UKPN)", color: "#ff00ff", type: "point", radius: ['interpolate', ['linear'], ['zoom'], 13.5, 4, 15, 8, 18, 18], url: "/grid_11kv_ukpn.geojson", minzoom: 13.5, preload: false },
{ id: "subs", label: "Subs", color: "#ffffff", type: "point", radius: ['interpolate', ['linear'], ['zoom'], 5, 3, 10, 5, 14, 10, 18, 22], url: "/grid_substations.geojson", isSubs: true, preload: true }
]
},
{
group: "Assets (GeoJSON)",
layers: [
{ id: "nuc", label: "Nuclear", color: "#39ff14", type: "point", radius: 4.5, url: "/power_plants.geojson", filter: ['==', ['get', 'source'], 'nuclear'], preload: true },
{ id: "gas", label: "Gas", color: "#ff4500", type: "point", radius: 4.5, url: "/power_plants.geojson", filter: ['!=', ['get', 'source'], 'nuclear'], preload: true },
{ id: "ind", label: "Industry", color: "#ff6600", type: "point", radius: 4.5, url: "/industrial_offtakers.geojson", preload: true },
{ id: "dc", label: "Data Ctrs", color: "#00ffff", type: "point", radius: 4.5, url: "/datacentres.geojson", preload: true },
{ id: "air", label: "Airports", color: "#ff00ff", type: "point", radius: 4.5, url: "/airports.geojson", preload: true },
{ id: "rail", label: "Railways", color: "#ffd700", type: "point", radius: 4.5, url: "/railways.geojson", preload: true }
]
},
{
group: "Supermarkets (GeoJSON)",
layers: [
{ id: "tesco", label: "Tesco", color: "#ee1c2e", type: "point", radius: 4.5, url: "/supermarkets_tesco.geojson", preload: false },
{ id: "sainsburys", label: "Sainsbury's", color: "#ff8200", type: "point", radius: 4.5, url: "/supermarkets_sainsburys.geojson", preload: false },
{ id: "asda", label: "Asda", color: "#78be20", type: "point", radius: 4.5, url: "/supermarkets_asda.geojson", preload: false },
{ id: "morrisons", label: "Morrisons", color: "#ffd700", type: "point", radius: 4.5, url: "/supermarkets_morrisons.geojson", preload: false },
{ id: "aldi", label: "Aldi", color: "#003087", type: "point", radius: 4.5, url: "/supermarkets_aldi.geojson", preload: false },
{ id: "lidl", label: "Lidl", color: "#0050aa", type: "point", radius: 4.5, url: "/supermarkets_lidl.geojson", preload: false },
{ id: "waitrose", label: "Waitrose", color: "#7ab800", type: "point", radius: 4.5, url: "/supermarkets_waitrose.geojson", preload: false },
{ id: "ms", label: "M&S Food", color: "#009b77", type: "point", radius: 4.5, url: "/supermarkets_ms.geojson", preload: false },
{ id: "coop", label: "Co-op", color: "#00b1a9", type: "point", radius: 4.5, url: "/supermarkets_coop.geojson", preload: false },
{ id: "iceland", label: "Iceland", color: "#c8102e", type: "point", radius: 4.5, url: "/supermarkets_iceland.geojson", preload: false },
{ id: "farmfoods", label: "Farmfoods", color: "#e30613", type: "point", radius: 4.5, url: "/supermarkets_farmfoods.geojson", preload: false },
{ id: "costco", label: "Costco", color: "#005daa", type: "point", radius: 4.5, url: "/supermarkets_costco.geojson", preload: false },
{ id: "booths", label: "Booths", color: "#6d2077", type: "point", radius: 4.5, url: "/supermarkets_booths.geojson", preload: false },
{ id: "spar", label: "Spar", color: "#00a650", type: "point", radius: 4.5, url: "/supermarkets_spar.geojson", preload: false }
]
},
{
group: "Transit (GeoJSON)",
layers: [
{ id: "lu", label: "London Underground", color: "#e32017", type: "point", radius: 5, url: "/london_underground.geojson", preload: false },
{ id: "dlr", label: "DLR", color: "#00afad", type: "point", radius: 5, url: "/uk_metros_trams.geojson", preload: false,
filter: ['all', ['in', 'Docklands', ['get', 'operator']], ['!', ['in', 'London Underground', ['get', 'operator']]]] },
{ id: "metro", label: "UK Metro", color: "#f3a712", type: "point", radius: 5, url: "/uk_metros_trams.geojson", preload: false,
filter: ['any', ['in', 'Tyne', ['get', 'operator']], ['in', 'Metrolink', ['get', 'operator']], ['in', 'Supertram', ['get', 'operator']], ['in', 'Nottingham', ['get', 'operator']], ['in', 'Edinburgh', ['get', 'operator']], ['in', 'Midland Metro', ['get', 'operator']]] },
{ id: "tram", label: "Trams & Light Rail", color: "#84329b", type: "point", radius: 5, url: "/uk_metros_trams.geojson", preload: false,
filter: ['all', ['==', ['get', 'type'], 'Tram / Light Rail'], ['!', ['in', 'London Underground', ['get', 'operator']]]] },
{ id: "hs2", label: "HS2", color: "#2c6fad", type: "point", radius: 4, url: "/hs2.geojson", preload: false }
]
},
{
group: "EV (GeoJSON)",
layers: [
{ id: "ev", label: "EV Rapid (100kW+)", color: "#00ff88", type: "point", radius: 5, url: "/ev_chargers.geojson", preload: false }
]
},
{
group: "REPD (GeoJSON)",
layers: [
{ id: "solar", label: "Solar PV", color: "#ffff00", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'solar'], preload: false },
{ id: "solar_roof", label: "Solar Roof", color: "#ffcc00", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'solar_roof'], preload: false },
{ id: "wind", label: "Wind", color: "#00ffff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'wind'], preload: false },
{ id: "bess", label: "Battery Storage", color: "#ffae00", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'bess'], preload: false },
{ id: "biomass", label: "Biomass & EfW", color: "#39ff14", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'biomass'], preload: false },
{ id: "tidal", label: "Tidal & Wave", color: "#00bfff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'tidal'], preload: false },
{ id: "hydrogen", label: "Hydrogen", color: "#ffffff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'hydrogen'], preload: false },
{ id: "hydro", label: "Hydro & Pumped Storage", color: "#00aaff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'hydro'], preload: false },
{ id: "flywheel", label: "Flywheel", color: "#ff69b4", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'flywheel'], preload: false },
{ id: "act", label: "Advanced Conversion", color: "#ff6600", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'act'], preload: false },
{ id: "geothermal", label: "Geothermal", color: "#ff3300", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'geothermal'], preload: false },
{ id: "caes", label: "Compressed Air Storage", color: "#88aaff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'caes'], preload: false }
]
}
]);
const REPD_IDS = ['solar','solar_roof','wind','bess','biomass','tidal','hydrogen','hydro','flywheel','act','geothermal','caes'];
const TRANSIT_IDS = ['lu','dlr','metro','tram','hs2'];
const TRANSIT_SOURCE_MAP = { 'lu':'src-lu','dlr':'src-metros','metro':'src-metros','tram':'src-metros','hs2':'src-hs2' };
const TRANSIT_URLS = { 'src-lu':'/london_underground.geojson','src-metros':'/uk_metros_trams.geojson','src-hs2':'/hs2.geojson' };
const SEARCH_THRESHOLD = {
'solar':50,'solar_roof':0.5,'wind':50,'bess':50,'biomass':50,
'tidal':10,'hydrogen':10,'hydro':10,'flywheel':1,'act':10,'geothermal':1,'caes':1
};
const STATUS_COLOURS = {
'operational':'#00ff88','under construction':'#ffcc00','awaiting construction':'#ffaa00',
'consented':'#ff8800','planning permission granted':'#ff8800','planning approved':'#ff8800',
'application submitted':'#8888ff','pre-construction':'#aaaaff'
};
let statusMode = false;
let radiusMode = false;
let radiusMarker = null;
let radiusCenter = null;
const RUNTIME_STATE = {};
GRID_CONFIG.forEach(group => {
group.layers.forEach(layer => {
RUNTIME_STATE[layer.id] = { status: 'WAIT', loading: false, loaded: false };
});
});
const urlCache = {};
let globalSubsData = null;
let allREPDFeatures = [];
let searchIndex = [];
setInterval(() => {
const now = new Date();
const target = new Date(Date.UTC(2050, 0, 1, 0, 0, 0));
document.getElementById('clock').innerText = now.toLocaleTimeString('en-GB');