Today we will have a look at a very interesting polyline example - "The geodesic polyline". Now the first question that will pop is "What is geodesic?". Mathematically, geodesic means the shortest line between two points on a mathematically defined surface, as a straight line on a plain or an arc of a great circle or sphere.

The next question after reading the above definition is clearly, "Why do we need geodesic polylines?" and that would be followed up with "What is this Great Circle?". We will discuss this first, before we move on to the actual example today. The example is very very similar to the normal polyline example, with just a small change.

Having said so, I will now try to explain why we need a geodesic polyline? The shortest distance between two locations on the earth is rarely a straight line as the earth is roughly spherical in nature. So any two points on the earth, even if they are very close lie on a curve and not a straight line. Because of this fact, we need a geodesic (curved) polyline and not just a simple planer one.

Once we understand the need of the geodesic polylines, the next question to be answered is that of the Great circle. A Great Circle is the intersection of the sphere and a plane which passes through the centre point of the sphere. As a result, the diameter of the great circle is always the same as the diameter of the sphere. So all the 'n' great circles of a sphere have the same diameter and centre as that of the sphere and all great circles have the same circumference. Thus for any two points on the surface of a sphere there is a great circle through the two points. The minor arc of a great circle between two points is the shortest surface-path between them. In this sense the minor arc is analogous to “straight lines” in spherical geometry. The length of the minor arc of great circle is taken as the distance of two points on a surface of a sphere, namely great-circle distance. The great circles are the geodesics of the sphere.The following picture will help you understand better the concept of the Great Circle.

The next question after reading the above definition is clearly, "Why do we need geodesic polylines?" and that would be followed up with "What is this Great Circle?". We will discuss this first, before we move on to the actual example today. The example is very very similar to the normal polyline example, with just a small change.

Having said so, I will now try to explain why we need a geodesic polyline? The shortest distance between two locations on the earth is rarely a straight line as the earth is roughly spherical in nature. So any two points on the earth, even if they are very close lie on a curve and not a straight line. Because of this fact, we need a geodesic (curved) polyline and not just a simple planer one.

Once we understand the need of the geodesic polylines, the next question to be answered is that of the Great circle. A Great Circle is the intersection of the sphere and a plane which passes through the centre point of the sphere. As a result, the diameter of the great circle is always the same as the diameter of the sphere. So all the 'n' great circles of a sphere have the same diameter and centre as that of the sphere and all great circles have the same circumference. Thus for any two points on the surface of a sphere there is a great circle through the two points. The minor arc of a great circle between two points is the shortest surface-path between them. In this sense the minor arc is analogous to “straight lines” in spherical geometry. The length of the minor arc of great circle is taken as the distance of two points on a surface of a sphere, namely great-circle distance. The great circles are the geodesics of the sphere.The following picture will help you understand better the concept of the Great Circle.

You can also have a look at an excellent animation explaining the "Great Circle" concept. Now that the theory is clear, let's get our hands dirty with a simple example...Here's the code...

The output of the above code is as seen in the result section above. Please refer to the comments in the code for any clarification required. You can just copy and paste the code in a text file and save it with .html extension. Open this html file in any browser of your choice and you will see the map in action.

I understand that this post has become very long, but all the explained theory is the least minimum that was needed....

very nice! keep it up!

ReplyDeleteg8!!!!! Really nice!!!

ReplyDeleteThank you Sid & Kiran....

ReplyDeleteYes! Wonderful explanation, especially the animation. It is the first time I "kind of" feel I will be able to someday truly understand geodesics.

ReplyDeleteThanx Fabianna...

ReplyDelete