f <- system.file("extdata/gebco1.tif", package = "anglr")
## ad hoc scaling as x,y and z are different units
r <- raster::raster(f)/1000
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.2.1, proj.4 4.9.3
nc <- read_sf(system.file("shape/nc.shp", package="sf"))
library(raster)
## Loading required package: sp
library(anglr) ## devtools::install_github("hypertidy/anglr")
## Warning in rgl.init(initValue, onlyNULL): RGL: unable to open X11 display
## Warning: 'rgl_init' failed, running with rgl.useNULL = TRUE
## objects
## a relief map, triangles grouped by polygon with interpolated raster elevation
p <- anglr(nc, max_area = 0.008) ## make small triangles (0.2 sq lon-lat degree)
g <- anglr(graticule::graticule(-85:-74, 32:37))
p$v$z_ <- extract(r, cbind(p$v$x_, p$v$y_), method = "bilinear")
## plot the scene
library(rgl)
rgl.clear();
plot(p); plot(g, color = "white");
## Joining, by = "object_"
## Joining, by = "triangle_"
## Joining, by = "object_"
## Joining, by = "segment_"
bg3d("black"); material3d(specular = "black");
rglwidget(width = 600, height = 300)