Keyhole Markup Language

  • Deborah Nolan
  • Duncan Temple Lang
Part of the Use R! book series (USE R)


In this chapter, we explore two innovative tools for interactive visualization: Google Earth and Google Maps. Google Earth renders Keyhole Markup Language (KML) documents for viewing on a virtual earth browser, and similarly, Google Maps displays KML-formatted data on two-dimensional maps in a Web browser. KML is a grammar of XML for marking up spatial data. With it we can place plotting symbols on a map, augment these points with additional information, overlay R plots on the earth, animate points that have times associated with them, and draw arbitrary objects on the earth. We describe plotting functions in R that we have developed for creating KML displays with these features. We also discuss how to embed Google Earth in a Web page to create interactive mash-ups using KML, SVG, HTML, JavaScript, and R.


Data Frame Elephant Seal Graphic Device Scalable Vector Graphic Keyhole Markup Language 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Thomas Baier. rcom: R COM client interface and internal COM server., 2011. R package version 2.2-5.
  2. [2]
    Gabriel Becker and Duncan Temple Lang. RBrowserPlugin: R in the Web browser., 2012. R package version 0.1-5.
  3. [3]
    David Brillinger and Brent Stewart. Elephant-seal movements: Modelling migration. Canadian Journal of Statistics, 26:431–443, 1998.CrossRefzbMATHGoogle Scholar
  4. [4]
    Google, Inc. Keyhole markup language (KML) reference., 2010.
  5. [5]
    Google, Inc. Google Earth: A 3D virtual earth browser, version 6., 2011.
  6. [6]
    Google, Inc. Google Maps: A Web mapping service application., 2011.
  7. [7]
    Tomislav Hengl, Pierre Roudier, Dylan Beaudette, and Edzer Pebesma. plotKML: Visualization of spatial and spatio-temporal objects in Google Earth., 2012. R package version 0.3-2.
  8. [8]
    Robert Hijmans and Jacob van Etten. raster: Geographic data analysis and modeling., 2012. R package version 2.0-41.
  9. [9]
    Anthony T. Holdener. HTML5 Geolocation. O’Reilly Media, Inc., Sebastopol, CA, 2011.Google Scholar
  10. [10]
    Michael Lawrence and Deepayan Sarkar. qtbase: Interface between R and Qt., 2011. R package version 1.0.4.
  11. [11]
    Eric Lecoutre. R2HTML: HTML exportation for R objects., 2011. R package version 2.2.
  12. [12]
    Markus Loecher. RgoogleMaps: Overlays on Google map tiles in R., 2011. R package version 1.2.0.
  13. [13]
    Erich Neuwirth. RColorBrewer: ColorBrewer palettes., 2011. R package version 1.0-5.
  14. [14]
    Deborah Nolan and Duncan Temple Lang. RKML: Simple tools for creating KML displays from R., 2011. R package version 0.7.
  15. [15]
    Deborah Nolan and Duncan Temple Lang. SVGAnnotation: Tools for post-processing SVG plots created in R., 2011. R package version 0.9.
  16. [16]
    Open Geospatial Consortium, Inc. OGC KML standards., 2010.
  17. [17]
    Edzer Pebesma, Roger Bivand, Barry Rowlingson, and Virgilio Gomez-Rubio. sp: Classes and methods for spatial data., 2012. R package version 1.0-5.
  18. [18]
    Deepayan Sarkar. Lattice: Multivariate Data Visualization with R. Springer-Verlag, New York, 2008.
  19. [19]
    Duncan Temple Lang. RDCOMEvents: Responding to DCOM events with R functions., 2005. R package version 0.3-1.
  20. [20]
    Duncan Temple Lang. RKMLDevice: Creating R plots in KML., 2010. R package version 0.1.
  21. [21]
    Duncan Temple Lang. R2GoogleMaps: Create HTML/JavaScript documents to display data using Google Maps., 2011. R package version 0.2-0.
  22. [22]
    Duncan Temple Lang. RDCOMClient: Accessing DCOM services within R., 2011. R package version 0.93-0.
  23. [23]
    Duncan Temple Lang. XML: Tools for parsing and generating XML within R and S-PLUS., 2011. R package version 3.4.
  24. [24]
    Duncan Temple Lang. Rcompression: In-memory decompression for GNU zip and bzip2 formats., 2012. R package version 0.94-0.
  25. [25]
    USGS Earthquakes Hazards Program. Latest earthquakes: feeds and data., 2010.
  26. [26]
    HadleyWickham, Deborah Swayne, and David Poole. Bay Area blues: The Effect of the housing crisis. In Toby Segaran and Jeff Hammerbacher, editors, Beautiful Data: The Stories Behind Elegant Data Solutions, pages 303–322. O’Reilly Media, Inc., Sebastopol, CA, 2009.Google Scholar

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  • Deborah Nolan
    • 1
  • Duncan Temple Lang
    • 2
  1. 1.Department of StatisticsUniversity of CaliforniaBerkeleyUSA
  2. 2.Department of StatisticsUniversity of CaliforniaDavisUSA

Personalised recommendations