Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elevation gain/loss #132

Open
jpmens opened this issue Nov 11, 2024 · 3 comments
Open

Elevation gain/loss #132

jpmens opened this issue Nov 11, 2024 · 3 comments
Labels
Priority: High Do it soon Type: Bug Something isn't working

Comments

@jpmens
Copy link
Member

jpmens commented Nov 11, 2024

I think there's a bug in Frontend which was initially mentioned in #129: the calculation of elevation gain/loss is wrong.

The data hereunder is for this portion of the map in which Frontend says +794m and - 899m

rabbit-11458

This is a route taken with one of our qtripp devices which reports OwnTracks data. The data is obtained with the Recorder API:

$ curl -sSf 'http://127.0.0.1:8083/api/0/locations?from=2024-11-09T10%3A00%3A00&to=2024-11-09T11%3A00%3A59&user=qtripp&device=redacted'| gron | egrep -v 'driver|plate|odometer|cid|count|din[12]|dout[12]|fake|ign|mcc|mnc|motion|rid|rit|rty|sen[st]|tow' | gron -u | jq . > data.json

data for the 252 positions attached in next comment.

$ gron data.json | grep alt | awk -F '[=;]' '{print $2 }' | sort -n
 23.4
...
 131.2

The Booklet specifies alt (altitude) is optional, but it appears as though a value of 0 is assumed if not available. In spite of that, there must be something else wrong, as this particular data set has an altitude on each position.

Frontend: 2.15.3
Recorder: 0.9.9
@jpmens jpmens added the Type: Bug Something isn't working label Nov 11, 2024
@jpmens
Copy link
Member Author

jpmens commented Nov 11, 2024

data.json

@linusg
Copy link
Member

linusg commented Nov 11, 2024

In spite of that, there must be something else wrong, as this particular data set has an altitude on each position.

That's not true:

>>> import json
>>> with open("data.json", encoding="utf-8") as f:
...     data = json.load(f)
...
>>> for d in data["data"]:
...     if "alt" not in d:
...         print(d)
...
{'_type': 'location', 'addr': 'A 30, 49082 Osnabrück, Germany', 'cc': 'DE', 'cog': 264, 'disptst': '2024-11-09 10:04:37', 'ghash': 'u1m9pqv', 'isolocal': '2024-11-09T11:04:37+0100', 'isorcv': '2024-11-09T10:04:37Z', 'isotst': '2024-11-09T10:04:37Z', 'lat': 52.244615, 'lon': 8.060427, 't': 'p', 'tid': '53', 'tst': 1731146677, 'vel': 84.2}
{'_type': 'location', 'addr': 'A 30, 49082 Osnabrück, Germany', 'cc': 'DE', 'cog': 264, 'disptst': '2024-11-09 10:04:37', 'ghash': 'u1m9pqv', 'isolocal': '2024-11-09T11:04:37+0100', 'isorcv': '2024-11-09T10:04:37Z', 'isotst': '2024-11-09T10:04:37Z', 'lat': 52.244615, 'lon': 8.060427, 't': 'p', 'tid': '53', 'tst': 1731146677, 'vel': 84.2}
{'_type': 'location', 'addr': 'A30, 49078 Osnabrück, Germany', 'cc': 'DE', 'cog': 264, 'disptst': '2024-11-09 10:09:40', 'ghash': 'u1m9me2', 'isolocal': '2024-11-09T11:09:40+0100', 'isorcv': '2024-11-09T10:09:40Z', 'isotst': '2024-11-09T10:09:40Z', 'lat': 52.268936, 'lon': 7.976264, 't': 'p', 'tid': '53', 'tst': 1731146980, 'vel': 83.8}
{'_type': 'location', 'addr': 'A30, 49078 Osnabrück, Germany', 'cc': 'DE', 'cog': 264, 'disptst': '2024-11-09 10:09:40', 'ghash': 'u1m9me2', 'isolocal': '2024-11-09T11:09:40+0100', 'isorcv': '2024-11-09T10:09:40Z', 'isotst': '2024-11-09T10:09:40Z', 'lat': 52.268936, 'lon': 7.976264, 't': 'p', 'tid': '53', 'tst': 1731146980, 'vel': 83.8}
{'_type': 'location', 'addr': 'A 1, 49504 Lotte, Germany', 'cc': 'DE', 'cog': 32, 'disptst': '2024-11-09 10:14:43', 'ghash': 'u1m9sgr', 'isolocal': '2024-11-09T11:14:43+0100', 'isorcv': '2024-11-09T10:14:43Z', 'isotst': '2024-11-09T10:14:43Z', 'lat': 52.314024, 'lon': 7.952775, 't': 'p', 'tid': '53', 'tst': 1731147283, 'vel': 123.1}
{'_type': 'location', 'addr': 'A 1, 49504 Lotte, Germany', 'cc': 'DE', 'cog': 32, 'disptst': '2024-11-09 10:14:43', 'ghash': 'u1m9sgr', 'isolocal': '2024-11-09T11:14:43+0100', 'isorcv': '2024-11-09T10:14:43Z', 'isotst': '2024-11-09T10:14:43Z', 'lat': 52.314024, 'lon': 7.952775, 't': 'p', 'tid': '53', 'tst': 1731147283, 'vel': 123.1}
{'_type': 'location', 'addr': 'Hansalinie, 49565 Bramsche, Germany', 'cc': 'DE', 'cog': 349, 'disptst': '2024-11-09 10:19:31', 'ghash': 'u1mdp00', 'isolocal': '2024-11-09T11:19:31+0100', 'isorcv': '2024-11-09T10:19:31Z', 'isotst': '2024-11-09T10:19:31Z', 'lat': 52.384118, 'lon': 8.042671, 't': 'p', 'tid': '53', 'tst': 1731147571, 'vel': 112.8}
{'_type': 'location', 'addr': 'Hansalinie, 49565 Bramsche, Germany', 'cc': 'DE', 'cog': 349, 'disptst': '2024-11-09 10:19:31', 'ghash': 'u1mdp00', 'isolocal': '2024-11-09T11:19:31+0100', 'isorcv': '2024-11-09T10:19:31Z', 'isotst': '2024-11-09T10:19:31Z', 'lat': 52.384118, 'lon': 8.042671, 't': 'p', 'tid': '53', 'tst': 1731147571, 'vel': 112.8}
{'_type': 'location', 'addr': 'A 1, 49597 Rieste, Germany', 'cc': 'DE', 'cog': 24, 'disptst': '2024-11-09 10:24:58', 'ghash': 'u1mdrpq', 'isolocal': '2024-11-09T11:24:58+0100', 'isorcv': '2024-11-09T10:24:58Z', 'isotst': '2024-11-09T10:24:58Z', 'lat': 52.466728, 'lon': 8.051433, 't': 'p', 'tid': '53', 'tst': 1731147898, 'vel': 102.5}
{'_type': 'location', 'addr': 'A 1, 49597 Rieste, Germany', 'cc': 'DE', 'cog': 24, 'disptst': '2024-11-09 10:24:58', 'ghash': 'u1mdrpq', 'isolocal': '2024-11-09T11:24:58+0100', 'isorcv': '2024-11-09T10:24:58Z', 'isotst': '2024-11-09T10:24:58Z', 'lat': 52.466728, 'lon': 8.051433, 't': 'p', 'tid': '53', 'tst': 1731147898, 'vel': 102.5}
{'_type': 'location', 'addr': 'A 1, 49434 Neuenkirchen-Vörden, Germany', 'cc': 'DE', 'cog': 26, 'disptst': '2024-11-09 10:29:28', 'ghash': 'u1mfb3x', 'isolocal': '2024-11-09T11:29:28+0100', 'isorcv': '2024-11-09T10:29:28Z', 'isotst': '2024-11-09T10:29:28Z', 'lat': 52.522921, 'lon': 8.106595, 't': 'p', 'tid': '53', 'tst': 1731148168, 'vel': 99.3}
{'_type': 'location', 'addr': 'A 1, 49434 Neuenkirchen-Vörden, Germany', 'cc': 'DE', 'cog': 26, 'disptst': '2024-11-09 10:29:28', 'ghash': 'u1mfb3x', 'isolocal': '2024-11-09T11:29:28+0100', 'isorcv': '2024-11-09T10:29:28Z', 'isotst': '2024-11-09T10:29:28Z', 'lat': 52.522921, 'lon': 8.106595, 't': 'p', 'tid': '53', 'tst': 1731148168, 'vel': 99.3}
{'_type': 'location', 'addr': 'A 1, 49451 Holdorf, Germany', 'cc': 'DE', 'cog': 16, 'disptst': '2024-11-09 10:34:28', 'ghash': 'u1mg0xh', 'isolocal': '2024-11-09T11:34:28+0100', 'isorcv': '2024-11-09T10:34:28Z', 'isotst': '2024-11-09T10:34:28Z', 'lat': 52.597233, 'lon': 8.113896, 't': 'p', 'tid': '53', 'tst': 1731148468, 'vel': 98.5}
{'_type': 'location', 'addr': 'A 1, 49451 Holdorf, Germany', 'cc': 'DE', 'cog': 16, 'disptst': '2024-11-09 10:34:28', 'ghash': 'u1mg0xh', 'isolocal': '2024-11-09T11:34:28+0100', 'isorcv': '2024-11-09T10:34:28Z', 'isotst': '2024-11-09T10:34:28Z', 'lat': 52.597233, 'lon': 8.113896, 't': 'p', 'tid': '53', 'tst': 1731148468, 'vel': 98.5}
{'_type': 'location', 'addr': 'Hansalinie, 49393 Lohne, Germany', 'cc': 'DE', 'cog': 14, 'disptst': '2024-11-09 10:39:37', 'ghash': 'u1mg9g7', 'isolocal': '2024-11-09T11:39:37+0100', 'isorcv': '2024-11-09T10:39:37Z', 'isotst': '2024-11-09T10:39:37Z', 'lat': 52.665668, 'lon': 8.167313, 't': 'p', 'tid': '53', 'tst': 1731148777, 'vel': 99.1}
{'_type': 'location', 'addr': 'Hansalinie, 49393 Lohne, Germany', 'cc': 'DE', 'cog': 14, 'disptst': '2024-11-09 10:39:37', 'ghash': 'u1mg9g7', 'isolocal': '2024-11-09T11:39:37+0100', 'isorcv': '2024-11-09T10:39:37Z', 'isotst': '2024-11-09T10:39:37Z', 'lat': 52.665668, 'lon': 8.167313, 't': 'p', 'tid': '53', 'tst': 1731148777, 'vel': 99.1}
{'_type': 'location', 'addr': 'A 1, 49456 Bakum, Germany', 'cc': 'DE', 'cog': 16, 'disptst': '2024-11-09 10:44:58', 'ghash': 'u1mu44u', 'isolocal': '2024-11-09T11:44:58+0100', 'isorcv': '2024-11-09T10:44:58Z', 'isotst': '2024-11-09T10:44:58Z', 'lat': 52.749719, 'lon': 8.1801, 't': 'p', 'tid': '53', 'tst': 1731149098, 'vel': 84.7}
{'_type': 'location', 'addr': 'A 1, 49456 Bakum, Germany', 'cc': 'DE', 'cog': 16, 'disptst': '2024-11-09 10:44:58', 'ghash': 'u1mu44u', 'isolocal': '2024-11-09T11:44:58+0100', 'isorcv': '2024-11-09T10:44:58Z', 'isotst': '2024-11-09T10:44:58Z', 'lat': 52.749719, 'lon': 8.1801, 't': 'p', 'tid': '53', 'tst': 1731149098, 'vel': 84.7}
{'_type': 'location', 'addr': 'Hansalinie, 49685 Emstek, Germany', 'cc': 'DE', 'cog': 9, 'disptst': '2024-11-09 10:49:43', 'ghash': 'u1mudbh', 'isolocal': '2024-11-09T11:49:43+0100', 'isorcv': '2024-11-09T10:49:43Z', 'isotst': '2024-11-09T10:49:43Z', 'lat': 52.823538, 'lon': 8.213636, 't': 'p', 'tid': '53', 'tst': 1731149383, 'vel': 118}
{'_type': 'location', 'addr': 'Hansalinie, 49685 Emstek, Germany', 'cc': 'DE', 'cog': 9, 'disptst': '2024-11-09 10:49:43', 'ghash': 'u1mudbh', 'isolocal': '2024-11-09T11:49:43+0100', 'isorcv': '2024-11-09T10:49:43Z', 'isotst': '2024-11-09T10:49:43Z', 'lat': 52.823538, 'lon': 8.213636, 't': 'p', 'tid': '53', 'tst': 1731149383, 'vel': 118}
{'_type': 'location', 'addr': 'A 1, 26197 Großenkneten, Germany', 'cc': 'DE', 'cog': 74, 'disptst': '2024-11-09 10:54:52', 'ghash': 'u1muugu', 'isolocal': '2024-11-09T11:54:52+0100', 'isorcv': '2024-11-09T10:54:52Z', 'isotst': '2024-11-09T10:54:52Z', 'lat': 52.88743, 'lon': 8.300847, 't': 'p', 'tid': '53', 'tst': 1731149692, 'vel': 110}
{'_type': 'location', 'addr': 'A 1, 26197 Großenkneten, Germany', 'cc': 'DE', 'cog': 74, 'disptst': '2024-11-09 10:54:52', 'ghash': 'u1muugu', 'isolocal': '2024-11-09T11:54:52+0100', 'isorcv': '2024-11-09T10:54:52Z', 'isotst': '2024-11-09T10:54:52Z', 'lat': 52.88743, 'lon': 8.300847, 't': 'p', 'tid': '53', 'tst': 1731149692, 'vel': 110}
{'_type': 'location', 'addr': 'A 1, 27801 Dötlingen, Germany', 'cc': 'DE', 'cog': 88, 'disptst': '2024-11-09 10:59:22', 'ghash': 'u1mvp8b', 'isolocal': '2024-11-09T11:59:22+0100', 'isorcv': '2024-11-09T10:59:22Z', 'isotst': '2024-11-09T10:59:22Z', 'lat': 52.914294, 'lon': 8.41605, 't': 'p', 'tid': '53', 'tst': 1731149962, 'vel': 91.5}
{'_type': 'location', 'addr': 'A 1, 27801 Dötlingen, Germany', 'cc': 'DE', 'cog': 88, 'disptst': '2024-11-09 10:59:22', 'ghash': 'u1mvp8b', 'isolocal': '2024-11-09T11:59:22+0100', 'isorcv': '2024-11-09T10:59:22Z', 'isotst': '2024-11-09T10:59:22Z', 'lat': 52.914294, 'lon': 8.41605, 't': 'p', 'tid': '53', 'tst': 1731149962, 'vel': 91.5}

...so I assume including the fallback to 0 in the calculations is the issue here. Will look into fixing this, thanks for the detailed report :)

@linusg linusg added the Priority: High Do it soon label Nov 11, 2024
@jpmens
Copy link
Member Author

jpmens commented Nov 11, 2024

has an altitude on each position

is indeed untrue; it wasn't my intention to give alternate facts. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High Do it soon Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants