signalk-to-noforeignland 0.1.13 → 0.1.15
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/index.js +16 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -179,10 +179,15 @@ module.exports = function (app) {
|
|
|
179
179
|
let timestamp = update.timestamp;
|
|
180
180
|
for (value of update.values) {
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
|
|
183
|
+
if (
|
|
184
|
+
Math.abs(value.value.latitude) <= 0.01 &&
|
|
185
|
+
Math.abs(value.value.longitude) <= 0.01
|
|
186
|
+
) {
|
|
187
|
+
// Coordinates are within ±0.1 of (0,0)
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
186
191
|
// app.debug(`value:`, value);
|
|
187
192
|
|
|
188
193
|
if (!shouldDoLog) {
|
|
@@ -401,10 +406,13 @@ module.exports = function (app) {
|
|
|
401
406
|
if (line) {
|
|
402
407
|
try {
|
|
403
408
|
const point = JSON.parse(line);
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
409
|
+
|
|
410
|
+
const timestamp = new Date(point.t).getTime();
|
|
411
|
+
if (!isNaN(timestamp) && isValidLatitude(point.lat) && isValidLongitude(point.lon)) {
|
|
412
|
+
track.push([timestamp, point.lat, point.lon]);
|
|
413
|
+
lastTimestamp = timestamp;
|
|
414
|
+
}
|
|
415
|
+
|
|
408
416
|
} catch (error) {
|
|
409
417
|
app.debug('could not parse line from track file:', line);
|
|
410
418
|
}
|