map3d: Add a 3D map surface

View source: R/rgl_layers.R

map3dR Documentation

Add a 3D map surface

Description

This method add a 3D map surface to the RGL plot. The backend map service is supported by OpenStreetMap package. All parameters except for h are consistent with the 'openmap' function in OSM.

Usage

map3d(upperLeft, lowerRight, h = 0, ...)

Arguments

h

the horizontal plane to locate the map surface

...

all other parameters of openmap

upperLeft

the upper left lat and long

lowerRight

the lower right lat and long

See Also

openmap

Examples

data(movement)

u1 <- subset(movement, id==3)
u1$time <- (u1$time - min(u1$time)) / 3600
lat1 <- min(u1$lat) - 0.005
lat2 <- max(u1$lat) + 0.005
lon1 <- min(u1$lon) - 0.005
lon2 <- max(u1$lon) + 0.005
## Not run: 
if(require(OpenStreetMap)){
 library(rgl)
 rgl.clear()
 rgl.clear("lights")
 rgl.bg(color="lightgray")
 rgl.viewpoint(theta=240, phi=45)
 rgl.light(theta = 45, phi = 45, viewpoint.rel=TRUE)
 map3d(c(lat1, lon1), c(lat2, lon2), h=min(u1$time))
 axes3d(edges = "bbox", labels = TRUE, tick = TRUE, nticks = 5, box=FALSE,
        expand = 1.03, col="black", lwd=0.8)
 invisible(readline(prompt="Press [enter] to continue"))
 rgl.close()
}
## End(Not run)

caesar0301/movr documentation built on June 18, 2022, 2:37 a.m.