Changing Gpx and Trkpt indexes so that GPX are sorted by datetime desc and Trkpt use their timestamp as indexes.

This commit is contained in:
vdv committed 2022-12-10 18:31:51 +01:00
1 parent be72adce05
commit 86a8c823f1
4 files changed
+25 -10

No files matched your search

+7 -3
View File
@@ -1,4 +1,4 @@
import route from './docuri';
import route from './docuri';
const integerType = (n: number) => {
return {
@@ -21,7 +21,7 @@ const coding = {
rtept: integerType(6),
trk: integerType(6),
trkseg: integerType(6),
trkpt: integerType(6),
trkpt: integerType(16),
};
const routes = {
@@ -47,5 +47,9 @@ export default uri;
const minDate = -8640000000000000;
const halfMinDate = minDate / 2;
const maxDate = 8640000000000000;
const halfMaxDate = maxDate / 2;
export const intToGpxId = (i: number) => Math.round(i / 2) - halfMinDate;
export const intToGpxId = (i: number) => halfMaxDate - Math.round(i / 2);
export const intToTrkptId = (i: number) => Math.round(i / 2) - halfMinDate;