Creating an interactive globe in R

So, you want to create globe with a resolution so low that it´s hard to imagine any use cases? Here is an R script that will do just that. This script will:

  • Download a NASA image of the earth
  • Create an interactive globe using the image
  • Save the globe to a HTML file

# Install libraries
#devtools::install_github("bwlewis/rthreejs")


# Load libraries
library(htmlwidgets)
library(threejs)

# Set working directory
setwd("C:\\Eget\\R\\")

# Download image of topography and bathymetry
earth_topoimage <- "http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73909/world.topo.bathy.200412.3x5400x2700.jpg"

# Render globe
globe = globejs(img=earth_topoimage, bg="black", atmosphere=TRUE)

# Save globe to disk
saveWidget(widget = globe, file = "Globe.html")

Here it is:

See https://bwlewis.github.io/rthreejs/ for more about using rthreejs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please reload

Please Wait