We have recently been doing a series of posts about Sentinel and Landsat imagery on Amazon Web Services (AWS), including releasing a KML file that automatically retrieves thumbnails of Landsat 8 imagery from AWS and creates animations with them.
We mentioned at the time that the Landsat images are not all perfectly aligned with each other and we had adjusted each image slightly to try and create smoother animations. To do this we used a simplified model that assumed that the imagery squares were all aligned with latitude and longitude, with up being North. It turns out that our assumptions were not valid and there was still significant ‘shake’ visible in ground features in many animations, especially those of Antarctica.
After some investigation we discovered that not only do the Landsat tiles tilt to the right as per the satellite’s orbit, but the images are placed into the thumbnails at an angle, results in further rotations overall.
The imagery on AWS is provided with a file whose name ends with MTL that contains a variety of metadata for the image. This includes the coordinates of the corners of the thumbnails (this is the whole thumbnail including the black areas). If we have two thumbnails offset from each other as shown as the red and green squares in the image below left, then in our animation we need to adjust the top of one of the images by the amount shown as the ‘top offset’. Thinking of it as purely Cartesian coordinates, to work it out in latitude and longitude it involves a series of rotations and translations, which gets rather complicated. However, we realised that instead, we could stick to proper geographic calculations, for which we already have the key routines that we worked out when working on our post on drawing circles in Google Earth. It mostly relies on an open source package called GeographicLib by Charles Karney, with a few additions also by him but not included in the main library.
Above right we see the mid-point (red circle) of the top of the red square, the mid-point (green circle) of the top of the green square, and what is known as the ‘cross track intercept’ for the green point to the thin red line. The cross track intercept is the closest point on a great circle to a location not on the circle. The distance we were looking for is from the red circle to the cross track intercept. Although this all sounds complicated, it is actually only a few lines of code, because all the hard work is done by GeographicLib. We simply repeated this for all for sides and for every frame in the animation and it worked! The animations are now much more stable even over Antarctica.
Our conclusion overall, is that although geographic coordinates can be very complicated, sometimes it is actually easier to work with them than trying to simplify things, as the heavy lifting can be done by ready-made libraries of code.
Because the thumbnails are actually higher resolution than what you can see in the popup, we have also added the ability to zoom and pan the animation. Just use the mouse scroll wheel to zoom in and out and drag the image with the mouse to pan. I am afraid we don’t have a Mac to test on, so we are not sure if this works on Mac. Let us know in the comments if it doesn’t and we will try adding keyboard controls. Remember, these are only thumbnails so don’t expect great resolution when zoomed in.
You can download the updated KML file here. We have widened the size of the popup in the standard version, but if you find it too wide for your screen, then the narrower version can be found here.
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.
Amazing! Is there a way to filter day/night time images, probably via some metadata?
Timothy… Incredible! A couple years ago I was a “groupie” with the “Scott Expedition” – a sort of geeky one – and seeing that their organization was not going to provide geo-data to the specificity that I wanted I created and published it myself. https://dl.dropboxusercontent.com/u/567495/specialty/ScottExpedition-Antarctica.kmz It completely rearranged my schedule (night is day etc) and I lived with (and discovered) all the GoogleEarth “idiosyncrasies” at the south pole. It’s maddeningly good yet so just short of the mark in many places.
So,l seeing this great tool I immediately ran to Antarctica cause that’s the wilderness that I know best. It’s incredible how your new stability helps cut through all the flashing of clouds to highlight the permanent places. I wish I had this to resource back then – I just may go back and retroactively include a link to this in my old file. (I do notice that I still have more than a few downloads every month from people stumbling upon my old post: http://offroadinghome.blogspot.com/2014/01/scott-expedition-coming-home.html )
One “enhancement” that you might consider is some way to “align” the GEpro view point with the Landsat animation that pops up. Or even display it as an overlay (is that even possible?). The popup generates an opaque box that occludes the screen and for the longest time confused the begeebers out of me – I thought that GE must have altered the data of the poles again. Then I realized that I was about 174 degrees rotated and zoomed at an entire different level. Here is a placemark to the point I finally landed on and realized where I was. There are so many green boxes it’s hard to describe what to look at but I guess clicking on anywhere in the area gives you the same animation(?).
I still can’t get over how clear and stable Minna Bluff (looks like italy) comes through in the animation despite all the clouds. Great work! You must live this stuff.
Sorry, left out the link to the placemark. https://dl.dropboxusercontent.com/u/567495/Temp/LansatToolExample.kmz