Drawing geodesic curves using the Bing maps Silverlight control
Wednesday, June 30th, 2010For an upcoming post I wanted to be able to plot the shortest routes between various positions on the Earth using the Bing Maps Silverlight control. Although since I started working on the problem Bing have provided a similar feature with their Distance Calculator App, the functions are not available for reuse via the public API. Interested developers may just want to skip the maths and just download the code.
Geodesic source code for Silverlight 4.0
Geodesics
The shortest path between two points on an arbitrary surface is called a Geodesic, and on a sphere, it is a Great Circle. Modelling the surface of the earth as a perfect sphere, the shortest distance between any two locations on the surface is then described by a section of a Great Circle, ie an arc that lies on the plane that is described by the vectors between its start and end points and the Earth’s centre ( see figure 1 ).
With this information, one way ( and the way I have adopted ) to plot such a curve is as follows:
- Generate the points of the curve in two dimensions using the parametric equation of a circle.
- Transform the plane of the 2d curve into 3D space such that it intersects the end points on the sphere, and the sphere’s centre.
- Project the transformed points back into 2D space using the Mercator projection equations.



