distance
This commit is contained in:
parent
1632419420
commit
536bf387c8
@ -110,6 +110,30 @@ window.addEventListener("load", function(evt) {
|
||||
updateMapSERIALbulk(r.data.Data.SOURCE_SERIAL)
|
||||
addSerialSpeedData()
|
||||
}
|
||||
if('SOURCE_TCP' in r.data.Data && r.data.Data.SOURCE_TCP.length > 0 && 'SOURCE_SERIAL' in r.data.Data && r.data.Data.SOURCE_SERIAL.length > 0) {
|
||||
console.log("TEST")
|
||||
let tcpSensorPoint = {};
|
||||
let serSensorPoint = {};
|
||||
r.data.Data.SOURCE_TCP.forEach(element => {
|
||||
// let ts = Date.parse(element.Timestamp)
|
||||
if (element.Position[0] !== 0 && element.Position[1] !== 0) {
|
||||
tcpSensorPoint = element
|
||||
}
|
||||
})
|
||||
console.log("TCP SENSORPOINT", tcpSensorPoint)
|
||||
let smallestDifference = Number.MAX_VALUE
|
||||
r.data.Data.SOURCE_SERIAL.forEach(element => {
|
||||
let tcpTS = Date.parse(tcpSensorPoint.Timestamp)
|
||||
let serTS = Date.parse(element.Timestamp)
|
||||
if (Math.abs(tcpTS - serTS) < smallestDifference) {
|
||||
smallestDifference = Math.abs(tcpTS - serTS)
|
||||
serSensorPoint = element
|
||||
}
|
||||
})
|
||||
console.log("SER SENSORPOINT", serSensorPoint)
|
||||
console.log("smallest diff", smallestDifference)
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user