Merge upstream main into feat/australia-transit; TransLink route labels

Resolves the conflicts with main's Rio de Janeiro transit (#1481) and
addresses the review on #1169:

- transitFeeds.js: keep main's rioRouteLabel and this branch's
  translinkRouteMode and Adelaide helpers. Add translinkRouteLabel,
  which drops the GTFS version suffix (200-4 -> 200, L1-32 -> L1) and
  Cairns' C prefix (C123-33 -> 123), and set it as routeLabel on both
  TransLink feeds. Tested through transitRouteLabel with ids seen in the
  live SEQ and Cairns feeds on 9 Nov.
- DATA_SOURCES.md, README.md, docs/CURRENT-STATE.md: keep both sides.
  Counts from the registry: 20 feeds covering 19 regions (Rio has two
  feeds). Main's CURRENT-STATE table row still read "7 keyless regions".
- changelog.d/1169-australian-transit.md: note the route labels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Renzo WillandClaude Opus 5.5 committed 2026-11-09 22:33:08 +10:00
commit 0effcf587d
690 files changed
+133401 -2978

No files matched your search

+76
View File
@@ -1,4 +1,5 @@
import { greatCircleKm } from '../geoDistance.js';
import { RIO_ROUTE_NAMES } from './rioRouteNames.js';
/**
* @module transitFeeds
@@ -394,6 +395,21 @@ function translinkRouteMode(routeId) {
return 'unknown';
}
/**
* TransLink route key to the route a rider would say: drop the `-<version>`
* 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<digits>` routes; its rail codes such as `CLSH` are letters only.
* @param {string|null} 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;
}
/** Adelaide Metro train and tram route ids, from its static routes.txt. */
const ADELAIDE_RAIL_ROUTES = new Set([
'BEL',
@@ -424,6 +440,18 @@ function adelaideMetroRouteMode(routeId) {
return 'unknown';
}
/**
* Rio route key to the line a rider would say. One SMTR `routes.txt` covers
* both feeds (see rioRouteNames.js).
* @param {string|null} routeId
* @returns {string|null}
*/
function rioRouteLabel(routeId) {
return Object.hasOwn(RIO_ROUTE_NAMES, routeId)
? RIO_ROUTE_NAMES[routeId]
: routeId;
}
/**
* Registry of feeds. Order is presentation order in the stats/credit text.
* `loadRadiusKm` is the distance from `center` inside which the feed is polled.
@@ -579,6 +607,7 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([
}),
defaultMode: 'bus',
routeMode: translinkRouteMode,
routeLabel: translinkRouteLabel,
}),
Object.freeze({
id: 'translink-cairns',
@@ -599,6 +628,7 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([
}),
defaultMode: 'bus',
routeMode: translinkRouteMode,
routeLabel: translinkRouteLabel,
}),
Object.freeze({
id: 'adelaide-metro',
@@ -824,6 +854,52 @@ export const TRANSIT_FEED_REGISTRY = Object.freeze([
defaultMode: 'bus',
routeLabel: burlingtonRouteLabel,
}),
Object.freeze({
id: 'smtr-rio-onibus',
name: 'Rio buses (SPPO)',
operator: 'Secretaria Municipal de Transportes (SMTR), Rio de Janeiro',
region: 'Rio de Janeiro, RJ',
// Every vehicle in a 2026-10-29 snapshot, from Santa Cruz in the west to
// the Zona Sul, sat within 31 km of this point.
center: Object.freeze({ lat: -22.92, lon: -43.42 }),
loadRadiusKm: 45,
url: 'https://dados.mobilidade.rio/gtfs/realtime/onibus/vehicle-positions',
license: 'CC BY 4.0',
licenseUrl:
'https://www.data.rio/documents/997bc16cc4344a5cb0e48ab06cbdfd1f',
attribution: 'SMTR / Prefeitura da Cidade do Rio de Janeiro — buses (SPPO)',
defaultEnabled: true,
terms: Object.freeze({
quote:
'This work is licensed under a Creative Commons Attribution 4.0 International License',
note: 'The data.rio catalog page labels the feed [beta] and states a gateway limit of 5 requests a second and 60 a minute behind a 10-second cache, which the 15-second proxy TTL stays inside. SMTR relays the concessionaires’ ITS data and repairs trips with its own matching; the page places accuracy with the suppliers. Speeds are m/s, as the spec requires: checked against vehicle movement on 2026-11-05, though a 2026-10-29 snapshot read as km/h. Line names come from SMTR’s GTFS `routes.txt`, under the same CC BY 4.0 terms.',
}),
defaultMode: 'bus',
routeLabel: rioRouteLabel,
}),
Object.freeze({
id: 'smtr-rio-brt',
name: 'Mobi-Rio BRT',
operator:
'Secretaria Municipal de Transportes (SMTR), Rio de Janeiro, for the Mobi-Rio BRT fleet',
region: 'Rio de Janeiro, RJ',
center: Object.freeze({ lat: -22.92, lon: -43.42 }),
loadRadiusKm: 45,
url: 'https://dados.mobilidade.rio/gtfs/realtime/brt/vehicle-positions',
license: 'CC BY 4.0',
licenseUrl:
'https://www.data.rio/documents/8bb196cc02174d25b77437bb2f6443d4',
attribution:
'SMTR / Prefeitura da Cidade do Rio de Janeiro — BRT (Mobi-Rio)',
defaultEnabled: true,
terms: Object.freeze({
quote:
'This work is licensed under a Creative Commons Attribution 4.0 International License',
note: 'Same catalog terms, [beta] label and gateway limits as the bus feed. The fleet is operated by Mobi-Rio and tracked by SONDA, whose data SMTR relays. Speeds are m/s too. Line names come from the same `routes.txt`.',
}),
defaultMode: 'bus',
routeLabel: rioRouteLabel,
}),
]);
/**