Drawing straight lines with KML

While writing the 3D imagery post we came across this oddity: If you draw a path in Google Earth, the line segments follow geodesics, which are parts of great circles. If you draw a polygon, the sides are rhumb lines (also known as loxodromes or lines of constant bearing). A geodesic is a straight line on a three dimensional globe. A rhumb line is a straight line on the Web Mercator projection used by Google Maps.

On looking up the KML reference documentation the only mention as to whether the lines drawn will be geodesics or rhumb lines is a small note that appears under <Polygon> and <LinearRing>.

KML documentation note

And this seems to be the only reference in the KML documentation to either geodesics or rhumb lines or when one or the other will be used to render a line. After some experimentation it was noticed that in actual practice, in Google Earth, a filled polygon uses rhumb lines whereas an unfilled polygon uses geodesics. We also tried importing KMLs into My Maps, and it turns out that My Maps always uses geodesics.

So if you work with polygons in Google Earth, keep in mind that:

  • If you change its ‘filled’ attribute you will affect whether it uses geodesics or rhumb lines.
  • If you want an unfilled polygon that still maintains rhumb lines for its vertices, then don’t change it to unfilled, but change the opacity of its ‘filled’ attribute to zero.
  • If you import filled polygons into My Maps via KML they will be converted from rhumb lines to geodesics.

Filled polygon with rhumb line sides
Filled polygon showing rhumb line sides. Rhumb lines drawn on a globe curve more near the poles.

We have also created a KML for you to download demonstrating the different effects.

About Timothy Whitehead

Timothy has been using Google Earth since 2004 when it was still called Keyhole before it was renamed Google Earth in 2005 and has been a huge fan ever since. He is a programmer working for Red Wing Aerobatx and lives in Cape Town, South Africa.






PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.

Comments

  1. Interesting. Thank you…

  2. When I created my Google Map of the Topography of the Thermohaline Circulation of the Oceans map in Google map, I discovered a problem when I generated a KML file from the Google Map. That being the paths drawn for the Southern Ocean’s surface and deep Thermohaline currents that encircle Antarctica. In Google Earth these paths did not form a complete circle. In fact they were distorted. So I had to redraw them in Google Earth and convert the Networked KML file to a Non-networked KML file so that the original Google Map would not interfere with it.

    Here is the corrected KML file:

    https://docs.google.com/file/d/0B52hHMRyBvEsaFpMQTFXaEs2bWM/edit



PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.