From 015bf25a799782f5287199278c6b50d4bebf2252 Mon Sep 17 00:00:00 2001 From: Renzo Will Date: Fri, 16 Oct 2026 06:08:45 +1000 Subject: [PATCH 1/6] feat(transit): add Cairns and Adelaide Metro; mode hints for TransLink MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - translink-cairns: TransLink CNS vehicle positions (keyless, CC BY 4.0, same open-data page as SEQ). - adelaide-metro: Adelaide Metro GTFS-R vehicle positions (keyless, CC BY 4.0 per the data.sa.gov.au catalogue). Its gateway negotiates on Accept and returns base64 protobuf as JSON for the proxy's default list, so the feed asks for application/x-google-protobuf. - TransLink route ids now resolve rail (station-pair codes), the Gold Coast light rail (L1) and ferries (F*, SMBI); buses, Brisbane Metro and the SHUT rail-replacement bus stay on the bus default. Adelaide trains, trams and the SeaLink ferry resolve from its static route list. Both rule sets checked against the operators' routes.txt. - Credits: "Translink, Department of Transport and Main Roads" and "Adelaide Metro – Department for Infrastructure and Transport, South Australia", each with its CC BY 4.0 link (generated per feed by transitFeedCredit). DATA_SOURCES rows follow the transit row style. Co-Authored-By: Claude Opus 5.5 (1M context) --- DATA_SOURCES.md | 5 +- scripts/format-scope.json | 1 + src/data/transitFeeds.js | 97 ++++++++++++++++- src/data/transitFeedsAustralia.test.mjs | 139 ++++++++++++++++++++++++ 4 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 src/data/transitFeedsAustralia.test.mjs diff --git a/DATA_SOURCES.md b/DATA_SOURCES.md index a4035f1754..62dc3d6c81 100644 --- a/DATA_SOURCES.md +++ b/DATA_SOURCES.md @@ -85,7 +85,8 @@ How to read this: | **Metro Transit** (Metropolitan Council) | Transit layer live vehicles, Minneapolis–St Paul | Metro Transit / Metropolitan Council open realtime vehicle data, used for the live view; published for developer use and not against their use. | Attribution to Metro Transit / Metropolitan Council (courtesy text) | | **OVapi / Stichting OpenGeo** | Transit layer live vehicles, Netherlands | OVapi / Stichting OpenGeo open realtime vehicle data, used for the live view; published for developer use and not against their use. The client sends a User-Agent and conditional requests. | Attribution to OVapi / Stichting OpenGeo (courtesy text) | | **Entur** (api.entur.io) | Transit layer live vehicles, Norway | Entur open realtime vehicle data, used for the live view; published for developer use and not against their use. The client sends the `ET-Client-Name` identifying header. | Attribution to Entur (courtesy text) | -| **TransLink** (Queensland Government) | Transit layer live vehicles, South East Queensland | TransLink / Queensland Government open realtime vehicle data, used for the live view; published for developer use and not against their use. | Attribution to TransLink / Queensland Government (courtesy text) | +| **TransLink** (Queensland Government) | Transit layer live vehicles, South East Queensland and Cairns | TransLink / Queensland Government open realtime vehicle data, used for the live view; published for developer use and not against their use. | Attribution to Translink, Department of Transport and Main Roads (courtesy text) | +| **Adelaide Metro** (gtfs.adelaidemetro.com.au) | Transit layer live vehicles, Adelaide | Adelaide Metro / Department for Infrastructure and Transport (South Australia) open realtime vehicle data, used for the live view; published for developer use and not against their use. | Attribution to Adelaide Metro – Department for Infrastructure and Transport, South Australia (courtesy text) | | **HSL** (realtime.hsl.fi) | Transit layer live vehicles, Helsinki | HSL (Helsinki Region Transport) open realtime vehicle data, used for the live view; published for developer use and not against their use. | Attribution to HSL (Helsinki Region Transport) (courtesy text) | | **TTC** (bustime.ttc.ca) | Transit layer live vehicles, Toronto — surface vehicles (buses and streetcars) only | Toronto Transit Commission BusTime open realtime vehicle data, published through City of Toronto Open Data and used for the live view. The subway publishes no vehicle positions, so Lines 1/2/4 are absent rather than inferred. | Attribution to Toronto Transit Commission — City of Toronto Open Data, under the Open Government Licence – Toronto | | **MiWay** (miapp.ca) | Transit layer live vehicles, Mississauga ON | MiWay open realtime vehicle data, published by the City of Mississauga under its Open Data Terms of Use, used for the live view. The licence is revocable and asks that the Terms of Use link travel with the data. | Attribution to MiWay — City of Mississauga Open Data, linked to the Terms of Use | @@ -179,7 +180,7 @@ The optional Local ADS-B layer and the broadcast-FM receiver use radio you recei - **City of Toronto RESCU cameras.** Keyless. The camera list is the City's public `tmcearthcameras.json` on `opendata.toronto.ca` (dataset "Traffic Cameras", Transportation Services), served as JSONP and unwrapped with an anchored pattern. This is the municipal network the Ontario 511 pack does not carry: downtown arterials plus the Gardiner, DVP, Allen and Lake Shore. The list publishes no frame URL, so frame URLs are BUILT from the documented `CameraImages/loc####.jpg` convention and a strictly-digits camera number, pinning the frame proxy to the portal origin by construction; the list fetch refuses redirects and bounds the body it buffers. Frames are fetched at request time and never stored or redistributed. The dataset publishes no camera facing: the `D1`-`D4` fields are the directions of the *comparison* images (static reference stills captured in 2016 under a different path), not a bearing for the live pan-tilt-zoom frame, so headings use the shared id-hash fallback at low confidence and are corrected with the in-app calibration gizmo. A camera that is temporarily out of service still answers 200 with a byte-identical "Image Unavailable" placeholder rather than an error (about 6% of the network at any moment), so such a camera reads as healthy; the frame it shows is the agency's, not a synthesized one. The licence requires the attribution statement above. Disable with `CCTV_TORONTO_ENABLED=0`. - **Autostrada del Brennero (A22) webcams.** Keyless. The camera list is one request to the Open Data Hub tourism API (`tourism.api.opendatahub.com/v1/WebcamInfo?source=a22`), run by NOI Techpark in South Tyrol, which republishes Autobrennero's own list of 13 motorway webcams with coordinates and kilometre markers. Frames are the operator's stills on `www.autobrennero.it/WebCamImg/km.jpg`, refreshed about once a minute, and only the exact image for each camera's kilometre is registered. The feed names no bearing, so headings use the id-hash fallback at low confidence. The road climbs from about 20 m in the Po valley to about 1,370 m at the Brenner Pass, so each camera's ground elevation comes from a per-kilometre table sampled from the Copernicus GLO-90 DEM (via Open-Meteo's elevation API); a camera not in the table uses a 200 m prior. The Open Data Hub tags every record CC0 (`ClosedData: false`, Autobrennero as licence holder), but that tag is the aggregator's metadata and Autobrennero publishes no terms of its own for the images, so they are credited to the operator as a courtesy and are not redistributed. Frames are fetched at request time and never stored. Disable with `CCTV_A22_ENABLED=0`. - **Camera frame content.** Public camera frames can contain people, vehicles and license plates, and the camera layer does nothing with them beyond putting them on the map. A successful upstream response is relayed as the provider served it: nothing in the camera pipeline blurs, redacts, enhances or restores it, and nothing there runs face, plate or object detection or otherwise recognises or classifies what is in the picture. (The ALPR layer described below maps where plate-reader cameras are, from locations contributors tagged in OpenStreetMap; it reads nothing from any camera frame.) When an upstream has no frame for a camera, what you see instead is a Google Street View still or the app's own placeholder card; the panel's source badge names which of them you are looking at, and a refresh that fails after a frame has arrived leaves the last good picture on screen rather than replacing it. The browser resamples each frame for display: onto a fixed 1920x1080 surface for the camera's projection plane in the scene, and onto a 192x108 canvas for the small ambient card. That scaling is the only change made to the picture, and the only pixels the camera layer reads back are a 64x36 downscale hashed to tell whether the picture has changed. Live streams are piped through; the still path reads the image into memory to pass it on — TxDOT wraps its JPEG in a JSON envelope, which is decoded there — and no frame is written to disk (the disk cache, `.gev-cache/`, holds feed JSON for other layers and never camera imagery). Outside that pipeline, the voice assistant is the one feature that sends imagery anywhere: when it answers a question about what is in view it may attach a downscaled screenshot of the rendered scene — including any camera plane on screen — to the request it sends to the voice model. Frames are fetched only from server-registered camera URLs — a client cannot hand the proxy a URL (see [SECURITY.md](SECURITY.md)). What the app does stays inside the line README draws: no named-person search, no face recognition, no tracking individuals. -- **Transit (GTFS-Realtime).** The proxy requests only registered operator feeds, validates redirects, bounds responses, and uses conditional requests, short snapshot caching and failure backoff. All sixteen registered regions are live-enabled; each can be disabled independently. Vehicles use delayed playback between reports, with report age and waiting states shown separately. Session-local selected trails are available for every feed. MBTA additionally retains up to 15 minutes of recently observed positions in the running proxy, so available history can survive a browser reload; server restart clears it. History reads never fetch upstream, and other feeds have no proxy retention. Nothing is archived to disk or collected in the background. Operator text credits are included as a courtesy and do not imply endorsement. Heights are aligned to work with Google 3D tiles; subway markers are shown at street level because these feeds do not supply depth. The TTC feed is BusTime, the surface system: it carries buses and streetcars and no subway at all. About four in ten of its vehicles report no route at all (unassigned or deadheading), and those are shown with the feed default rather than a route-established mode. It sends no ETag or Last-Modified, so its conditional requests fall through to the ordinary snapshot cache. Three Golden Horseshoe neighbours run alongside it — MiWay, Hamilton HSR and Durham Region Transit — each bus-only and each polled only near its own region. Durham Region Transit publishes no bearing on any vehicle, so those sprites take their heading from observed movement like any other feed that omits it. Guelph, Kingston and Barrie extend the same pattern eastward and north. Hamilton, Guelph, Burlington and YRT publish route ids that are not the number on the vehicle, so those entries carry a route-name table taken from each operator’s own published GTFS; any id missing from a table renders unchanged rather than blank. A label is never invented: YRT runs a route `9101` that appears nowhere in its published routes, so it stays as the feed sends it. Burlington’s is the one that cannot be shortcut: `351` is route 1 while `3510` is route 10, so the table is a real join rather than a trimmed prefix. GO Transit / Metrolinx is deliberately absent: its REALTIME feed requires an API key issued by manual review, which the keyless admission rule excludes (its static schedule download is keyless, but carries no vehicle positions). Barrie and YRT/Viva each invite acceptance of their licence through a form, and each licence also states that using the data is itself acceptance; this deployment relies on that clause, which is recorded in both entries. Grand River Transit in Waterloo is absent for a different reason: it answers, but its feed header was months stale and it publishes no per-vehicle timestamps, so it would render vehicles that look live and are not. Ottawa’s OC Transpo falls to the same keyless admission rule as GO Transit — its realtime feed requires an API key. London Transit and Thunder Bay Transit publish vehicle positions over plain HTTP with no HTTPS endpoint available. Every other Ontario system — Brampton, Oakville, Niagara, Milton, Windsor, Greater Sudbury, UP Express and a dozen smaller operators — publishes static GTFS schedules only, with no realtime vehicle positions to register. Between the nine included and these exclusions, every Ontario realtime vehicle-position feed catalogued in the Mobility Database is accounted for. +- **Transit (GTFS-Realtime).** The proxy requests only registered operator feeds, validates redirects, bounds responses, and uses conditional requests, short snapshot caching and failure backoff. All eighteen registered regions are live-enabled; each can be disabled independently. The Australian feeds (TransLink South East Queensland and Cairns, Adelaide Metro) are keyless and published under CC BY 4.0; the passage each rests on is quoted in `terms` in `src/data/transitFeeds.js`. Vehicles use delayed playback between reports, with report age and waiting states shown separately. Session-local selected trails are available for every feed. MBTA additionally retains up to 15 minutes of recently observed positions in the running proxy, so available history can survive a browser reload; server restart clears it. History reads never fetch upstream, and other feeds have no proxy retention. Nothing is archived to disk or collected in the background. Operator text credits are included as a courtesy and do not imply endorsement. Heights are aligned to work with Google 3D tiles; subway markers are shown at street level because these feeds do not supply depth. The TTC feed is BusTime, the surface system: it carries buses and streetcars and no subway at all. About four in ten of its vehicles report no route at all (unassigned or deadheading), and those are shown with the feed default rather than a route-established mode. It sends no ETag or Last-Modified, so its conditional requests fall through to the ordinary snapshot cache. Three Golden Horseshoe neighbours run alongside it — MiWay, Hamilton HSR and Durham Region Transit — each bus-only and each polled only near its own region. Durham Region Transit publishes no bearing on any vehicle, so those sprites take their heading from observed movement like any other feed that omits it. Guelph, Kingston and Barrie extend the same pattern eastward and north. Hamilton, Guelph, Burlington and YRT publish route ids that are not the number on the vehicle, so those entries carry a route-name table taken from each operator’s own published GTFS; any id missing from a table renders unchanged rather than blank. A label is never invented: YRT runs a route `9101` that appears nowhere in its published routes, so it stays as the feed sends it. Burlington’s is the one that cannot be shortcut: `351` is route 1 while `3510` is route 10, so the table is a real join rather than a trimmed prefix. GO Transit / Metrolinx is deliberately absent: its REALTIME feed requires an API key issued by manual review, which the keyless admission rule excludes (its static schedule download is keyless, but carries no vehicle positions). Barrie and YRT/Viva each invite acceptance of their licence through a form, and each licence also states that using the data is itself acceptance; this deployment relies on that clause, which is recorded in both entries. Grand River Transit in Waterloo is absent for a different reason: it answers, but its feed header was months stale and it publishes no per-vehicle timestamps, so it would render vehicles that look live and are not. Ottawa’s OC Transpo falls to the same keyless admission rule as GO Transit — its realtime feed requires an API key. London Transit and Thunder Bay Transit publish vehicle positions over plain HTTP with no HTTPS endpoint available. Every other Ontario system — Brampton, Oakville, Niagara, Milton, Windsor, Greater Sudbury, UP Express and a dozen smaller operators — publishes static GTFS schedules only, with no realtime vehicle positions to register. Between the nine included and these exclusions, every Ontario realtime vehicle-position feed catalogued in the Mobility Database is accounted for. - **Radio Browser.** `/api/radio/stations` discovers official API mirrors, makes bounded and coalesced healthy/geolocated HTTPS-station queries, caches the normalized public-domain directory for 45 minutes, and may serve the last good catalog for up to seven days during an outage. Refreshes must meet minimum accepted-query and station coverage before replacing a warm catalog; schema-valid responses whose rows all fail the product's health policy do not count as successful queries. A usable partial cold catalog is explicitly `DEGRADED`, and non-array or empty successful payloads are rejected atomically. Individual structurally malformed rows are skipped rather than failing the whole query; the response carries their bounded `rejectedStationCount` (at most 10,000), which the client adds to its own rejected rows and reports as degraded coverage without discarding the accepted generation. Every directory and click-count request rejects redirects, validates all resolved addresses as globally routable (including reserved/documentation IPv4 and special/non-global IPv6 exclusions), and pins the TLS connection to a validated address. Only MP3/AAC non-HLS directory rows with public HTTPS stream targets are returned; favicons are intentionally omitted. Pressing play connects one browser audio element directly to the selected broadcaster and calls the directory's click counter through known-ID-only `POST /api/radio/click/:uuid`. GEV never proxies, caches, records, bundles, or redistributes audio. Radio Browser supplies station-level tags, not dependable current-song or upcoming-program metadata, so Radio filtering never claims either. Direct playback exposes the listener's IP address to the broadcaster, whose own stream terms apply. - **TomTom Traffic.** Optional and BYOK: without `TOMTOM_API_KEY` the traffic layer runs its built-in simulation and no TomTom data (or attribution) appears. With a key, flow vector tiles are fetched through the server-side `/api/tomtom` proxy (120 s cache + a daily tile-budget governor — `TOMTOM_DAILY_TILE_BUDGET`, default 6,000 — sized so a 31-day month stays inside TomTom's 200K monthly free allowance; still a configurable application safety ceiling, not a guarantee; TomTom's [current pricing](https://docs.tomtom.com/pricing/) lists 200K free tile requests per month) and the "Traffic flow data © TomTom" credit is registered in the Data attribution popover the moment live mode activates. TomTom data is served live and cached only transiently (≤120 s TTL under `.gev-cache/`, gitignored) — it is not bundled or redistributed. One 23 KB point-in-time tile snapshot is committed as a decode-test fixture (`src/data/fixtures/`, © TomTom, never served to the app). - **Routing (OSRM / FOSSGIS).** `/api/route` proxies the public OSRM instances FOSSGIS e.V. runs for the OpenStreetMap community (car, bike, foot profiles). They are keyless and intended for fair, interactive use — the proxy rate-limits clients (60/min, 200/min total), caps route span and response size, caches each route for 10 minutes, and identifies itself in the User-Agent. Heavy or automated use must run its own OSRM. Routes are computed from OpenStreetMap data (ODbL); the Directions layer and voice routes never redistribute them. A route the router cannot find is reported as such; the Directions layer draws nothing in that case, and voice routes fall back to a clearly labeled straight line. diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 2d1593a0e7..bcc35dd31f 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -766,6 +766,7 @@ "server/providers/transitHistory.test.mjs", "src/data/transitFeeds.js", "src/data/transitFeeds.test.mjs", + "src/data/transitFeedsAustralia.test.mjs", "src/data/transitProxy.js", "src/data/transitProxy.test.mjs", "src/data/gtfsRealtime.js", diff --git a/src/data/transitFeeds.js b/src/data/transitFeeds.js index b8476a6ee8..bcbf213e5c 100644 --- a/src/data/transitFeeds.js +++ b/src/data/transitFeeds.js @@ -376,6 +376,54 @@ function burlingtonRouteLabel(routeId) { return BURLINGTON_ROUTE_NAMES[routeId] || routeId; } +/** + * TransLink (Queensland) route ids are `-`. Rail lines are two + * two-letter station codes (`BRBN`, `SHCL`), ferries are `F` plus the + * Southern Moreton Bay Islands service `SMBI`, and the Gold Coast light rail + * is `L1`. `SHUT` is the rail-replacement bus. Everything else is a bus, left + * to the feed default so movement plausibility treats it as a guess. + * @param {string|null} routeId + * @returns {string} + */ +function translinkRouteMode(routeId) { + if (!routeId) return 'unknown'; + const route = routeId.replace(/-\d+$/, ''); + if (/^F\d+$/.test(route) || route === 'SMBI') return 'ferry'; + if (route === 'L1') return 'tram'; + if (/^[A-Z]{4}$/.test(route) && route !== 'SHUT') return 'rail'; + return 'unknown'; +} + +/** Adelaide Metro train and tram route ids, from its static routes.txt. */ +const ADELAIDE_RAIL_ROUTES = new Set([ + 'BEL', + 'FLNDRS', + 'GAW', + 'GAWC', + 'GRNG', + 'NOAR', + 'OSBORN', + 'OUTHA', + 'PTDOCK', + 'SALIS', + 'SEAFRD', +]); +const ADELAIDE_TRAM_ROUTES = new Set(['BTANIC', 'FESTVL', 'GLNELG']); + +/** + * Adelaide Metro route ids are the line codes; all-letter bus routes exist + * (`INDSTA`), so trains and trams are listed rather than pattern-matched. + * @param {string|null} routeId + * @returns {string} + */ +function adelaideMetroRouteMode(routeId) { + if (!routeId) return 'unknown'; + if (ADELAIDE_RAIL_ROUTES.has(routeId)) return 'rail'; + if (ADELAIDE_TRAM_ROUTES.has(routeId)) return 'tram'; + if (routeId === 'SEALNK') return 'ferry'; + return 'unknown'; +} + /** * Registry of feeds. Order is presentation order in the stats/credit text. * `loadRadiusKm` is the distance from `center` inside which the feed is polled. @@ -522,7 +570,7 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([ url: 'https://gtfsrt.api.translink.com.au/api/realtime/seq/VehiclePositions', license: 'CC BY 4.0', licenseUrl: 'https://translink.com.au/about-translink/open-data', - attribution: 'TransLink — Queensland Government (CC BY 4.0)', + attribution: 'Translink, Department of Transport and Main Roads', defaultEnabled: true, terms: Object.freeze({ quote: @@ -530,6 +578,53 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([ note: 'No key, no stated rate limit, no caching rule. Logos and network imagery need separate approval, so the credit is text only.', }), defaultMode: 'bus', + routeMode: translinkRouteMode, + }), + Object.freeze({ + id: 'translink-cairns', + name: 'TransLink', + operator: 'TransLink (Queensland Government)', + region: 'Cairns, Australia', + center: Object.freeze({ lat: -16.9186, lon: 145.7781 }), + loadRadiusKm: 60, + url: 'https://gtfsrt.api.translink.com.au/api/realtime/CNS/VehiclePositions', + license: 'CC BY 4.0', + licenseUrl: 'https://translink.com.au/about-translink/open-data', + attribution: 'Translink, Department of Transport and Main Roads', + defaultEnabled: true, + terms: Object.freeze({ + quote: + 'Our data is licensed under a Creative Commons Attribution 4.0 International License. Authentication is not required to use the feed.', + note: 'The same open-data page lists Cairns (CNS) vehicle positions beside South East Queensland; same terms, text-only credit.', + }), + defaultMode: 'bus', + routeMode: translinkRouteMode, + }), + Object.freeze({ + id: 'adelaide-metro', + name: 'Adelaide Metro', + operator: + 'Adelaide Metro (Department for Infrastructure and Transport, South Australia)', + region: 'Adelaide, Australia', + center: Object.freeze({ lat: -34.9285, lon: 138.6007 }), + loadRadiusKm: 80, + url: 'https://gtfs.adelaidemetro.com.au/v1/realtime/vehicle_positions', + // The gateway negotiates on Accept: the proxy's default list gets + // application/json carrying base64 protobuf; its own type gets raw bytes. + headers: Object.freeze({ Accept: 'application/x-google-protobuf' }), + license: 'CC BY 4.0', + licenseUrl: + 'https://data.sa.gov.au/data/dataset/adelaide-metro-real-time-passenger-information', + attribution: + 'Adelaide Metro – Department for Infrastructure and Transport, South Australia', + defaultEnabled: true, + terms: Object.freeze({ + quote: + 'Adelaide Metro provides Real-Time information in SIRI and GTFS-R format', + note: 'Quoted from the data.sa.gov.au catalogue entry "Adelaide Metro Real-Time Passenger Information", published by the Department for Infrastructure and Transport under Creative Commons Attribution 4.0. The feed needs no key (its API description declares no security scheme) and is marked BETA, subject to change. adelaidemetro.com.au refuses automated readers (HTTP 403).', + }), + defaultMode: 'bus', + routeMode: adelaideMetroRouteMode, }), Object.freeze({ id: 'ttc-toronto', diff --git a/src/data/transitFeedsAustralia.test.mjs b/src/data/transitFeedsAustralia.test.mjs new file mode 100644 index 0000000000..decf32baca --- /dev/null +++ b/src/data/transitFeedsAustralia.test.mjs @@ -0,0 +1,139 @@ +import { readFileSync } from 'node:fs'; +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { transitFeedCredit } from './dataCredits.js'; +import { transitUpstreamHeaders } from './transitProxy.js'; +import { + getTransitFeed, + publicTransitCatalog, + transitFeedsInRange, + transitModeFor, + transitModeResolved, +} from './transitFeeds.js'; + +// Route ids below are as published in the live feeds and the operators' +// static routes.txt (checked 16 Oct 2026). + +test('Australian feeds are keyless, routable and cover their own city only', () => { + const seq = getTransitFeed('translink-seq'); + const cairns = getTransitFeed('translink-cairns'); + const adelaide = getTransitFeed('adelaide-metro'); + assert.equal( + cairns.url, + 'https://gtfsrt.api.translink.com.au/api/realtime/CNS/VehiclePositions', + ); + assert.equal( + adelaide.url, + 'https://gtfs.adelaidemetro.com.au/v1/realtime/vehicle_positions', + ); + for (const feed of [seq, cairns]) { + assert.equal(feed.headers, undefined, `${feed.id} needs no extra header`); + } + for (const feed of [seq, cairns, adelaide]) { + assert.equal(feed.license, 'CC BY 4.0'); + } + const ids = (lat, lon) => transitFeedsInRange(lat, lon).map((f) => f.id); + assert.deepEqual(ids(-27.4698, 153.0251), ['translink-seq']); + assert.deepEqual(ids(-16.9186, 145.7781), ['translink-cairns']); + assert.deepEqual(ids(-34.9285, 138.6007), ['adelaide-metro']); + assert.deepEqual(ids(-37.8136, 144.9631), [], 'Melbourne has no feed'); +}); + +test('Adelaide is asked for its own protobuf type, or its gateway answers base64 JSON', () => { + // Offered the default Accept list (application/x-protobuf, ..., */*), the + // Adelaide Metro gateway replies application/json carrying the protobuf as + // base64, which the decoder rejects. Its own media type gets raw protobuf. + const adelaide = getTransitFeed('adelaide-metro'); + assert.deepEqual(Object.keys(adelaide.headers), ['Accept']); + const headers = transitUpstreamHeaders(adelaide); + assert.equal(headers.Accept, 'application/x-google-protobuf'); + assert.equal(headers['Accept-Encoding'], 'gzip'); + assert.match(headers['User-Agent'], /gods-eye-view/); +}); + +test('TransLink route ids resolve rail, light rail and ferries; buses stay a default', () => { + const seq = getTransitFeed('translink-seq'); + const cases = [ + ['BRBN-5187', 'rail'], + ['SHCL-5187', 'rail'], + ['RPIP-5201', 'rail'], + ['L1-5029', 'tram'], + ['F1-4055', 'ferry'], + ['F23-4055', 'ferry'], + ['F50-4430', 'ferry'], + ['SMBI-3779', 'ferry'], + ]; + for (const [routeId, mode] of cases) { + assert.equal(transitModeFor(seq, routeId), mode, routeId); + assert.equal(transitModeResolved(seq, routeId), true, routeId); + } + // Buses, Brisbane Metro and the rail-replacement shuttle are buses by the + // feed default, so movement plausibility does not treat them as known. + for (const routeId of ['600', '250-5169', 'M1-4949', 'SHUT-5213', null]) { + assert.equal(transitModeFor(seq, routeId), 'bus', String(routeId)); + assert.equal(transitModeResolved(seq, routeId), false, String(routeId)); + } + const cairns = getTransitFeed('translink-cairns'); + assert.equal(transitModeFor(cairns, 'C111-5061'), 'bus'); + assert.equal(transitModeResolved(cairns, 'C111-5061'), false); +}); + +test('Adelaide Metro route ids resolve trains, trams and the SeaLink ferry', () => { + const adelaide = getTransitFeed('adelaide-metro'); + const cases = [ + ['BEL', 'rail'], + ['GAWC', 'rail'], + ['OUTHA', 'rail'], + ['SEAFRD', 'rail'], + ['PTDOCK', 'rail'], + ['BTANIC', 'tram'], + ['GLNELG', 'tram'], + ['FESTVL', 'tram'], + ['SEALNK', 'ferry'], + ]; + for (const [routeId, mode] of cases) { + assert.equal(transitModeFor(adelaide, routeId), mode, routeId); + assert.equal(transitModeResolved(adelaide, routeId), true, routeId); + } + // All-letter bus routes exist (INDSTA/INDSTB), so letters alone are not rail. + for (const routeId of ['100', 'G10', 'H33C', 'INDSTA', 'T721', null]) { + assert.equal(transitModeFor(adelaide, routeId), 'bus', String(routeId)); + assert.equal( + transitModeResolved(adelaide, routeId), + false, + String(routeId), + ); + } +}); + +test('Australian feeds credit the operator and department as text', () => { + const credit = (id) => + transitFeedCredit(publicTransitCatalog().find((feed) => feed.id === id)) + .html; + for (const id of ['translink-seq', 'translink-cairns']) { + assert.match( + credit(id), + /^Transit \(Translink, Department of Transport and Main Roads\): ]*>CC BY 4\.0<\/a>$/, + ); + } + assert.match( + credit('adelaide-metro'), + /^Transit \(Adelaide Metro – Department for Infrastructure and Transport, South Australia\): ]*>CC BY 4\.0<\/a>$/, + ); +}); + +test('DATA_SOURCES documents the Australian feeds in the transit row style', () => { + const rows = readFileSync( + new URL('../../DATA_SOURCES.md', import.meta.url), + 'utf8', + ).split('\n'); + const translink = rows.find((line) => line.startsWith('| **TransLink**')); + assert.match(translink, /South East Queensland and Cairns/); + const adelaide = rows.find((line) => line.startsWith('| **Adelaide Metro**')); + assert.ok(adelaide, 'Adelaide Metro row exists'); + for (const row of [translink, adelaide]) { + assert.match(row, /open realtime vehicle data/); + assert.match(row, /published for developer use and not against their use/); + assert.doesNotMatch(row, /licen[cs]e|CC BY|terms/i); + } +}); From 55cca5f8de688d5d1e2aa427ac41322d685a6ef7 Mon Sep 17 00:00:00 2001 From: Renzo Will Date: Fri, 16 Oct 2026 06:29:41 +1000 Subject: [PATCH 2/6] docs: record the Australian transit feeds in CURRENT-STATE and CHANGELOG Co-Authored-By: Claude Opus 5.5 (1M context) --- docs/CURRENT-STATE.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 7668235500..95f0fa518f 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -3927,7 +3927,7 @@ its criteria cannot be silently ignored. | Traffic | Selectable TomTom / OpenStreetMap / Hybrid roads; optional TomTom flow (BYOK) | `src/data/traffic.js` | browser-direct OpenFreeMap tiles; `/api/tomtom` for flow | viewport-driven; capped tile cache | | CCTV | Austin + Caltrans (CA) + TfL London + Ontario 511 + Fintraffic (FI) + DriveBC (BC) + TxDOT (TX) + Estonia (Tallinn, Tarktee) + Live Traffic NSW + Open Calgary Open Data + Statens vegvesen (NO, stills + live HLS, Kartverket ground heights) + King County (WA) Open Data + WSDOT (WA) Open Data + NYC DOT TMC (opt-in) + City of Toronto RESCU + Catalonia (Servei Català de Trànsit) + Hong Kong Transport Department + FL511 (FL, opt-in) + Freeway Bureau, MOTC (Taiwan) + Autostrada del Brennero (IT, A22 stills) + Street View fallback | `src/data/cctv.js` | `/api/cctv` | 10s (active) | | Radio | Radio Browser (public-domain station directory) | `src/data/radio.js` | `/api/radio/stations`, `/api/radio/click/:uuid` | 45 min directory refresh | -| Transit 🚌 | Operator GTFS-Realtime VehiclePositions (7 keyless regions, `src/data/transitFeeds.js`) | `src/layers/transit/` via `src/app/layers/transit.js` | `/api/transit` | 15s (poll + delayed playback) | +| Transit 🚌 | Operator GTFS-Realtime VehiclePositions (18 keyless regions, `src/data/transitFeeds.js`) | `src/layers/transit/` via `src/app/layers/transit.js` | `/api/transit` | 15s (poll + delayed playback) | | Bikeshare 🚲 | GBFS (Lyft + BCycle + Social Bicycles + PBSC incl. Bike Share Toronto, Bike Itaú (Brazil), Bicing (Barcelona) and seven other Spanish cities + Urban Sharing, Entur, JCDecaux (Lillestrøm, Valencia, Seville) + nextbike (AMBici)) | `src/data/bikeshare.js` | `/api/gbfs` | 60s | | Directions 🧭 | OSRM on FOSSGIS servers (OpenStreetMap) | `src/data/directions.js` | `/api/route` (`steps=1`) | on placement / mode change | | Datacenters ▣ | OSM extract (bundled) | `src/data/infrastructure.js` | — | static | @@ -4357,12 +4357,15 @@ Transit is off by default, and share links use token `j`. The movement panel ord places Transit directly after Street Traffic and before Bike Share. Cameras and utilities retain their own groups. The layer polls registered feeds near the camera every 15 seconds, below a 3,000 km altitude -gate. Sixteen keyless regions are available: Boston, Austin, Minneapolis–St Paul, -Helsinki, the Netherlands, Norway, South East Queensland, and nine in +gate. Eighteen keyless regions are available: Boston, Austin, Minneapolis–St Paul, +Helsinki, the Netherlands, Norway, South East Queensland, Cairns, Adelaide, and nine in Ontario — Toronto (TTC surface vehicles; the subway publishes no positions), MiWay, Hamilton HSR, Durham Region, YRT/Viva, Guelph, Burlington, Barrie and Kingston. Mode silhouettes identify buses, trams, subways, trains, ferries and unclassified vehicles. +TransLink route ids resolve rail, Gold Coast light rail and ferries; Adelaide +Metro route ids resolve trains, trams and the SeaLink ferry. Other routes in +those feeds keep the feed's bus default. Retained transit history uses the same outlier quarantine as live observations and preserves the active live bracket. Rejected reports do not publish route or mode From ce4c086076fe75243dcbf267024fbc5997c41312 Mon Sep 17 00:00:00 2001 From: Renzo Will Date: Sat, 17 Oct 2026 07:13:39 +1000 Subject: [PATCH 3/6] docs: move the changelog entry into changelog.d per the new fragment rule Co-Authored-By: Claude Opus 5.5 (1M context) --- changelog.d/1169-australian-transit.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changelog.d/1169-australian-transit.md diff --git a/changelog.d/1169-australian-transit.md b/changelog.d/1169-australian-transit.md new file mode 100644 index 0000000000..1d6a836f0a --- /dev/null +++ b/changelog.d/1169-australian-transit.md @@ -0,0 +1,8 @@ +- Transit adds two keyless Australian GTFS-Realtime feeds: TransLink Cairns + and Adelaide Metro (marked BETA by its operator), both CC BY 4.0 with text + credits. TransLink vehicles now show trains, Gold Coast light rail and + ferries by route id instead of all appearing as buses; Adelaide Metro trains, + trams and the SeaLink ferry are identified the same way. Adelaide's gateway + returns base64 protobuf inside JSON unless asked for + `application/x-google-protobuf`, so that feed sends its own Accept header + (willrenzo39, #1169). From 4c58c72d454eafc37cb869f42d171de4333b293f Mon Sep 17 00:00:00 2001 From: Renzo Will Date: Sun, 1 Nov 2026 20:12:50 +1000 Subject: [PATCH 4/6] docs(readme): list Cairns and Adelaide in the Transit row Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac135360fd..0018c4e7ef 100644 --- a/README.md +++ b/README.md @@ -403,7 +403,7 @@ Twenty layers and map sources. **Eighteen have a keyless path.** Some offer addi | 📷 **Mapped ALPR Cameras** | License-plate-reader camera locations tagged by OpenStreetMap contributors, loaded one city-sized view at a time, with **SHOW NEAREST**. Locations and tags only: no plate data, no video | OpenStreetMap (incl. DeFlock mapping) | 🟢 | | 📷 **Street Level** | Street-level photos behind one panel, one chip per provider: coverage on the streets, image cones, an embedded viewer with full-screen **EXPAND**. Mapillary, Google Street View, KartaView and Panoramax | Mapillary · Google · KartaView · Panoramax | 🟢 KartaView, Panoramax · 🟡 Mapillary token · 🔴 Google Maps key | | 📻 **Radio** | Geolocated world radio with an **analog tuner** — drag the needle across up to 750 stations and the globe flies to each broadcaster | Radio Browser / broadcasters | 🟢 | -| 🚌 **Transit** | Live buses, trams, metros, trains and ferries with delayed playback between reports, selected-vehicle trails, and mode-coloured DETECT labels — Boston, Austin, Minneapolis, Helsinki, the Netherlands, Norway, South East Queensland, and nine in Ontario: Toronto (surface vehicles; the subway publishes no positions), Mississauga, Hamilton, Durham Region, York Region, Guelph, Burlington, Barrie and Kingston | Operator GTFS-Realtime feeds | 🟢 | +| 🚌 **Transit** | Live buses, trams, metros, trains and ferries with delayed playback between reports, selected-vehicle trails, and mode-coloured DETECT labels — Boston, Austin, Minneapolis, Helsinki, the Netherlands, Norway, South East Queensland, Cairns, Adelaide, and nine in Ontario: Toronto (surface vehicles; the subway publishes no positions), Mississauga, Hamilton, Durham Region, York Region, Guelph, Burlington, Barrie and Kingston | Operator GTFS-Realtime feeds | 🟢 | | 🚲 **Bikeshare** | Live station availability | GBFS | 🟢 | | 🧭 **Directions** | Click A and B on the globe for a street-following drive, walk or cycle route draped on the terrain with turn-by-turn steps — then FLY the camera along it. No key, no geocoder, no mic | OSRM on FOSSGIS servers (OpenStreetMap) | 🟢 | | 🔥 **Active Fires** | Live NASA FIRMS detections, trailing 24h | NASA FIRMS | 🟡 | From 02f0063ccac2ccdd52b4a2ec6ab879a629e0d418 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 02:11:42 +0400 Subject: [PATCH 5/6] Tighten the TransLink and Adelaide Metro docs, comments and release note --- DATA_SOURCES.md | 2 +- changelog.d/1169-australian-transit.md | 12 +++++------- docs/CURRENT-STATE.md | 13 ++++++------- src/data/transitFeeds.js | 16 +++++++--------- src/data/transitFeeds.test.mjs | 3 +-- src/data/transitFeedsAustralia.test.mjs | 6 ++---- 6 files changed, 22 insertions(+), 30 deletions(-) diff --git a/DATA_SOURCES.md b/DATA_SOURCES.md index 35da90ae36..8049a412bc 100644 --- a/DATA_SOURCES.md +++ b/DATA_SOURCES.md @@ -272,7 +272,7 @@ The optional Local ADS-B layer and the broadcast-FM receiver use radio you recei - **Houston TranStar cameras.** Keyless. The camera list is the public `traffic.houstontranstar.org/data/layers/cctvSnapshots_json.js` catalog (~1,000 cameras across Greater Houston); frames are stills at `www.houstontranstar.org/snapshots/cctv/.jpg`, synthesized from a validated numeric id rather than taken from the payload, and only that host is registered. Cameras whose catalog id is `0` (a different, non-snapshot class) and cameras outside Greater Houston are dropped. TranStar's `dir` field is the side of the freeway the camera sits on, not the way it faces: TranStar's own map shows it as "Traffic closest to the camera is traveling …" (South → eastbound, North → westbound, West → southbound, East → northbound). That travel direction (90°, 270°, 180°, 0°) seeds the heading as a low-confidence prior with the low-confidence pose; `None` or an unknown value uses the shared id-hash fallback at low confidence. Headings are corrected with the in-app calibration gizmo. Off by default. TranStar's [Content Usage terms](https://traffic.houstontranstar.org/disclaimer.aspx) prohibit copying or distributing the site's information, and external framing or linking to specific images, without TxDOT's prior written permission; its FAQ grants permission-free use only for the RSS feeds. This project does not hold that permission for downstream installations, so the pack loads only when an operator who holds TxDOT's written permission sets `CCTV_HOUSTON_ENABLED=1`; with the flag unset, empty or any other value, the server makes no request to TranStar. Once enabled, it loads the 250 cameras nearest downtown, Uptown, the Medical Center, IAH and Galveston; `CCTV_HOUSTON_MAX_SOURCES` (8–400) changes the cap. Snapshots update about every 3 minutes, which is also the ambient still cadence. Frames are fetched from TranStar and relayed to the browser on demand, buffered only transiently per request, sent with `Cache-Control: no-store`, and not archived. - **Autostrada del Brennero (A22) webcams.** Keyless. The camera list is one request to the Open Data Hub tourism API (`tourism.api.opendatahub.com/v1/WebcamInfo?source=a22`), run by NOI Techpark in South Tyrol, which republishes Autobrennero's own list of 13 motorway webcams with coordinates and kilometre markers. Frames are the operator's stills on `www.autobrennero.it/WebCamImg/km.jpg`, refreshed about once a minute, and only the exact image for each camera's kilometre is registered. The feed names no bearing, so headings use the id-hash fallback at low confidence. The road climbs from about 20 m in the Po valley to about 1,370 m at the Brenner Pass, so each camera's ground elevation comes from a per-kilometre table sampled from the Copernicus GLO-90 DEM (via Open-Meteo's elevation API); a camera not in the table uses a 200 m prior. The Open Data Hub tags every record CC0 (`ClosedData: false`, Autobrennero as licence holder), but that tag is the aggregator's metadata and Autobrennero publishes no terms of its own for the images, so they are credited to the operator as a courtesy and are not redistributed. Frames are fetched at request time and never stored. Disable with `CCTV_A22_ENABLED=0`. - **Camera frame content.** Public camera frames can contain people, vehicles and license plates, and the camera layer does nothing with them beyond putting them on the map. A successful upstream response is relayed as the provider served it: nothing in the camera pipeline blurs, redacts, enhances or restores it, and nothing there runs face, plate or object detection or otherwise recognises or classifies what is in the picture. (The ALPR layer described below maps where plate-reader cameras are, from locations contributors tagged in OpenStreetMap; it reads nothing from any camera frame.) When an upstream has no frame for a camera, what you see instead is a Google Street View still or the app's own placeholder card; the panel's source badge names which of them you are looking at, and a refresh that fails after a frame has arrived leaves the last good picture on screen rather than replacing it. The browser resamples each frame for display: onto a fixed 1920x1080 surface for the camera's projection plane in the scene, and onto a 192x108 canvas for the small ambient card. That scaling is the only change made to the picture, and the only pixels the camera layer reads back are a 64x36 downscale hashed to tell whether the picture has changed. Live streams are piped through; the still path reads the image into memory to pass it on — TxDOT wraps its JPEG in a JSON envelope, which is decoded there — and no frame is written to disk (the disk cache, `.gev-cache/`, holds feed JSON for other layers and never camera imagery). Outside that pipeline, the voice assistant is the one feature that sends imagery anywhere: when it answers a question about what is in view it may attach a downscaled screenshot of the rendered scene — including any camera plane on screen — to the request it sends to the voice model. Frames are fetched only from server-registered camera URLs — a client cannot hand the proxy a URL (see [SECURITY.md](SECURITY.md)). What the app does stays inside the line README draws: no named-person search, no face recognition, no tracking individuals. -- **Transit (GTFS-Realtime).** The proxy requests only registered operator feeds, validates redirects, bounds responses, and uses conditional requests, short snapshot caching and failure backoff. All fifty-three registered feeds, covering fifty regions, are live-enabled; each can be disabled independently. The TransLink feeds (South East Queensland and Cairns) are keyless and published under CC BY 4.0; the passage they rest on is quoted in `terms` in `src/data/transitFeeds.js`. Vehicles use delayed playback between reports, with report age and waiting states shown separately. Session-local selected trails are available for every feed. MBTA additionally retains up to 15 minutes of recently observed positions in the running proxy, so available history can survive a browser reload; server restart clears it. History reads never fetch upstream, and other feeds have no proxy retention. Nothing is archived to disk or collected in the background. Operator text credits are included as a courtesy and do not imply endorsement. Heights are aligned to work with Google 3D tiles; subway markers are shown at street level because these feeds do not supply depth. The TTC feed is BusTime, the surface system: it carries buses and streetcars and no subway at all. About four in ten of its vehicles report no route at all (unassigned or deadheading), and those are shown with the feed default rather than a route-established mode. It sends no ETag or Last-Modified, so its conditional requests fall through to the ordinary snapshot cache. Three Golden Horseshoe neighbours run alongside it — MiWay, Hamilton HSR and Durham Region Transit — each bus-only and each polled only near its own region. Durham Region Transit publishes no bearing on any vehicle, so those sprites take their heading from observed movement like any other feed that omits it. Guelph, Kingston and Barrie extend the same pattern eastward and north. Hamilton, Guelph, Burlington, YRT and Rio’s SMTR publish route ids that are not the number on the vehicle, so those entries carry a route-name table taken from each operator’s own published GTFS; any id missing from a table renders unchanged rather than blank. A label is never invented: YRT runs a route `9101` that appears nowhere in its published routes, so it stays as the feed sends it. Burlington’s is the one that cannot be shortcut: `351` is route 1 while `3510` is route 10, so the table is a real join rather than a trimmed prefix. TransLink needs no table: its route keys carry a GTFS version suffix (`200-4`) and Cairns puts a `C` before its bus numbers (`C123-33`), so both are stripped by rule to the number on the vehicle. GO Transit / Metrolinx is deliberately absent: its REALTIME feed requires an API key issued by manual review, which the keyless admission rule excludes (its static schedule download is keyless, but carries no vehicle positions). Barrie and YRT/Viva each invite acceptance of their licence through a form, and each licence also states that using the data is itself acceptance; this deployment relies on that clause, which is recorded in both entries. Grand River Transit in Waterloo is absent for a different reason: it answers, but its feed header was months stale and it publishes no per-vehicle timestamps, so it would render vehicles that look live and are not. Ottawa’s OC Transpo falls to the same keyless admission rule as GO Transit — its realtime feed requires an API key. London Transit and Thunder Bay Transit publish vehicle positions over plain HTTP with no HTTPS endpoint available. Every other Ontario system — Brampton, Oakville, Niagara, Milton, Windsor, Greater Sudbury, UP Express and a dozen smaller operators — publishes static GTFS schedules only, with no realtime vehicle positions to register. Between the nine included and these exclusions, every Ontario realtime vehicle-position feed catalogued in the Mobility Database is accounted for. +- **Transit (GTFS-Realtime).** The proxy requests only registered operator feeds, validates redirects, bounds responses, and uses conditional requests, short snapshot caching and failure backoff. All fifty-three registered feeds, covering fifty regions, are live-enabled; each can be disabled independently. Vehicles use delayed playback between reports, with report age and waiting states shown separately. Session-local selected trails are available for every feed. MBTA additionally retains up to 15 minutes of recently observed positions in the running proxy, so available history can survive a browser reload; server restart clears it. History reads never fetch upstream, and other feeds have no proxy retention. Nothing is archived to disk or collected in the background. Operator text credits are included as a courtesy and do not imply endorsement. Heights are aligned to work with Google 3D tiles; subway markers are shown at street level because these feeds do not supply depth. The TTC feed is BusTime, the surface system: it carries buses and streetcars and no subway at all. About four in ten of its vehicles report no route at all (unassigned or deadheading), and those are shown with the feed default rather than a route-established mode. It sends no ETag or Last-Modified, so its conditional requests fall through to the ordinary snapshot cache. Three Golden Horseshoe neighbours run alongside it — MiWay, Hamilton HSR and Durham Region Transit — each bus-only and each polled only near its own region. Durham Region Transit publishes no bearing on any vehicle, so those sprites take their heading from observed movement like any other feed that omits it. Guelph, Kingston and Barrie extend the same pattern eastward and north. Hamilton, Guelph, Burlington, YRT and Rio’s SMTR publish route ids that are not the number on the vehicle, so those entries carry a route-name table taken from each operator’s own published GTFS; any id missing from a table renders unchanged rather than blank. A label is never invented: YRT runs a route `9101` that appears nowhere in its published routes, so it stays as the feed sends it. Burlington’s is the one that cannot be shortcut: `351` is route 1 while `3510` is route 10, so the table is a real join rather than a trimmed prefix. TransLink needs no table: its route keys carry a GTFS version suffix (`200-4`) and Cairns puts a `C` before its bus numbers (`C123-33`), so both are stripped by rule to the number on the vehicle. GO Transit / Metrolinx is deliberately absent: its REALTIME feed requires an API key issued by manual review, which the keyless admission rule excludes (its static schedule download is keyless, but carries no vehicle positions). Barrie and YRT/Viva each invite acceptance of their licence through a form, and each licence also states that using the data is itself acceptance; this deployment relies on that clause, which is recorded in both entries. Grand River Transit in Waterloo is absent for a different reason: it answers, but its feed header was months stale and it publishes no per-vehicle timestamps, so it would render vehicles that look live and are not. Ottawa’s OC Transpo falls to the same keyless admission rule as GO Transit — its realtime feed requires an API key. London Transit and Thunder Bay Transit publish vehicle positions over plain HTTP with no HTTPS endpoint available. Every other Ontario system — Brampton, Oakville, Niagara, Milton, Windsor, Greater Sudbury, UP Express and a dozen smaller operators — publishes static GTFS schedules only, with no realtime vehicle positions to register. Between the nine included and these exclusions, every Ontario realtime vehicle-position feed catalogued in the Mobility Database is accounted for. - **Rail (GTFS-Realtime trains).** Each feed in `src/data/railFeeds.js` records its licence, its credit and the passage of its terms the decision rests on, and a feed is switched on only when those terms were read and cover this use, or, for those that publish no licence at all, on the basis its entry records. Such a basis is never a licence, and the credit does not present it as one: its label says there is no licence ("No licence published", "No licence stated") or names the publication the use rests on. Five enabled feeds publish no licence for their train positions. MARC is used on what its publication says (open publication with a no-endorsement disclaimer), and METRO light rail on the same basis as the Transit layer's Metro Transit feed. Tri-Rail and Charlotte's LYNX are used without a published licence by project owner decision of 2026-11-10. The fifth is Irish Rail, whose train positions publish no licence while its NTA timetable is CC BY 4.0. The registry lists 30 feeds, all switched on, and every one is keyless: its realtime feed and its static timetable are published for anyone to fetch, so no feed needs a key, an account or a registration, and the server holds no rail credential. No rail request carries a credential of the deployer's; one feed's published URL includes a fixed public value its publisher prints for everyone (Bordeaux's `apiKey`). `/api/rail/feeds` lists the offered feeds, `/api/rail/trains/` returns one feed's train snapshot, `/api/rail/updates/` its trip updates, and `/api/rail/paths/` and `/api/rail/schedule/` its path and schedule packs, when built. The proxy requests only registered feeds and reuses the Transit proxy's request policy (a short snapshot cache with single-flight refresh, serve-stale, admission limits, the failure cooldown ladder, redirects followed hop by hop only on the feed's own https origin, and an 8 MiB body cap unless a feed sets its own, at most 64 MiB). Many operators publish trains in the same feed as their buses, so each feed has a classifier: the proxy keeps only vehicles it recognises as trains, tags each with a category (`transit`, `local`, `regional`, `national` or `international`) and a mode (`rail`, `metro` or `tram`), and drops everything else server-side, counted in the snapshot as `dropped`; the browser never receives a bus. Every train shown is live, where its operator last reported it: 29 feeds publish live GPS positions (SJ Nord's through SIRI VM), and Irish Rail reports the station or timing point a train last passed. No train is placed or moved from a timetable; a feed whose live positions fail shows as unavailable, and its trains age out as any quiet train does. 22 feeds register trip updates, polled while one of their trains is selected and that feed's schedule pack is loaded. 28 feeds work out of the box. Packs are an opt-in extra for live trains: nothing is downloaded when the app starts, and `node scripts/build-rail-paths.mjs --feed ` (repeatable) or `--all` downloads a feed's static GTFS (29 of the 30 have one) and writes a path pack (the operator's track shapes) and a schedule pack (the stop times for a window of days) to `.cache/rail-paths/` (or to `RAIL_PATHS_DIR` when set, the directory the server then serves). With them, a live train is drawn on its operator's route line and its card names its stops, its next stop and, from the trip updates, their delays. Renfe long and medium distance and KTMB, whose vehicles name no route, are classified from their pack's routes, so `/api/rail/feeds` lists them only once that pack is built. Lines are the operator's own shapes as published: nothing is routed or redrawn from other map data, and no line is drawn where an operator publishes no shape. **Share-alike sources bind the deployer.** A pack built from a ShareAlike or ODbL source is a derived database of it, so a deployer who serves it publicly makes it subject to the same licence and must offer it under that licence with the attribution kept. That covers the Montpellier packs (ODbL). For the ODbL datasets of France's national access point, its special conditions also require that "Les bases de données ainsi repartagées doivent être publiées sur le Point d'accès national transport.data.gouv.fr, dans le format d'origine" ([Licence ODbL](https://doc.transport.data.gouv.fr/le-point-d-acces-national/cadre-juridique/conditions-dutilisation-des-donnees/licence-odbl), read 2026-11-10): a deployer who serves the Montpellier packs publicly takes on republishing that derived data there, as GTFS. The build downloads each static GTFS itself, over https and with no credential. A feed's `staticRouteTypes` lists the route types it keeps when its classifier accepts every route of a mode-specific feed. A frequency-based trip becomes one run per departure on its template's stops and run times. Packs are build output, not part of the repository, and cover a fixed window of days, so they are rebuilt before it ends, and more often where an operator republishes more often. A build in which any feed fails exits with code 2, the other feeds still built. A stop the GTFS gives no coordinates, which some feeds write as (0, 0), is left out of the run, so no line is ever drawn to it and no stop is placed by guesswork. Where several loaded feeds carry the same train, it is drawn once. Copies are matched by train number within 100 km, or, for a short line name (S1, RB 1, U6), on the same line in the same category within 15 km. A train number is three or more digits, or a shorter number after a long-distance product (EC, ECE, EN, ICE, NJ, RJ, RJX, TGV; not IC, where a short number names a line); a trip id that is an operator prefix and a number, or a headsign that is a bare number, is read too. The copy drawn is scored by its position source (live GPS, then station reports), then by its line (on its operator's shape, then without one), and stays drawn until another scores strictly higher. No train is ever placed in Ukraine, a safety rule: the build leaves out every run with a stop there, a stop whose id names Ukraine or whose position is inside its recognised borders (either is enough: an id naming another country does not keep a stop inside them), and the proxy drops every live position inside those borders (`src/data/railNoPositions.js`). Trains use the Transit layer's delayed playback between reports and move along their line in the path pack where there is one, else in straight lines. No train position is archived to disk, there is no proxy history, and nothing is collected in the background. Operator credits appear when that feed's trains are shown and do not imply endorsement. - **Radio country coverage (optional).** Set `RADIO_PRIORITY_COUNTRIES=IN,PL` in the local `.env` and restart to include stations beyond the global click charts. The operator may choose up to eight unique ISO alpha-2 country codes; no key is needed. Each country adds one bounded query (at most 200 rows) and reserves up to 40 unique, usable stations inside the existing 750-station catalog. Country seeds precede specialist-tag seeds and global popularity fill; unused slots return to the shared pool. This is a coverage preference, not an exhaustive national directory or a guarantee of stations in every city. Countries with no eligible HTTPS MP3/AAC geolocated stations remain empty. An unset list preserves global selection. Country requests share the directory cache and three-worker pool; failed country queries are reported in coverage without blocking a healthy global refresh. Failed/degraded refreshes back off for one minute, with at most three mirrors per query. diff --git a/changelog.d/1169-australian-transit.md b/changelog.d/1169-australian-transit.md index 54d5b02665..d86ef03a1a 100644 --- a/changelog.d/1169-australian-transit.md +++ b/changelog.d/1169-australian-transit.md @@ -1,7 +1,5 @@ -- Transit adds TransLink Cairns, a keyless Australian GTFS-Realtime feed - under CC BY 4.0 with a text credit. TransLink vehicles now show trains, - Gold Coast light rail and ferries by route id instead of all appearing as - buses, and the existing Adelaide Metro feed identifies its trains, trams and - the SeaLink ferry the same way. TransLink route labels drop the GTFS version - suffix, and Cairns drops its `C` prefix, so a bus reads "Route 123" rather - than "Route C123-33" (willrenzo39, #1169). +- Transit adds TransLink Cairns, a keyless feed under CC BY 4.0. TransLink + trains, Gold Coast light rail and ferries, and Adelaide Metro trains, trams + and the SeaLink ferry, now show as their own modes instead of buses. + TransLink route labels drop the GTFS version and Cairns's `C` prefix, so a + bus reads "Route 123", not "Route C123-33" (willrenzo39, #1169). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index fb51f0225a..2990dc9d29 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -6438,14 +6438,13 @@ a record from the bundled proxy is classified by the hints alone. Route hints read from each operator's routes.txt cover Prague's trolleybus lines and Petřín funicular, and Bucharest, Cluj-Napoca and Turin's trams, trolleybuses and metro lines (and Turin's Sassi–Superga rack tramway, typed a funicular in its -routes.txt). TransLink route ids resolve rail, Gold Coast light rail and -ferries; Adelaide Metro route ids resolve trains, trams and the SeaLink ferry; -other routes in those feeds keep the feed's bus default. Le Havre's funicular is a correction, not read from routes.txt: its +routes.txt). Route-id hints also cover TransLink's rail, Gold Coast light rail +and ferries, and Adelaide Metro's trains, trams and SeaLink ferry; their other +routes stay buses by default. Le Havre's funicular is a correction, not read from routes.txt: its route hint and its correction both say funicular. Vilnius publishes no route ids in its positions, so -its trolleybuses read as buses. TransLink route keys are shown -without their GTFS version, and Cairns buses without their `C` prefix -(`C123-33` reads as route 123). Retained history classifies its epochs the same -way, so a trail joins the live vehicle. +its trolleybuses read as buses. TransLink labels drop the GTFS version and +Cairns's `C` prefix (`C123-33` reads as route 123). Retained history classifies +its epochs the same way, so a trail joins the live vehicle. Retained transit history uses the same outlier quarantine as live observations and preserves the active live bracket. Rejected reports do not publish route or mode diff --git a/src/data/transitFeeds.js b/src/data/transitFeeds.js index c4d31aa23f..cb1b10398b 100644 --- a/src/data/transitFeeds.js +++ b/src/data/transitFeeds.js @@ -455,11 +455,10 @@ function burlingtonRouteLabel(routeId) { } /** - * TransLink (Queensland) route ids are `-`. Rail lines are two - * two-letter station codes (`BRBN`, `SHCL`), ferries are `F` plus the - * Southern Moreton Bay Islands service `SMBI`, and the Gold Coast light rail - * is `L1`. `SHUT` is the rail-replacement bus. Everything else is a bus, left - * to the feed default so movement plausibility treats it as a guess. + * TransLink route ids are `-`. Rail lines pair two station + * codes (`BRBN`), ferries are `F` and `SMBI`, light rail is `L1`. Buses, + * the `SHUT` rail-replacement bus included, stay on the feed default, which + * movement plausibility treats as a guess. * @param {string|null} routeId * @returns {string} */ @@ -473,10 +472,9 @@ function translinkRouteMode(routeId) { } /** - * TransLink route key to the route a rider would say: drop the `-` - * suffix (`200-4` → `200`, `L1-32` → `L1`), and drop the `C` Cairns puts in - * front of its numbered buses (`C123-33` → `123`). South East Queensland has no - * `C` routes; its rail codes such as `CLSH` are letters only. + * The route a rider would say: `200-4` → `200`, `L1-32` → `L1`, and Cairns + * `C123-33` → `123`. Only Cairns has `C` routes; rail codes such as + * `CLSH` are letters only. * @param {string|null} routeId * @returns {string|null} */ diff --git a/src/data/transitFeeds.test.mjs b/src/data/transitFeeds.test.mjs index 4901de910a..beebfe7eaa 100644 --- a/src/data/transitFeeds.test.mjs +++ b/src/data/transitFeeds.test.mjs @@ -397,8 +397,7 @@ test('a feed with rider-facing route ids is left alone', () => { }); test('TransLink route keys lose their GTFS version; Cairns loses its C prefix', () => { - // Both TransLink feeds key routes `-`, and Cairns prefixes - // its numbered buses with C. Ids seen in the live feeds, 9 Nov 2026. + // Ids seen in the live feeds, 9 Nov 2026. const seq = getTransitFeed('translink-seq'); assert.equal(transitRouteLabel(seq, '200-4'), '200'); assert.equal(transitRouteLabel(seq, 'L1-32'), 'L1', 'Gold Coast light rail'); diff --git a/src/data/transitFeedsAustralia.test.mjs b/src/data/transitFeedsAustralia.test.mjs index 615114a02c..6edd74b947 100644 --- a/src/data/transitFeedsAustralia.test.mjs +++ b/src/data/transitFeedsAustralia.test.mjs @@ -48,8 +48,7 @@ test('TransLink route ids resolve rail, light rail and ferries; buses stay a def assert.equal(transitModeFor(seq, routeId), mode, routeId); assert.equal(transitModeResolved(seq, routeId), true, routeId); } - // Buses, Brisbane Metro and the rail-replacement shuttle are buses by the - // feed default, so movement plausibility does not treat them as known. + // Buses stay on the feed default, so movement plausibility treats them as a guess. for (const routeId of ['600', '250-5169', 'M1-4949', 'SHUT-5213', null]) { assert.equal(transitModeFor(seq, routeId), 'bus', String(routeId)); assert.equal(transitModeResolved(seq, routeId), false, String(routeId)); @@ -60,7 +59,6 @@ test('TransLink route ids resolve rail, light rail and ferries; buses stay a def }); test('Adelaide Metro route ids resolve trains, trams and the SeaLink ferry', () => { - // The feed entry is main's; this PR adds only its routeMode. const adelaide = getTransitFeed('adelaide-metro'); const cases = [ ['BEL', 'rail'], @@ -121,6 +119,6 @@ test('DATA_SOURCES documents the TransLink feeds in the transit row style', () = assert.equal( adelaide.length, 1, - 'exactly one Adelaide Metro transit row (main’s)', + 'one Adelaide Metro Transit row', ); }); From 301dee2174a384582df6475a99b4af16bc412332 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Wed, 18 Nov 2026 02:14:59 +0400 Subject: [PATCH 6/6] Register TransLink Cairns through transitFeed and drop tests that restate data --- src/data/transitFeeds.js | 10 ++++------ src/data/transitFeedsAustralia.test.mjs | 19 +------------------ 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/data/transitFeeds.js b/src/data/transitFeeds.js index cb1b10398b..96f33a85f8 100644 --- a/src/data/transitFeeds.js +++ b/src/data/transitFeeds.js @@ -479,7 +479,6 @@ function translinkRouteMode(routeId) { * @returns {string|null} */ function translinkRouteLabel(routeId) { - if (!routeId) return routeId; const route = routeId.replace(/-\d+$/, ''); const cairns = /^C(\d+)$/.exec(route); return cairns ? cairns[1] : route; @@ -970,23 +969,22 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([ routeMode: translinkRouteMode, routeLabel: translinkRouteLabel, }), - Object.freeze({ + transitFeed({ id: 'translink-cairns', name: 'TransLink', operator: 'TransLink (Queensland Government)', region: 'Cairns, Australia', - center: Object.freeze({ lat: -16.9186, lon: 145.7781 }), + center: { lat: -16.9186, lon: 145.7781 }, loadRadiusKm: 60, url: 'https://gtfsrt.api.translink.com.au/api/realtime/CNS/VehiclePositions', license: 'CC BY 4.0', licenseUrl: 'https://translink.com.au/about-translink/open-data', attribution: 'Translink, Department of Transport and Main Roads', - defaultEnabled: true, - terms: Object.freeze({ + terms: { quote: 'Our data is licensed under a Creative Commons Attribution 4.0 International License. Authentication is not required to use the feed.', note: 'The same open-data page lists Cairns (CNS) vehicle positions beside South East Queensland; same terms, text-only credit.', - }), + }, defaultMode: 'bus', routeMode: translinkRouteMode, routeLabel: translinkRouteLabel, diff --git a/src/data/transitFeedsAustralia.test.mjs b/src/data/transitFeedsAustralia.test.mjs index 6edd74b947..f4a3d379ef 100644 --- a/src/data/transitFeedsAustralia.test.mjs +++ b/src/data/transitFeedsAustralia.test.mjs @@ -13,19 +13,12 @@ import { // Route ids below are as published in the live feeds and the operators' // static routes.txt (checked 16 Oct 2026). -test('TransLink feeds are keyless, routable and cover their own city only', () => { - const seq = getTransitFeed('translink-seq'); +test('TransLink Cairns is routable and each TransLink feed covers its own city', () => { const cairns = getTransitFeed('translink-cairns'); assert.equal( cairns.url, 'https://gtfsrt.api.translink.com.au/api/realtime/CNS/VehiclePositions', ); - for (const feed of [seq, cairns]) { - assert.equal(feed.headers, undefined, `${feed.id} needs no extra header`); - } - for (const feed of [seq, cairns]) { - assert.equal(feed.license, 'CC BY 4.0'); - } const ids = (lat, lon) => transitFeedsInRange(lat, lon).map((f) => f.id); assert.deepEqual(ids(-27.4698, 153.0251), ['translink-seq']); assert.deepEqual(ids(-16.9186, 145.7781), ['translink-cairns']); @@ -111,14 +104,4 @@ test('DATA_SOURCES documents the TransLink feeds in the transit row style', () = /published for developer use and not against their use/, ); assert.doesNotMatch(translink, /licen[cs]e|CC BY|terms/i); - // The Rail layer documents Adelaide Metro in a row of its own. - const adelaide = rows.filter( - (line) => - line.startsWith('| **Adelaide Metro**') && /Transit layer/.test(line), - ); - assert.equal( - adelaide.length, - 1, - 'one Adelaide Metro Transit row', - ); });