PyraX Posted October 11, 2010 Share Posted October 11, 2010 Hey everyone, Im writing some code that has to work out a route based on linking airports and output all the flights it takes to get there, tried searching just dont really know what to search for The data table looks like this ID, Origin, Destination, DatetimeDeparting, DatetimeArriving, Price 1, BKK, CNX, 2010-10-14 12:00:00, 2010-10-14 14:00:00, 125 2, STN, BKK, 2010-10-13 18:00:00, 2010-10-13 22:00:00, 300 etc. What is the easiest way of working out the path from STN to CNX via BKK? UPDATE: Just to make it more interesting there will be instances where there is more than 1 path eg. STN -> KUL -> BKK -> CNX Quote Link to comment https://forums.phpfreaks.com/topic/215608-calculating-flight-paths/ Share on other sites More sharing options...
Adam Posted October 11, 2010 Share Posted October 11, 2010 First you need to define where these places are, most likely by assigning each a longitude and latitude value. Then based on those values you'll need to use some advanced mathematics to work out the distance, position, etc. from one another. Then perhaps the GD library to create a visual display of the route, based on the figures you calculated. The Google Maps API may make things easier for you here though.. Quote Link to comment https://forums.phpfreaks.com/topic/215608-calculating-flight-paths/#findComment-1121024 Share on other sites More sharing options...
PyraX Posted October 11, 2010 Author Share Posted October 11, 2010 Thanks adam, the only thing that matters is the price and the time, distance is irrelevant Quote Link to comment https://forums.phpfreaks.com/topic/215608-calculating-flight-paths/#findComment-1121030 Share on other sites More sharing options...
Adam Posted October 11, 2010 Share Posted October 11, 2010 Ah right, sorry I think I misunderstood what it was you were asking. So you mean using the available flights, you need to plan a route (obviously with minimal time between flights) to get from one destination to another? Quote Link to comment https://forums.phpfreaks.com/topic/215608-calculating-flight-paths/#findComment-1121031 Share on other sites More sharing options...
PyraX Posted October 11, 2010 Author Share Posted October 11, 2010 Yes thats right, cheapest cost first then shortest time Quote Link to comment https://forums.phpfreaks.com/topic/215608-calculating-flight-paths/#findComment-1121032 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.