Jump to content

Calculating Flight Paths


PyraX

Recommended Posts

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

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.