hypertidy/ceramic

readme demo

mdsumner opened this issue · 1 comments

Put a motivating demo in the readme, along the lines of the anglr way https://github.com/hypertidy/anglr

Example code, specify longlat extent and zoom and get a shade3d scene.

library(ceramic)
ex <- raster::extent(147, 148, -43, -42.7)
im <- cc_location(ex, zoom = 10)
el <- cc_elevation(ex, zoom = 10)
library(quadmesh)
qm <- quadmesh(raster::aggregate(el, fact = 6), texture = im)
library(rgl)
shade3d(qm, lit = FALSE)
aspect3d(1, 1, .08);bg3d("grey");  
# if needed:
#rglwidget()

Screenshot 2019-07-08 at 17 19 21

html artefact zipped:

mapbox_hobart.zip

A more considered framing for the region

  ## remotes::install_github("hypertidy/ceramic")
library(ceramic)
ex <- raster::extent(146.9, 148.05, -43.26, -42.72)
im <- cc_location(ex, zoom = 10)
el <- cc_elevation(ex, zoom = 10)
omit0 <- function(x) x[x > 0]
ql <- quantile(omit0(raster::values(el)),seq(0, 1, length = 15L))
#png(width = ncol(el), height = nrow(el))
l <- 0.94
par(mar = rep(0, 4L), bg = rgb(l, l, l))
raster::image(el, 
              add = FALSE,
              asp = 1,
              col = grey(seq(0.25, 1, length = length(ql) - 1L)),
              zlim= c(1, 840), 
              xlab = "", ylab = "", axes = FALSE, box = FALSE)
raster::contour(el[[1]], add = TRUE, col = rgb(0.1, 0.1, 0.1, 0.8))

#dev.off()

Created on 2019-07-08 by the reprex package (v0.3.0)