下面我问你这个问题: 这段代码:
from ogn.client import AprsClient
from ogn.parser import parse, ParseError
def inRange_square(s, minLat, maxLat, minLon, maxLon, minAlt, maxAlt):
if s.get('longitude', 0) < minLon or s['longitude'] > maxLon or s['latitude'] < minLat or s['latitude']>maxLat or s['altitude']<minAlt or s['altitude']>maxAlt :
return False
return True
def processPlane(plane):
if(inRange_square(plane, 46.1368, 46.1796, 8.8374, 8.9057, 210, 1000)):
#if(inRange_square(plane, 46.127356, 46.441491, 9.276551, 8.460816, 210, 1000)):
print("The plane is in range")
print(plane.get**('name')**, plane.get('ground_speed'), plane.get('altitude'))
#print('Received {raw_message}'.format(**beacon))
else:
#print("The plane is not in range,")
'odd'
def process_beacon(raw_message):
try:
beacon = parse(raw_message)
#print('Received {raw_message}'.format(**beacon))
processPlane(beacon)
except ParseError as e:
#print('Error, {}'.format(e.message))
print( raw_message )
client = AprsClient(aprs_user='N0CALL')
client.connect()
try:
client.run(callback=process_beacon, autoreconnect=True)
except KeyboardInterrupt:
print('\nStop ogn gateway')
client.disconnect()
显示与此数据库中“设备类型”相对应的标识符(名称)
#DEVICE_TYPE,DEVICE_ID,AIRCRAFT_MODEL,**REGISTRATION**,CN,TRACKED,IDENTIFIED
'F','000000','HPH 304CZ-17','OK-7777','KN','Y','Y'
'O','000001','Paraglider','','','Y','Y'
'F','000002','LS-6 18','OY-XRG','G2','Y','Y'
'F','00000D','Ka-8','D-1749','W5','Y','Y'
'O','000015','Paraglider','36445','','Y','Y'
'F','000038','SF-25','F-CKBC','','Y','Y'
'F','0000FD','Taurus','F-JRDN','DN','Y','Y'
'F','000114','','','','N','N'
'F','000146','Paraglider','antwilk','','Y','Y'
'F','000287','Paraglider','32712','','Y','Y'
'F','000296','Unknown','D-IEST','','Y','Y'
'F','000338','Unknown','','','Y','Y'
'F','000368','PIK-20 B','C-GORE','GP','Y','Y'
'F','000503','SZD-48-1 Jantar Std 2','SP-3152','DG','Y','Y'
'F','000597','LS-6','D-8997','IV','Y','Y'
'F','000617','ASW-20','OE-5292','A2','Y','Y'
'F','000634','Ultralight','D-MJPH','','Y','Y'
我想要的程序是用数据库中的航空缩写REGISTRATION替换名称标识符。
我搜索了Internet /论坛,但是我不知道该怎么做,实际上我什么也找不到。 非常感谢您的帮助