summaryrefslogtreecommitdiff
path: root/gegps
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2017-12-01 16:33:32 -0800
committerGary E. Miller <gem@rellim.com>2017-12-01 16:33:32 -0800
commitdfb3e24b4ce759ccdad2e0d0597e3fe5d3f1389f (patch)
tree9aa85de161ff3a98acf748aa49502135db55aac5 /gegps
parentabb0c2d3159e95a4289ab2f08ffc0c8fe1383143 (diff)
downloadgpsd-dfb3e24b4ce759ccdad2e0d0597e3fe5d3f1389f.tar.gz
gegps: Not all TPV has heading.
Heading can be missing on gpsd startup.
Diffstat (limited to 'gegps')
-rwxr-xr-xgegps9
1 files changed, 5 insertions, 4 deletions
diff --git a/gegps b/gegps
index 28798ce2..ae4956ac 100755
--- a/gegps
+++ b/gegps
@@ -58,7 +58,11 @@ def kmlize(tpv):
else:
speed = 0
- heading = int(round(tpv['track'], 0))
+ # not all TPV includes heading, like when acquiring fix
+ if speed >= 1 and 'track' in tpv:
+ heading = int(round(tpv['track'], 0))
+ else:
+ heading = 0
# not all TPV includes altitude
# like ublox8 in fixed position (time) mode
@@ -67,9 +71,6 @@ def kmlize(tpv):
else:
altitude = 0
- if speed < 1:
- heading = 0
-
return """<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>