Friday, October 29, 2010

Great circle routes

In late March, my company informed me I had to travel to the US. They asked me to get all required stuff ready. By the time my visa was ready and I was able to book tickets, it was already the third week of April. It looked like I could book tickets for any day from the 4th week of April or the 1st week of May only.

On April 14th, the Eyjafjallajökull volcano exploded.

As you probably know, all airline schedules went haywire. However, I was not worried much. After all, the volcano was in Iceland, and the affected areas were mostly in Europe. Surely, my flight to the US wouldn't be travelling over Europe!! Why should it? When travelling from India to the US, I thought, my flight would probably take the Saudi Arabia - Egypt - Algeria - Atlantic Ocean - US route, wouldn't it? After all, when you have a map of the world in front of you, that seems to be the most straight and efficient route. A map of the route I thought my flight would take is shown below:



Of course, if the ash cloud grew to the extent where it began to intrude into North Africa, then I would have some problems - but I thought I would think about what to do if it ever came to that.

By the time I was ready to book my tickets, the situation had eased a little - flights were allowed so long as they flew via routes where the ash was less concentrated. When I went to the travel desk, I was told there were no bookings being done, as all flights were cancelled. I was somewhat surprised and reminded the travel desk that flights were being allowed up in the air. The travel desk replied that though flights were being allowed, the airlines were concentrating on clearing the backlog of passengers first. I reported this to my manager, who told me that as my travel was urgent, I would have to get tickets somehow.

I went back to the travel desk. "I need a ticket to the US".

"No sir... as we already said, the airlines are not accepting bookings. They are only trying to clear the backlog".

"Ok... which route are you considering?"

The lady mentioned some routes via Europe and the Middle East. I understood it was impossible via Europe as that was the most affected area, but why were there no tickets for routes via Middle East?

Me: "Can't you book on the Chennai - Singapore - US route?" I was thinking Singapore to US would probably fly Phillippines - Pacific Ocean - US, which meant that they would avoid the ash cloud.

"No sir... no bookings".

Confused, I tried to be even more clear. I said, "No.. I mean the Chennai - Singapore - Tokyo - US route. Surely, there should be some tickets there!!"

"No sir... bookings not allowed".

Even more confused now, I asked the lady why bookings were not allowed on that route. Surely the ash cloud was not affecting those areas!!

"I don't know sir... but bookings are not allowed".

Not wanting to argue any further, I reported this to my manager. There followed a long series of trips to and from the travel desk, trying desperately to book a ticket ASAP. Every day was spent with me atleast visiting them once, and in some cases twice. No change. Another manager suggested booking on the India - Johannesburg - US route, which the lady frowned upon. In between I learnt that my company had an upper limit on the total cost of a ticket booking, which meant that some routes were effectively removed from consideration.

Finally, after one or two weeks, my tickets were confirmed. My route was Chennai - Doha - Washington by Qatar Airways - a hop through the Middle East. I wondered why this ticket was not available earlier.




With packing and other travel-related work, this issue went to the back of my mind. Finally, the day came, and I boarded the Qatar flight to Doha. The 5-hour journey was uneventful and I landed in Doha. Two hours later, I boarded my Doha - Washington flight.

Once settled into my seat, I looked around and noticed that this plane had TV screens behind each seat, and at the beginning of every passenger section. These were showing the route we would take and the route shown was this:


(Note: The route shown here is not the exact route my flight took. Though it has been a few months since my flight, I do remember the route going over Finland as well as Iceland and Greenland. But you do get the general idea).

Hello?

I didn't believe it at first!! Surely this must be a mistake. The flight was not going to travel over the Mediterranean Sea or North Africa. This meant that the flight was taking a roundabout route. I immediately rejected what the display was showing and thought to myself to note what route the plane actually took.

We departed. As I had a meeting the day after I landed in the US, I had planned to have naps during the flight to avoid jet lag as much as possible. I had a short nap. Lunch was served. All along, I kept watching the display. The flight took the route shown before. I thought at some point, the flight would turn and go on the route I had thought it would take, but no, the flight kept going on and on on the route shown, until many hours later, I reconciled myself to the fact that the flight was not going to change direction.

I was angry - I shall accept it. I was needlessly being kept in a flight for 14 hours when a shorter direct route existed, one that would take lesser time. But I soon realized I could be mistaken. No pilot would do that; he could be reprimanded by the airlines. I also knew that sometimes flight plans were generally prepared by somebody other than the pilot, and if that somebody had prepared this route, the pilot would want to know why. Also controllers on the ground would want to know why the flight was taking this route. And more important, I remembered reading somewhere that flight fuel costs alone were a significant percentage of an airline company's expenses - no pilot would be foolish enough to run a route longer than the shortest one, unless there were reasons. To top it all, this was my first international flight, and there was always a possibility that I might not know something.

In short, everything was loaded against me. If my thoughts about the flight's route were right, then it had to be a very very exceptional case, and I would hear about it on landing; otherwise, I was surely wrong. I suspected the latter.

Realization dawned somewhere over the Atlantic, I guess.

Great circle


The initial route I had arrived at (Chennai - Saudi Arabia - Egypt - Algeria - Atlantic Ocean - US) had been based on a paper map of the world. I had plotted the most direct route if the Earth had been flat, as shown on a paper map. But the Earth is not flat - it is a sphere, which means that Doha and Washington were on opposite sides of the Earth. On this spherical image of the Earth, my expected route would look like this:



Adding the route my flight actually took to the above map makes it look like this:



Clearly, the actual route is a straight line, rather than the one I initially thought of, which is curved, and travels a greater distance. And we all know from our geometry class that a straight line is the shortest distance between any two points. Note the route taken - it passes over Europe, crosses the Atlantic Ocean and enters North America over Canada, which is also the route my flight roughly took.

So yes, I was wrong and the flight route taken was the shortest one. But if my new understanding was right, then it had to be documented somewhere. A search on Google/Wikipedia should reveal whether I was right. And yes, Wikipedia has an article on it. Such routes are known as "great circle routes", since the shortest line joining any two points on a sphere is known as a great circle in geometry. A great circle on a sphere is equivalent to a straight line in linear geometry.

Good.. my flight was like this. How about other flights? For example, Europe to America. Let us take Frankfurt - Washington since we have a Chennai - Frankfurt flight and there is a chance I could have flown on it.



Great circle again!!

Ohkay, now how about Singapore - Washington? Does it also take a great circle route?



Aha, it does!! So this is the reason why the travel desk could not book on this flight. Probably, this flight too was cancelled!!

Interestingly, this flight seems to pass right over the North Pole. That should be exciting - imagine sitting on an airplane, having your lunch and looking at the display in front of you, which says you are flying over the North Pole. How thrilling would that be? In fact, while there is no flight between Singapore and Washington currently, we do have a Singapore - New York flight operated by Singapore Airlines, and it passes a few miles close to the North Pole. (see here for proof).

Interesting, but does this work for flights in the Southern Hemisphere too? Let us take a flight from Sao Paulo (Brazil) to Sydney (Australia).



Woo... the flight passes over Antarctica!!

Update (11th Feb 2011): So the lesson here is that if you have a flight that flies between two cities that lie in the same hemisphere, then the flight route is plotted as a great sphere route (assuming the weather is fine along the route. Otherwise, there would be deviations). Note the text in bold - lie in the same hemisphere. Why should the cities lie in the same hemisphere? Do flights travelling between cities across the Equator not have to travel via great circle routes? Yes they do have to travel along great circle routes, but that would roughly approximate the route you would draw on a paper map.

Nope, I shall put up my finger and accept that I was wrong in that last paragraph. I had assumed that flights that cross the Equator would more or less follow the straight line you drew between the two cities on a flat Earth. I guess I made this assumption on the fact that the route between Doha and Sao Paulo is like this:



which is erm... roughly a straight line..

Unhappily, just this example is not enough to argue that trans-equatorial flights do not fly on great circle routes, or to argue that their routes are roughly equivalent to straight lines. One example is enough - London to Sydney. I expected the route to be somewhat like this:



But in reality the route turns out to be this:



Why is this so? Again, the route I expected to see is because my mind still thinks of the world as a flat paper map. But of course the Earth is not flat, which means that the route you would get is the second one. Here is how the route would look if we had rightly visualized the Earth as a sphere in our minds:




So the lesson here is to think of the Earth as a sphere when mapping flight routes between two points, wherever those two points may be and whatever the distance between them!!

(All flight routes generated by the excellent flight route mapping website, Great Circle Mapper).

UPDATE (16th Dec 2012): Another proof of this is FlightRadar24, a website that shows flights travelling across the globe in realtime. You can see for yourselves the routes flights take.

Thursday, April 15, 2010

Code

I have been coding professionally for the past 5 years, and coding small projects at home, but only in the last year have I realized the benefits of having a public repository of my code. Having heard a lot about jQuery, Struts 2 and Ruby and having wanted to learn them, I started a small Minesweeper project on the side to learn these technologies. I also hosted the app on Google Code.

The app is hosted here. I won't say I am very great at coding (though I am following various ways to improve) and hence praise and criticism of my code is welcome.

Right now, it uses Struts 2 and jQuery. I have not yet started on the Ruby/RoR part. Hopefully, that day should come soon...

UPDATE (20th Aug 2012): The Java app is feature complete long ago (sometime in 2010 itself). Work continues on the Ruby app along with my other side projects, apart from official work and life.