How to animate Google Earth with R

August 6, 2010

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

We’ve looked before at how you can annotate geographical maps using R, but what if you want to overlay data onto a globe of the Earth, using Google Earth? The RKML package for R (from the OmegaHat project) allows you to do just that, by providing a high-level interface from R to generate KML files, which in turn are used to drive animations in Google Earth.

Here’s one very cool example of its use: at the blog Mind of a Markov Chain you can find an animation of the Deepwater Horizon oil spill, overlaid with the tracks of tuna migrations. Here’s a screenshot:

Tuna tracks

Follow the link below for the animation, where you’ll see that the migration paths intersect with the spill (in both time and space). This animation was created with fewer than 30 lines of R code, which you can also find at the link.

Mind of a Markov Chain: R and Google Earth ~ comparing tuna tracks vs. Gulf of Mexico oil spill extent 

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)