mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(transit): add Lisbon's Carris Metropolitana buses
Keyless GTFS-Realtime feed from Carris Metropolitana, documented in the operator's public API repository. No licence is stated for the realtime endpoint (the static GTFS is CC BY 4.0), so it is credited as a courtesy on the same basis as the Metro Transit and OVapi feeds. The feed publishes km/h, so a new `speedUnit` registry field lets the proxy convert to m/s. Route ids wrap the GTFS route id in an area prefix and are read as the line number. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
433b336c2d
commit
e0ba12e5a9
9 files changed
+109
-8
No files matched your search
@@ -294,6 +294,27 @@ test('Rio speeds pass through as the m/s they are published in', () => {
|
||||
assert.equal(rio.vehicles[0].speedMps, 10);
|
||||
});
|
||||
|
||||
test('Carris Metropolitana km/h speeds leave the proxy as m/s', () => {
|
||||
// 2026-11-07: readings of 31-33 matched 6-9 m/s of measured movement.
|
||||
const bytes = encodeFeed({
|
||||
entities: [
|
||||
{ id: 'moving', lat: 38.72, lon: -9.14, speed: 36 },
|
||||
{ id: 'parked', lat: 38.73, lon: -9.15 },
|
||||
],
|
||||
});
|
||||
const feed = getTransitFeed('carris-metropolitana-lisboa');
|
||||
const lisbon = buildTransitSnapshot(feed, bytes, 1);
|
||||
const byId = Object.fromEntries(lisbon.vehicles.map((v) => [v.id, v]));
|
||||
assert.ok(Math.abs(byId.moving.speedMps - 10) < 1e-6);
|
||||
assert.equal(byId.parked.speedMps, null, 'no speed stays no speed');
|
||||
const szczecin = buildTransitSnapshot(
|
||||
getTransitFeed('zditm-szczecin'),
|
||||
encodeFeed({ entities: [{ id: 'm', lat: 53.43, lon: 14.55, speed: 10 }] }),
|
||||
1,
|
||||
);
|
||||
assert.equal(szczecin.vehicles[0].speedMps, 10, 'm/s feeds are untouched');
|
||||
});
|
||||
|
||||
test('conditional-request validators and gzip ride along with feed identification', () => {
|
||||
const entur = getTransitFeed('entur-norway');
|
||||
const plain = transitUpstreamHeaders(entur);
|
||||
|
||||
Reference in new issue
Block a user