Add line 4

This commit is contained in:
Mattéo Delabre 2020-01-15 18:17:49 +01:00
parent 3c3f446503
commit 6c252413d5
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
4 changed files with 14 additions and 7 deletions

View File

@ -47,11 +47,18 @@ const fetchStopsRefAssociations = () => new Promise((res, rej) =>
return;
}
let line = row.routeShortName;
if (line === '4')
{
line += row.directionId === '0' ? 'A' : 'B';
}
if (!(row.stopId in stops))
{
stops[row.stopId] = {
name: row.stopName,
lines: new Set([row.routeShortName]),
lines: new Set([line]),
directions: new Set([row.tripHeadsign]),
};
}
@ -65,7 +72,7 @@ const fetchStopsRefAssociations = () => new Promise((res, rej) =>
${row.stopName} and ${stop.name}. Only the first one will be considered.`);
}
stop.lines.add(row.routeShortName);
stop.lines.add(line);
stop.directions.add(row.tripHeadsign);
}
});
@ -185,7 +192,7 @@ out body qt;
{
console.warn(`Stop ${stop.id} is missing a “ref” tag
Name: ${stop.tags.name}
Part of line: ${lineRef} (to ${route.tags.to})
Part of line: ${route.tags.name}
URI: ${osmViewNode}/${stop.id}
`);
@ -194,7 +201,7 @@ URI: ${osmViewNode}/${stop.id}
// and trip direction
const candidates = Object.entries(associations).filter(
([stopRef, {name, lines, directions}]) =>
lines.has(lineRef)
lines.has(route.tags.ref)
).map(([stopRef, {name, lines, directions}]) => ({
stopRef,
lines,

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ const fs = require('fs');
(async () =>
{
const lines = ['1', '2', '3'];
const lines = ['1', '2', '3', '4'];
const data = await network.fetch(lines);
fs.writeFileSync(

View File

@ -13,4 +13,4 @@ app.get('/realtime', (req, res) =>
app.get('/network', async (req, res) => res.json(network));
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
app.listen(port, () => console.log(`App listening on port ${port}`))