tkuester / taky

A simple python TAK server
MIT License
188 stars 43 forks source link

Track course does not work with , instead of . as delimiter. #45

Closed skadakar closed 2 years ago

skadakar commented 2 years ago

ERROR:

2021-10-22T18:23:01.218193080Z DEBUG:TAKClient:Unable to parse Event: Issue parsing detail
2021-10-22T18:23:01.218252300Z Traceback (most recent call last):
2021-10-22T18:23:01.218285562Z   File "/usr/local/lib/python3.8/dist-packages/taky/cot/models/event.py", line 83, in from_elm
2021-10-22T18:23:01.218293282Z     ret.detail = TAKUser.from_elm(child, uid=ret.uid)
2021-10-22T18:23:01.218298916Z   File "/usr/local/lib/python3.8/dist-packages/taky/cot/models/takuser.py", line 91, in from_elm
2021-10-22T18:23:01.218305460Z     ret.course = float(d_elm.get("course"))
2021-10-22T18:23:01.218311084Z ValueError: could not convert string to float: '0,00000000'
2021-10-22T18:23:01.218317237Z
2021-10-22T18:23:01.218322642Z The above exception was the direct cause of the following exception:
2021-10-22T18:23:01.218328812Z
2021-10-22T18:23:01.218334175Z Traceback (most recent call last):
2021-10-22T18:23:01.218339612Z   File "/usr/local/lib/python3.8/dist-packages/taky/cot/client.py", line 123, in feed
2021-10-22T18:23:01.218345562Z     evt = models.Event.from_elm(elm)
2021-10-22T18:23:01.218351656Z   File "/usr/local/lib/python3.8/dist-packages/taky/cot/models/event.py", line 89, in from_elm
2021-10-22T18:23:01.218357853Z     raise UnmarshalError(f"Issue parsing {child.tag}") from exc
2021-10-22T18:23:01.218363717Z taky.cot.models.errors.UnmarshalError: Issue parsing detail

COT part that creates the problem: <track course="0,00000000" speed="0,00000000"/>

skadakar commented 2 years ago

This is a wintak specific issue and can be solved by changing your windows installation to use English language instead of your local language. Might not be worth spending time on, but it's still a issue I think one should survive. Maybe fire off a message informing the user.

tkuester commented 2 years ago

So I did a little bit of research on this. According to this[1], it seems that GPS coordinates should use a period for the decimal place, regardless of locale. This would indicate that the bug is with WinTAK -- though I'm not sure where to file a bug report.

I could add some special logic to handle this edge case, but I'm rather hesitant, as it's a little complicated to handle correctly, and I'd prefer to keep the codebase simple.

In the future, one of the features I'm looking to add is a plugin framework that can execute pre-processing on the incoming data. A plugin could be written to look for (and correct) locale specific separator formats. I think that is the best place for such a feature to go.

For now, though... are you and your users able to work around this ok? If not, I can provide you a little patch, if you'd like to run your own fork until the plugin framework is established!

1 - https://ux.stackexchange.com/questions/85702/localizing-coordinates

pinztrek commented 2 years ago

Just a validating opinion, I view this as a client issue and not something that taky should try to solve. GPS coordinate should not use localized decimal indicators.