Mercurial > lbo > hg > geohub
changeset 131:7ae1dc586805
gpsd: record accuracy and use correct units
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Thu, 06 May 2021 12:08:28 +0200 |
parents | f45e9d1ad13c |
children | c2efa052fb50 |
files | examples/gpsd/gpsd.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/gpsd/gpsd.py Thu May 06 07:17:29 2021 +0000 +++ b/examples/gpsd/gpsd.py Thu May 06 12:08:28 2021 +0200 @@ -16,9 +16,9 @@ def send_point(sess, args, info: dict[str, str]): geohub_templ = args.geohub + '/{CLIENT}/log?secret={SECRET}' - geohub_url = geohub_templ.format(HOST=args.geohub_host, CLIENT=args.client or info.get('tzn', 'TRAIN'), SECRET=args.secret, PROTOCOL=args.geohub_scheme) - additional = '&lat={lat}&longitude={long}&s={spd}&time={ts}'.format( - lat=info['lat'], long=info['lon'], spd=info['speed'], ts=info['time']) + geohub_url = geohub_templ.format(HOST=args.geohub_host, CLIENT=args.client, SECRET=args.secret, PROTOCOL=args.geohub_scheme) + additional = '&lat={lat}&longitude={long}&s={spd}&time={ts}&unit=ms&accuracy={acc}'.format( + lat=info['lat'], long=info['lon'], spd=info['speed'], ts=info['time'], acc=sqrt(info['epx']**2+info['epy']**2)) # Delete unnecessary data. url = geohub_url + additional return sess.post(url, data="")