feat: add track length and duration (seconds) to parsed information

This commit is contained in:
Paul Bienkowski 2020-12-02 20:55:04 +01:00
parent 028d224726
commit 5770229945
3 changed files with 671 additions and 5 deletions

612
package-lock.json generated
View file

@ -1176,6 +1176,14 @@
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz",
"integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA=="
},
"affine-hull": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/affine-hull/-/affine-hull-1.0.0.tgz",
"integrity": "sha1-dj/x040GPOt+Jy8X7k17vK+QXF0=",
"requires": {
"robust-orientation": "^1.1.3"
}
},
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@ -1612,6 +1620,11 @@
"integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==",
"dev": true
},
"bit-twiddle": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-1.0.2.tgz",
"integrity": "sha1-DGwfq+KyPRcXPZpht7cJPrnhdp4="
},
"bl": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz",
@ -2120,6 +2133,16 @@
"safe-buffer": "~5.1.1"
}
},
"convex-hull": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/convex-hull/-/convex-hull-1.0.3.tgz",
"integrity": "sha1-IKOqbOh/St6i/30XlxyfwcZ+H/8=",
"requires": {
"affine-hull": "^1.0.0",
"incremental-convex-hull": "^1.0.1",
"monotone-convex-hull-2d": "^1.0.1"
}
},
"cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
@ -2464,6 +2487,11 @@
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
"dev": true
},
"earcut": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.2.tgz",
"integrity": "sha512-eZoZPPJcUHnfRZ0PjLvx2qBordSiO8ofC3vt+qACLM95u+4DovnbYNpQtJh0DNsWj8RnxrQytD4WA8gj5cRIaQ=="
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@ -3657,6 +3685,24 @@
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
"integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="
},
"geojson-area": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/geojson-area/-/geojson-area-0.2.1.tgz",
"integrity": "sha1-JTewmC24YwnyHSxCikJXx6YoLMY=",
"requires": {
"wgs84": "0.0.0"
}
},
"geojson-normalize": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/geojson-normalize/-/geojson-normalize-0.0.0.tgz",
"integrity": "sha1-Lbw2eM0bMbgXnodr2nDNEg3eNcA="
},
"geojson-random": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/geojson-random/-/geojson-random-0.2.2.tgz",
"integrity": "sha1-q0g48SatxeFvj5TmVd74IPkRnbw="
},
"get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
@ -4098,6 +4144,15 @@
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
},
"incremental-convex-hull": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/incremental-convex-hull/-/incremental-convex-hull-1.0.1.tgz",
"integrity": "sha1-UUKMFMudmmFEv+abKFH7N3M0vh4=",
"requires": {
"robust-orientation": "^1.1.2",
"simplicial-complex": "^1.0.0"
}
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -5836,6 +5891,11 @@
"verror": "1.10.0"
}
},
"jsts": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/jsts/-/jsts-1.1.2.tgz",
"integrity": "sha1-0gXSzIOTCB2eSErjYoIRBpXtwjA="
},
"jwa": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
@ -6311,6 +6371,14 @@
"lodash.get": "^4.0.2"
}
},
"monotone-convex-hull-2d": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/monotone-convex-hull-2d/-/monotone-convex-hull-2d-1.0.1.tgz",
"integrity": "sha1-R/Xa6t88Sv03dkuqGqh4ekDu4Iw=",
"requires": {
"robust-orientation": "^1.1.3"
}
},
"morgan": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
@ -9051,6 +9119,36 @@
"glob": "^7.1.3"
}
},
"robust-orientation": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/robust-orientation/-/robust-orientation-1.1.3.tgz",
"integrity": "sha1-2v9bANO+TmByLw6cAVbvln8cIEk=",
"requires": {
"robust-scale": "^1.0.2",
"robust-subtract": "^1.0.0",
"robust-sum": "^1.0.0",
"two-product": "^1.0.2"
}
},
"robust-scale": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/robust-scale/-/robust-scale-1.0.2.tgz",
"integrity": "sha1-d1Ey7QlULQKOWLLMecBikLz3jDI=",
"requires": {
"two-product": "^1.0.2",
"two-sum": "^1.0.0"
}
},
"robust-subtract": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/robust-subtract/-/robust-subtract-1.0.0.tgz",
"integrity": "sha1-4LFk4e2LpOOl3aRaEgODSNvtPpo="
},
"robust-sum": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/robust-sum/-/robust-sum-1.0.0.tgz",
"integrity": "sha1-FmRuUlKStNJdgnV6KGlV4Lv6U9k="
},
"rsvp": {
"version": "4.8.5",
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
@ -9389,6 +9487,20 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
},
"simplicial-complex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/simplicial-complex/-/simplicial-complex-1.0.0.tgz",
"integrity": "sha1-bDOk7Wn81Nkbe8rdOzC2NoPq4kE=",
"requires": {
"bit-twiddle": "^1.0.0",
"union-find": "^1.0.0"
}
},
"simplify-js": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/simplify-js/-/simplify-js-1.2.4.tgz",
"integrity": "sha512-vITfSlwt7h/oyrU42R83mtzFpwYk3+mkH9bOHqq/Qw6n8rtR7aE3NZQ5fbcyCUVVmuMJR6ynsAhOfK2qoah8Jg=="
},
"sisteransi": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
@ -10107,11 +10219,501 @@
"safe-buffer": "^5.0.1"
}
},
"turf": {
"version": "3.0.14",
"resolved": "https://registry.npmjs.org/turf/-/turf-3.0.14.tgz",
"integrity": "sha1-6y9KgKLVg7jGSGvHtccZBGaGbCc=",
"requires": {
"turf-along": "^3.0.12",
"turf-area": "^3.0.12",
"turf-bbox": "^3.0.12",
"turf-bbox-polygon": "^3.0.12",
"turf-bearing": "^3.0.12",
"turf-bezier": "^3.0.12",
"turf-buffer": "^3.0.12",
"turf-center": "^3.0.12",
"turf-centroid": "^3.0.12",
"turf-circle": "^3.0.12",
"turf-collect": "^3.0.12",
"turf-combine": "^3.0.12",
"turf-concave": "^3.0.12",
"turf-convex": "^3.0.12",
"turf-destination": "^3.0.12",
"turf-difference": "^3.0.12",
"turf-distance": "^3.0.12",
"turf-envelope": "^3.0.12",
"turf-explode": "^3.0.12",
"turf-flip": "^3.0.12",
"turf-helpers": "^3.0.12",
"turf-hex-grid": "^3.0.12",
"turf-inside": "^3.0.12",
"turf-intersect": "^3.0.12",
"turf-isolines": "^3.0.12",
"turf-kinks": "^3.0.12",
"turf-line-distance": "^3.0.12",
"turf-line-slice": "^3.0.12",
"turf-meta": "^3.0.12",
"turf-midpoint": "^3.0.12",
"turf-nearest": "^3.0.12",
"turf-planepoint": "^3.0.12",
"turf-point-grid": "^3.0.12",
"turf-point-on-line": "^3.0.12",
"turf-point-on-surface": "^3.0.12",
"turf-random": "^3.0.12",
"turf-sample": "^3.0.12",
"turf-simplify": "^3.0.12",
"turf-square": "^3.0.12",
"turf-square-grid": "^3.0.12",
"turf-tag": "^3.0.12",
"turf-tesselate": "^3.0.12",
"turf-tin": "^3.0.12",
"turf-triangle-grid": "^3.0.12",
"turf-union": "^3.0.12",
"turf-within": "^3.0.12"
}
},
"turf-along": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-along/-/turf-along-3.0.12.tgz",
"integrity": "sha1-5iK956S9E4wJZH1LFKoOpwBIXeY=",
"requires": {
"turf-bearing": "^3.0.12",
"turf-destination": "^3.0.12",
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-area": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-area/-/turf-area-3.0.12.tgz",
"integrity": "sha1-m35Gnvn7VY/RR7sMIUgjJjvb8Tw=",
"requires": {
"geojson-area": "^0.2.1"
}
},
"turf-bbox": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-bbox/-/turf-bbox-3.0.12.tgz",
"integrity": "sha1-P6BhF8hEOGDsgKxg/V0vEyC/sb4=",
"requires": {
"turf-meta": "^3.0.12"
}
},
"turf-bbox-polygon": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-bbox-polygon/-/turf-bbox-polygon-3.0.12.tgz",
"integrity": "sha1-Mw3AuzgyLWFUXflmzmyA9oWs9PI=",
"requires": {
"turf-helpers": "^3.0.12"
}
},
"turf-bearing": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-bearing/-/turf-bearing-3.0.12.tgz",
"integrity": "sha1-ZfYJ3YUOc2THdxqm3th7DhkX/SA=",
"requires": {
"turf-invariant": "^3.0.12"
}
},
"turf-bezier": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-bezier/-/turf-bezier-3.0.12.tgz",
"integrity": "sha1-EC791KY7Jl7pyMFydjGSCzb03QI=",
"requires": {
"turf-helpers": "^3.0.12"
}
},
"turf-buffer": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-buffer/-/turf-buffer-3.0.12.tgz",
"integrity": "sha1-IIQP58aqZ7JL4cq3/8xagv1r2XE=",
"requires": {
"geojson-normalize": "0.0.0",
"jsts": "1.1.2",
"turf-combine": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-center": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-center/-/turf-center-3.0.12.tgz",
"integrity": "sha1-Rd1sFym7hnKR4+AC6cdQb4xEAZY=",
"requires": {
"turf-bbox": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-centroid": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-centroid/-/turf-centroid-3.0.12.tgz",
"integrity": "sha1-6u4NaYIEtX/DOZS7G8hnuNopP48=",
"requires": {
"turf-helpers": "^3.0.12",
"turf-meta": "^3.0.12"
}
},
"turf-circle": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-circle/-/turf-circle-3.0.12.tgz",
"integrity": "sha1-FAshy0lQ8tPLxw0t8BKTaGf1iTA=",
"requires": {
"turf-destination": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-collect": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-collect/-/turf-collect-3.0.12.tgz",
"integrity": "sha1-bphtGnB9oxnMg+cjjQvN8Zqjx/I=",
"requires": {
"turf-inside": "^3.0.12"
}
},
"turf-combine": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-combine/-/turf-combine-3.0.12.tgz",
"integrity": "sha1-FnB0bw/c4NHqiqain/5UONRGz3M=",
"requires": {
"turf-meta": "^3.0.12"
}
},
"turf-concave": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-concave/-/turf-concave-3.0.12.tgz",
"integrity": "sha1-/KtgVpZbCoMZ9s2AJgEJXy/TqOs=",
"requires": {
"turf-distance": "^3.0.12",
"turf-meta": "^3.0.12",
"turf-tin": "^3.0.12",
"turf-union": "^3.0.12"
}
},
"turf-convex": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-convex/-/turf-convex-3.0.12.tgz",
"integrity": "sha1-qI3cPiLRy2WHlqnIXTraO9Pso1c=",
"requires": {
"convex-hull": "^1.0.3",
"turf-helpers": "^3.0.12",
"turf-meta": "^3.0.12"
}
},
"turf-destination": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-destination/-/turf-destination-3.0.12.tgz",
"integrity": "sha1-fdb7+X6G+DGibIPvLVovjR2KbeI=",
"requires": {
"turf-helpers": "^3.0.12",
"turf-invariant": "^3.0.12"
}
},
"turf-difference": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-difference/-/turf-difference-3.0.12.tgz",
"integrity": "sha1-nD0NdjBCEAW4slt/Bo7Z77S8bqc=",
"requires": {
"jsts": "1.1.2",
"turf-helpers": "^3.0.12"
}
},
"turf-distance": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-distance/-/turf-distance-3.0.12.tgz",
"integrity": "sha1-+5e4cF+s2ZOxReAUtBhiYQ7spEk=",
"requires": {
"turf-helpers": "^3.0.12",
"turf-invariant": "^3.0.12"
}
},
"turf-envelope": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-envelope/-/turf-envelope-3.0.12.tgz",
"integrity": "sha1-lpIdJ4zIxmRpLjIOJUO5FAgNeGs=",
"requires": {
"turf-bbox": "^3.0.12",
"turf-bbox-polygon": "^3.0.12"
}
},
"turf-explode": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-explode/-/turf-explode-3.0.12.tgz",
"integrity": "sha1-xa4owoTNAGxWUR7H1AjEilQU7P4=",
"requires": {
"turf-helpers": "^3.0.12",
"turf-meta": "^3.0.12"
}
},
"turf-flip": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-flip/-/turf-flip-3.0.12.tgz",
"integrity": "sha1-3rhoF3uf87sxDF1BqqxhqRVqPLs=",
"requires": {
"turf-meta": "^3.0.12"
}
},
"turf-grid": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/turf-grid/-/turf-grid-1.0.1.tgz",
"integrity": "sha1-uQSrxWS5ObYnpmrBXrFuBTgpuA8=",
"requires": {
"turf-point": "^2.0.0"
}
},
"turf-helpers": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-helpers/-/turf-helpers-3.0.12.tgz",
"integrity": "sha1-3UJy50s618lu7LeuXFf+jspUS3s="
},
"turf-hex-grid": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-hex-grid/-/turf-hex-grid-3.0.12.tgz",
"integrity": "sha1-BpjvZpAguzHY6cwgVtCr/K/ITo8=",
"requires": {
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-inside": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-inside/-/turf-inside-3.0.12.tgz",
"integrity": "sha1-m6QPpu7WO+x+fYiqZCdiLE3wcGY=",
"requires": {
"turf-invariant": "^3.0.12"
}
},
"turf-intersect": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-intersect/-/turf-intersect-3.0.12.tgz",
"integrity": "sha1-wNf7MFhDoZJ1ZwBXo50mixeDDYM=",
"requires": {
"jsts": "1.1.2"
}
},
"turf-invariant": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-invariant/-/turf-invariant-3.0.12.tgz",
"integrity": "sha1-O5UlOVOZHr2WLdNdT2cEwofejr4="
},
"turf-isolines": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-isolines/-/turf-isolines-3.0.12.tgz",
"integrity": "sha1-ALIz3+LuvU7LR6lPySPG7OyJx6s=",
"requires": {
"turf-bbox": "^3.0.12",
"turf-grid": "1.0.1",
"turf-helpers": "^3.0.12",
"turf-inside": "^3.0.12",
"turf-planepoint": "^3.0.12",
"turf-square": "^3.0.12",
"turf-tin": "^3.0.12"
}
},
"turf-kinks": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-kinks/-/turf-kinks-3.0.12.tgz",
"integrity": "sha1-6cmo26VyTZjyNQ/FveugaewzN1U=",
"requires": {
"turf-helpers": "^3.0.12"
}
},
"turf-line-distance": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-line-distance/-/turf-line-distance-3.0.12.tgz",
"integrity": "sha1-cQj1smkH97jC3Rs5l4Zt06YOj18=",
"requires": {
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-line-slice": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-line-slice/-/turf-line-slice-3.0.12.tgz",
"integrity": "sha1-9fGszJKtrmnqGsCynwdSmijd6RY=",
"requires": {
"turf-bearing": "^3.0.12",
"turf-destination": "^3.0.12",
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12",
"turf-point-on-line": "^3.0.12"
}
},
"turf-meta": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-meta/-/turf-meta-3.0.12.tgz",
"integrity": "sha1-CqmhyvgrKloI1U4IMLW1o/oOijg="
},
"turf-midpoint": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-midpoint/-/turf-midpoint-3.0.12.tgz",
"integrity": "sha1-sSdlroms3uhVb9XibJxfoEGgLL4=",
"requires": {
"turf-bearing": "^3.0.12",
"turf-destination": "^3.0.12",
"turf-distance": "^3.0.12",
"turf-invariant": "^3.0.12"
}
},
"turf-nearest": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-nearest/-/turf-nearest-3.0.12.tgz",
"integrity": "sha1-cAIH9EQ/BQlvhs0kb5KfFw369G0=",
"requires": {
"turf-distance": "^3.0.12"
}
},
"turf-planepoint": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-planepoint/-/turf-planepoint-3.0.12.tgz",
"integrity": "sha1-LDeuDxf8sw22448NWe5sDdbKqa8="
},
"turf-point": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/turf-point/-/turf-point-2.0.1.tgz",
"integrity": "sha1-otzDCi0g9Ez1xicd97riwOIUYGk=",
"requires": {
"minimist": "^1.1.0"
}
},
"turf-point-grid": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-point-grid/-/turf-point-grid-3.0.12.tgz",
"integrity": "sha1-1gSXi+ELyeUzBq4CzvcJhDHbSXE=",
"requires": {
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-point-on-line": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-point-on-line/-/turf-point-on-line-3.0.12.tgz",
"integrity": "sha1-HYZjNU5wNy2xhj5iU+kEDEcSew8=",
"requires": {
"turf-bearing": "^3.0.12",
"turf-destination": "^3.0.12",
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-point-on-surface": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-point-on-surface/-/turf-point-on-surface-3.0.12.tgz",
"integrity": "sha1-m+UFtrC6eOmFZQAd47OkJnEVJAo=",
"requires": {
"turf-center": "^3.0.12",
"turf-distance": "^3.0.12",
"turf-explode": "^3.0.12",
"turf-helpers": "^3.0.12",
"turf-inside": "^3.0.12"
}
},
"turf-random": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-random/-/turf-random-3.0.12.tgz",
"integrity": "sha1-NNuxQcPx6urhQk/Wxeq6H2+5seg=",
"requires": {
"geojson-random": "^0.2.2"
}
},
"turf-sample": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-sample/-/turf-sample-3.0.12.tgz",
"integrity": "sha1-eUn4YgYSBH4TFMHO2H6ZwUJGPNI=",
"requires": {
"turf-helpers": "^3.0.12"
}
},
"turf-simplify": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-simplify/-/turf-simplify-3.0.12.tgz",
"integrity": "sha1-heRDyLRqordSY4lETHOB2qKtGec=",
"requires": {
"simplify-js": "^1.2.1"
}
},
"turf-square": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-square/-/turf-square-3.0.12.tgz",
"integrity": "sha1-Gjix4PsF/+D8qkMYji83lCpRW2Q=",
"requires": {
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-square-grid": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-square-grid/-/turf-square-grid-3.0.12.tgz",
"integrity": "sha1-PB2ArBRVbGgTtHi9oBJRLtS5Psg=",
"requires": {
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-tag": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-tag/-/turf-tag-3.0.12.tgz",
"integrity": "sha1-IoT/8Oih6Son1Kx/10cbPEjd0ag=",
"requires": {
"turf-inside": "^3.0.12"
}
},
"turf-tesselate": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-tesselate/-/turf-tesselate-3.0.12.tgz",
"integrity": "sha1-QUdLe1s4ILzyc/tx4YlNjDzUDTU=",
"requires": {
"earcut": "^2.0.0",
"turf-helpers": "^3.0.12"
}
},
"turf-tin": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-tin/-/turf-tin-3.0.12.tgz",
"integrity": "sha1-tlNGRHY6zhyd8kHJWNI4SFUlc4U=",
"requires": {
"turf-helpers": "^3.0.12"
}
},
"turf-triangle-grid": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-triangle-grid/-/turf-triangle-grid-3.0.12.tgz",
"integrity": "sha1-gGR+V9r+CTRoeaKaGKDmKUrPEVk=",
"requires": {
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
},
"turf-union": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-union/-/turf-union-3.0.12.tgz",
"integrity": "sha1-3+0OVUC4woVeSZTBRiHjpgyCnI4=",
"requires": {
"jsts": "1.1.2"
}
},
"turf-within": {
"version": "3.0.12",
"resolved": "https://registry.npmjs.org/turf-within/-/turf-within-3.0.12.tgz",
"integrity": "sha1-937q83cjhWG3+xM4526dEph0H5Q=",
"requires": {
"turf-helpers": "^3.0.12",
"turf-inside": "^3.0.12"
}
},
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
},
"two-product": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/two-product/-/two-product-1.0.2.tgz",
"integrity": "sha1-Z9ldSyV6kh4stL16+VEfkIhSLqo="
},
"two-sum": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/two-sum/-/two-sum-1.0.0.tgz",
"integrity": "sha1-MdPzIjnk9zHsqd+RVeKyl/AIq2Q="
},
"type-check": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
@ -10176,6 +10778,11 @@
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.11.0.tgz",
"integrity": "sha512-xY96SsN3NA461qIRKZ/+qox37YXPtSBswMGfiNptr+wrt6ds4HaMw23TP612fEyGekRE6LNRiLYr/aqbHXNedw=="
},
"union-find": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/union-find/-/union-find-1.0.2.tgz",
"integrity": "sha1-KSusQV5q06iVNdI3AQ20pTYoTlg="
},
"union-value": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
@ -10473,6 +11080,11 @@
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz",
"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="
},
"wgs84": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/wgs84/-/wgs84-0.0.0.tgz",
"integrity": "sha1-NP3FVZF7blfPKigu0ENxDASc3HY="
},
"whatwg-encoding": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz",

View file

@ -46,6 +46,7 @@
"passport-local": "1.0.0",
"request": "2.88.2",
"slug": "^3.3.5",
"turf": "^3.0.14",
"underscore": "^1.11.0"
},
"devDependencies": {

View file

@ -1,11 +1,14 @@
const mongoose = require('mongoose');
const uniqueValidator = require('mongoose-unique-validator');
const turf = require('turf');
const schema = new mongoose.Schema(
{
slug: { type: String, lowercase: true, unique: true },
numEvents: { type: Number, default: 0 },
recordedAt: { type: Date },
recordedUntil: { type: Date },
trackLength: { type: Number },
points: [
{
date: String,
@ -33,6 +36,8 @@ schema.pre('validate', function (next) {
next();
});
schema.set('toJSON', { virtuals: true });
class TrackData extends mongoose.Model {
slugify() {
this.slug = 'td-' + String((Math.random() * Math.pow(36, 6)) | 0).toString(36);
@ -42,14 +47,16 @@ class TrackData extends mongoose.Model {
return this.points.filter((p) => p.flag).length;
}
getRecoredAt() {
const firstPointWithDate = this.points.find((p) => p.date && p.time);
if (!firstPointWithDate) {
getRecoredAt(findEnd = false) {
const pointsWithDate = this.points.filter((p) => p.date && p.time);
if (!pointsWithDate.length) {
return null;
}
const [day, month, year] = firstPointWithDate.date.split('.');
const combinedString = `${year}-${month}-${day} ${firstPointWithDate.time}.000+2000`;
const point = pointsWithDate[findEnd ? pointsWithDate.length - 1 : 0];
const [day, month, year] = point.date.split('.');
const combinedString = `${year}-${month}-${day} ${point.time}.000+2000`;
const parsedDate = new Date(combinedString);
if (isNaN(parsedDate.getDate())) {
return null;
@ -63,8 +70,54 @@ class TrackData extends mongoose.Model {
trackData.points = points;
trackData.numEvents = trackData.countEvents();
trackData.recordedAt = trackData.getRecoredAt();
trackData.recordedUntil = trackData.getRecoredAt(true);
trackData.trackLength = trackData.measureTrackLength();
return trackData;
}
measureTrackLength() {
let totalLength = 0;
for (const [a, b] of pairwise(map(this.points, (p) => turf.point([p.longitude, p.latitude])))) {
const legLengthMeters = turf.distance(a, b) * 1000;
totalLength += legLengthMeters;
}
return totalLength;
}
get duration() {
if (this.recordedAt == null || this.recordedUntil == null) {
return null;
}
return (this.recordedUntil.getTime() - this.recordedAt.getTime()) / 1000;
}
}
function* pairwise(iter) {
let last;
let firstLoop = true;
for (const it of iter) {
if (firstLoop) {
firstLoop = false;
} else {
yield [last, it];
}
last = it;
}
}
function* enumerate(iter) {
let i = 0;
for (const it of iter) {
yield [i, it];
i++;
}
}
function* map(iter, fn) {
for (const [i, it] of enumerate(iter)) {
yield fn(it, i);
}
}
mongoose.model(TrackData, schema);