Browse Source

Fix/Handle "gnd" being returned as blank

single
Jxck-S 4 years ago
parent
commit
c10cbf8f4e
  1. 11
      defADSBX.py

11
defADSBX.py

@ -23,9 +23,14 @@ def pullADSBX(icao):
ac = data['ac']
if ac != None:
ac_dict = ac[0]
plane_Dict = {'icao' : ac_dict['icao'], 'callsign' : ac_dict['call'], 'reg' : ac_dict['reg'], 'latitude' : float(ac_dict['lat']), 'longitude' : float(ac_dict['lon']), 'geo_alt_ft' : int(ac_dict['galt']), 'on_ground' : bool(int(ac_dict["gnd"]))}
if plane_Dict['on_ground']:
plane_Dict['geo_alt_ft'] = 0
if ac_dict["gnd"] == 0 or 1:
plane_Dict = {'icao' : ac_dict['icao'], 'callsign' : ac_dict['call'], 'reg' : ac_dict['reg'], 'latitude' : float(ac_dict['lat']), 'longitude' : float(ac_dict['lon']), 'geo_alt_ft' : int(ac_dict['galt']), 'on_ground' : bool(int(ac_dict["gnd"]))}
if plane_Dict['on_ground']:
plane_Dict['geo_alt_ft'] = 0
else:
plane_Dict = None
failed = True
print("Got data but on_ground is invalid!")
else:
plane_Dict = None

Loading…
Cancel
Save