# How to animate Google Earth with R

**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:

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

**leave a comment**for the author, please follow the link and comment on their blog:

**Revolutions**.

R-bloggers.com 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.