Compare commits

..

No commits in common. "dd327397367601ac7aa26a35f7516aac4e86f4d0" and "a58d8c76109c96caaf821f6e431926e69883d2c2" have entirely different histories.

3 changed files with 22 additions and 42 deletions

View File

@ -407,10 +407,15 @@ different sequence of nodes in two or more lines.`);
for (let i = 1; i < points.length; ++i)
{
points[i].distance = geolib.getPreciseDistance(
points[i - 1],
points[i],
) + points[i - 1].distance;
const len = geolib.getPreciseDistance(
...[points[i - 1], points[i]]
.map(({lat, lon}) => ({
latitude: lat,
longitude: lon
})),
);
points[i].distance = points[i - 1].distance + len;
}
}

View File

@ -972,14 +972,6 @@
"2"
]
},
"42265": {
"lat": 43.5719919,
"lon": 3.8444363,
"name": "La Condamine",
"lines": [
"2"
]
},
"42267": {
"lat": 43.5708971,
"lon": 3.837919,
@ -1621,7 +1613,7 @@
"42257",
"42259",
"42263",
"42265",
"42105",
"42267",
"42269"
]
@ -6893,11 +6885,6 @@
"lon": 3.8441514,
"distance": 530
},
{
"lat": 43.5719919,
"lon": 3.8444363,
"distance": 557
},
{
"lat": 43.5719919,
"lon": 3.8444363,
@ -14764,7 +14751,7 @@
"2"
]
},
"42263-42265": {
"42263-42105": {
"points": [
{
"lat": 43.5751577,
@ -14821,11 +14808,6 @@
"lon": 3.8453333,
"distance": 469
},
{
"lat": 43.5719919,
"lon": 3.8444363,
"distance": 557
},
{
"lat": 43.5719919,
"lon": 3.8444363,
@ -14836,7 +14818,7 @@
"2"
]
},
"42265-42267": {
"42105-42267": {
"points": [
{
"lat": 43.5719919,

View File

@ -1,26 +1,19 @@
const tam = require('./sources/tam');
const util = require('../util');
/**
* Fetch real-time information about courses in the TaM network.
*
* New data will only be fetched from the TaM server if necessary, otherwise
* pulling from the in-memory cache.
*
* @return Mapping from active course IDs to current information about the
* course, including its line number, next stop and next stop estimated
* time of arrival (ETA).
*/
let nextUpdate = null;
let currentCourses = null;
/**
* Fetch real-time information about active courses in the TaM network.
*
* New data will only be fetched from the TaM server once every minute,
* otherwise pulling from the in-memory cache.
*
* The following information is provided for each active course:
*
* - `id`: Unique identifier for the course.
* - `line`: Line number.
* - `nextStop`: Identifier of the next stop of the course.
* - `arrivalTime`: Timestamp at which the vehicle is predicted to arrive
* to the next stop.
* - `finalStop`: The final stop to which the course is headed.
*
* @return Mapping from active course IDs to information about each course.
*/
const getCourses = () => new Promise((res, rej) =>
{
if (nextUpdate !== null && Date.now() < nextUpdate)