Add line 4
This commit is contained in:
parent
3c3f446503
commit
6c252413d5
|
@ -47,11 +47,18 @@ const fetchStopsRefAssociations = () => new Promise((res, rej) =>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let line = row.routeShortName;
|
||||||
|
|
||||||
|
if (line === '4')
|
||||||
|
{
|
||||||
|
line += row.directionId === '0' ? 'A' : 'B';
|
||||||
|
}
|
||||||
|
|
||||||
if (!(row.stopId in stops))
|
if (!(row.stopId in stops))
|
||||||
{
|
{
|
||||||
stops[row.stopId] = {
|
stops[row.stopId] = {
|
||||||
name: row.stopName,
|
name: row.stopName,
|
||||||
lines: new Set([row.routeShortName]),
|
lines: new Set([line]),
|
||||||
directions: new Set([row.tripHeadsign]),
|
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.`);
|
“${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);
|
stop.directions.add(row.tripHeadsign);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -185,7 +192,7 @@ out body qt;
|
||||||
{
|
{
|
||||||
console.warn(`Stop ${stop.id} is missing a “ref” tag
|
console.warn(`Stop ${stop.id} is missing a “ref” tag
|
||||||
Name: ${stop.tags.name}
|
Name: ${stop.tags.name}
|
||||||
Part of line: ${lineRef} (to ${route.tags.to})
|
Part of line: ${route.tags.name}
|
||||||
URI: ${osmViewNode}/${stop.id}
|
URI: ${osmViewNode}/${stop.id}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
@ -194,7 +201,7 @@ URI: ${osmViewNode}/${stop.id}
|
||||||
// and trip direction
|
// and trip direction
|
||||||
const candidates = Object.entries(associations).filter(
|
const candidates = Object.entries(associations).filter(
|
||||||
([stopRef, {name, lines, directions}]) =>
|
([stopRef, {name, lines, directions}]) =>
|
||||||
lines.has(lineRef)
|
lines.has(route.tags.ref)
|
||||||
).map(([stopRef, {name, lines, directions}]) => ({
|
).map(([stopRef, {name, lines, directions}]) => ({
|
||||||
stopRef,
|
stopRef,
|
||||||
lines,
|
lines,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@ const fs = require('fs');
|
||||||
|
|
||||||
(async () =>
|
(async () =>
|
||||||
{
|
{
|
||||||
const lines = ['1', '2', '3'];
|
const lines = ['1', '2', '3', '4'];
|
||||||
const data = await network.fetch(lines);
|
const data = await network.fetch(lines);
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
|
|
|
@ -13,4 +13,4 @@ app.get('/realtime', (req, res) =>
|
||||||
|
|
||||||
app.get('/network', async (req, res) => res.json(network));
|
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}`))
|
||||||
|
|
Loading…
Reference in New Issue