Title: | 3D Interactive Globes |
---|---|
Description: | Displays geospatial data on an interactive 3D globe in the web browser. |
Authors: | Richard Barnes [aut, cre] |
Maintainer: | Richard Barnes <[email protected]> |
License: | MIT + file LICENCE |
Version: | 1.0.3 |
Built: | 2024-11-09 03:37:56 UTC |
Source: | https://github.com/r-barnes/webglobe |
Send a command to a webglobe
## S3 method for class 'webglobe' wg + x
## S3 method for class 'webglobe' wg + x
wg |
Webglobe |
x |
Command to send |
The same webglobe
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg + wgclear() ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg + wgclear() ## End(Not run)
Determine if an object is a webglobe
is.webglobe(x)
is.webglobe(x)
x |
The object that might be a webglobe |
TRUE or FALSE
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) is.webglobe(wg) ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) is.webglobe(wg) ## End(Not run)
Displays a webglobe. If the webglobe is immediate, then a browser window containing it should already be open; in this case, the webglobe's address is returned. If the webglobe is not immediate then a new browser is open and the cached pipeline is sent to it.
## S3 method for class 'webglobe' print(x, ...)
## S3 method for class 'webglobe' print(x, ...)
x |
The webglobe |
... |
Ignored |
NA
## Not run: library(webglobe) wg<-webglobe() wg ## End(Not run)
## Not run: library(webglobe) wg<-webglobe() wg ## End(Not run)
Constructs a new webglobe and starts its server
webglobe(immediate = FALSE)
webglobe(immediate = FALSE)
immediate |
Whether the webglobe should immediately show the results of graphics commands or additively cache them. 'immediate' mode can be used to experimentally build up a pipeline. Once established this can be stored in a non-immediate webglobe for easy acces later |
A webglobe object
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) ## End(Not run)
Plots bars rising upwards from points on the Earth's surface
wgbar(lat, lon, alt = 3e+06, colour = "blue", width = 3)
wgbar(lat, lon, alt = 3e+06, colour = "blue", width = 3)
lat |
Latitude of the bars' bases, in degrees |
lon |
Latitude of the bars' bases, in degrees |
alt |
Altitude of the bars' tops, may be one or many values |
colour |
Colour of the bars, may be one or many values |
width |
Width of bar bars, may be one or many values |
A webglobe command
## Not run: library(webglobe) data(quakes) #Load up some data wg <- webglobe(immediate=FALSE) #Make a webglobe wg <- wg + wgbar(quakes$lat, quakes$lon, alt=1.5e6*quakes$mag/10) #Plot quakes wg <- wg + wgcamcenter(-33.35, 142.96, 8000) #Move camera wg ## End(Not run)
## Not run: library(webglobe) data(quakes) #Load up some data wg <- webglobe(immediate=FALSE) #Make a webglobe wg <- wg + wgbar(quakes$lat, quakes$lon, alt=1.5e6*quakes$mag/10) #Plot quakes wg <- wg + wgcamcenter(-33.35, 142.96, 8000) #Move camera wg ## End(Not run)
Centers the camera on a point
wgcamcenter(lat, lon, alt = NA)
wgcamcenter(lat, lon, alt = NA)
lat |
Latitude of the center point, in degrees |
lon |
Longitude of the center point, in degrees |
alt |
Altitude of the center point, in kilometres |
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgcamcenter(45,-93,5000) ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgcamcenter(45,-93,5000) ## End(Not run)
Send the camera to its home location
wgcamhome()
wgcamhome()
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgcamhome() ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgcamhome() ## End(Not run)
Clears everything from the map
wgclear()
wgclear()
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgclear() ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgclear() ## End(Not run)
Turns on immediate mode
wgimmediate()
wgimmediate()
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=FALSE) wg + wgimmediate() #wg is now immediate ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=FALSE) wg + wgimmediate() #wg is now immediate ## End(Not run)
Set immediate mode by value
wgimmediate_set(mode)
wgimmediate_set(mode)
mode |
TRUE or FALSE: TRUE immplies immediate mode on, FALSE implies off |
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg + wgimmediate_set(FALSE) #wg is now unimmediate ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg + wgimmediate_set(FALSE) #wg is now unimmediate ## End(Not run)
Plots latitude-longitude points
wgpoints(lat, lon, label = NA, alt = 0, colour = "yellow", size = 10)
wgpoints(lat, lon, label = NA, alt = 0, colour = "yellow", size = 10)
lat |
One or more latitude values |
lon |
One or more longitude values |
label |
Label to put next to point |
alt |
Altitude of the points, can be single value or vector |
colour |
Colour name of the points, can be single value or vector |
size |
Size of the points, can be single value or vector |
A webglobe command
## Not run: library(webglobe) wg <- webglobe(immediate=FALSE) wg <- wg + wgpoints(c(45,20),c(-93,127),alt=3,colour=c("blue","red")) wg <- wg + wgpoints(51.5074,-0.1278,label="London",alt=0,colour="blue") wg ## End(Not run)
## Not run: library(webglobe) wg <- webglobe(immediate=FALSE) wg <- wg + wgpoints(c(45,20),c(-93,127),alt=3,colour=c("blue","red")) wg <- wg + wgpoints(51.5074,-0.1278,label="London",alt=0,colour="blue") wg ## End(Not run)
Plot polygons defined by long-style data frame
wgpolygondf(df, fill = NA, alpha = 1, extrude_height = 0, stroke = "yellow", stroke_width = 10)
wgpolygondf(df, fill = NA, alpha = 1, extrude_height = 0, stroke = "yellow", stroke_width = 10)
df |
Data frame to plot |
fill |
Fill colour name |
alpha |
Alpha (transparency value) |
extrude_height |
Height of the polygon above the surrounding landscape, in TODO |
stroke |
Outline colour (TODO) |
stroke_width |
Outline width (TODO) |
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgpolygondf(ggplot2::map_data("usa"),fill="blue",extrude_height=1000) ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgpolygondf(ggplot2::map_data("usa"),fill="blue",extrude_height=1000) ## End(Not run)
Determine which port a webglobe is running on
wgport(wg)
wgport(wg)
wg |
Webglobe whose port should be determined |
A number representing the webglobe's port
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wgport(webglobe) ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wgport(webglobe) ## End(Not run)
Changes the tab/window title of the webglobe's browser view
wgtitle(title)
wgtitle(title)
title |
The title to use |
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgtitle("I am the new title!") ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg+wgtitle("I am the new title!") ## End(Not run)
Turns off immediate mode
wgunimmediate()
wgunimmediate()
A webglobe command
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg + wgunimmediate() #wg is now unimmediate ## End(Not run)
## Not run: library(webglobe) wg<-webglobe(immediate=TRUE) wg + wgunimmediate() #wg is now unimmediate ## End(Not run)