简体   繁体   中英

Is there any pre implemented routing algorithm that I can use to find the shortest path between 2 airports using waypoints as nodes

What I need is a pre implemented routing algorithm that finds the shortest route between 2 airports with nodes as waypoint. The airports and waypoints are saved as a JSON files with lang and lat information. Once the shortest path is calculated the path is shown on google maps api as markers. I have a json file with approximately 30000 waypoints across europe and asia as well as the airports for europe and asia. PS this is needed for my final year computer science project.

Does anyone know if a template algorithm exists in php or js to help sort this problem.

write a function that calculates the distance between 2 waypoints based on lon/lat (shouldn't be too hard) and convert the json into a graph (eg a 2X2 matrix with the i,j entree being the distance between waypoint i and j (0 in case no way) - than all you need to do is run Dijkstra (make sure your algorithm returns the set of nodes in the shortest path and not only the distance).

Note: Dijkstra algorithm assumes no negative values for edges, which I believe is the case here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM