Python 航空路线查找器

Python route finder for aviation

我制作了一个应用程序,除了所有其他功能外,它还试图在 2 个机场之间找到一条有效路线。 我在 sqlite3 数据库中拥有所有必需的数据 我在 PyQt5 中嵌入的底图中查询并绘制实时信号。 我的问题是我找不到算法来做出所有可能的变化(取消一些,因为所有的可能性都是巨大的)并存储它们以输出最终的有效路线。 Dijkstra 的算法我认为无法实施,因为任何时候路线都可能到达死胡同。

我的主要问题是算法及其实现,而不是数据,所以不要犹豫,写下任何可能的算法所需的任何数据。

算法提示是:

  1. 我有一个起点。
  2. 我找到了所有包含这个起点的路线(取消对向标题的资格)(每条路线都有不同的waypoints)。
  3. 为每条路线寻找下一个航路点。
  4. 现在这个航路点可以连接到其他路线等等。
  5. 路线然后通过各种变体或到达死胡同进行测试和怀疑。
  6. 继续,直到到达最终(目标航路点)。
  7. 输出以某种方式存储的路线

到目前为止我得到的堆栈问题:

##finding base direction##
base_radians = math.atan2(self.dest_coord[0]-self.dep_coord[0], self.dest_coord[1]-self.dep_coord[1])
base_degrees = math.degrees(base_radians)
print(base_degrees)
if base_degrees < 0 :
    base_heading = 'W'
else:
    base_heading = 'E'
### finding all routes connected to first waypoint###
self.cursor.execute("select DISTINCT ats_ident,seq_num from dafif_ats where wpt1_ident = ? AND ats_icao = ? AND direction = ? ORDER BY ats_ident,seq_num ASC",('ATV','LGGG',base_heading))
sub_ats_idents = self.cursor.fetchall()
#### for each route find next waypoints###       
for i in sub_ats_idents:
    self.cursor.execute("select wpt1_ident,wpt2_ident from dafif_ats where ats_ident = ? and ats_icao = ?  and direction = ? and seq_num >= ? ORDER BY seq_num ASC",(i[0],'LGGG',base_heading,i[1]))
    each_wpt_combo = self.cursor.fetchall()
    #### for each next waypoint find possible routes###   
    for x in each_wpt_combo:
        self.cursor.execute("select DISTINCT ats_ident,seq_num from dafif_ats where wpt1_ident = ? AND ats_icao = ? AND direction = ? ORDER BY ats_ident,seq_num ASC",(x[0],'LGGG',base_heading))
        each_ats = self.cursor.fetchall()
        print(each_ats)
        #### for each subroute plot waypoints###   
        for z in each_ats:
            self.cursor.execute("select wpt1_dlon,wpt1_dlat,wpt2_dlon,wpt2_dlat from dafif_ats where wpt1_ident = ? AND ats_icao = ? AND direction = ? ORDER BY ats_ident,seq_num ASC",(x[0],'LGGG',base_heading))
            plot_var = self.cursor.fetchall()
            self.route_sender.emit(plot_var)
            time.sleep(0.1)

任何material或示例阅读都将是超级的。 提前致谢。

对于未来的读者,具有层次结构的 A* 算法是解决这类问题的方法。