fleetmap-reports 1.0.859 → 1.0.862
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/speeding-report.js +5 -5
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -299,7 +299,7 @@ async function getCustomSpeedLimitEvents (devices, routes, customSpeed) {
|
|
|
299
299
|
return events
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
async function getRoadSpeedLimits(devices, routes, threshold, minimumMinutes = 0) {
|
|
302
|
+
async function getRoadSpeedLimits (devices, routes, threshold, minimumMinutes = 0) {
|
|
303
303
|
const position = routes[0]
|
|
304
304
|
const country = crg.get_country(position.latitude, position.longitude)
|
|
305
305
|
const config = {
|
|
@@ -309,7 +309,7 @@ async function getRoadSpeedLimits(devices, routes, threshold, minimumMinutes = 0
|
|
|
309
309
|
return method(devices, routes, threshold, minimumMinutes)
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
async function getOSMSpeedingEvents(devices, routes, threshold, minimumMinutes = 0) {
|
|
312
|
+
async function getOSMSpeedingEvents (devices, routes, threshold, minimumMinutes = 0) {
|
|
313
313
|
const chunk = 1000
|
|
314
314
|
const events = []
|
|
315
315
|
for (const d of devices) {
|
|
@@ -321,8 +321,8 @@ async function getOSMSpeedingEvents(devices, routes, threshold, minimumMinutes =
|
|
|
321
321
|
const { features } = await axios.post(`https://api.geoapify.com/v1/mapmatching?apiKey=${apiKey}`, {
|
|
322
322
|
mode: 'drive',
|
|
323
323
|
waypoints: slice.map(p => ({
|
|
324
|
-
timestamp: p.fixTime,
|
|
325
|
-
bearing: p.
|
|
324
|
+
timestamp: new Date(p.fixTime).toISOString(),
|
|
325
|
+
bearing: p.course,
|
|
326
326
|
location: [p.longitude, p.latitude]
|
|
327
327
|
}))
|
|
328
328
|
}).then(r => r.data)
|
|
@@ -359,7 +359,7 @@ async function getOSMSpeedingEvents(devices, routes, threshold, minimumMinutes =
|
|
|
359
359
|
cur.attributes = { speedLimit: cur.speed_limit, speed: cur.speed, maxSpeed: cur.speed }
|
|
360
360
|
cur.eventTime = 0
|
|
361
361
|
cur.distance = 0
|
|
362
|
-
cur.position = {...cur}
|
|
362
|
+
cur.position = { ...cur }
|
|
363
363
|
acc.push(cur)
|
|
364
364
|
}
|
|
365
365
|
return acc
|