Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volcano example #125

Open
mdsumner opened this issue Apr 13, 2020 · 0 comments
Open

volcano example #125

mdsumner opened this issue Apr 13, 2020 · 0 comments

Comments

@mdsumner
Copy link
Member

  ## according to mapview
maxll <- cbind(174.76448,-36.87812)

prj <- "+proj=nzmg +datum=WGS84"
maxnz <- rgdal::project(maxll, prj)
library(raster)
r <- raster::raster(volcano[nrow(volcano):1,ncol(volcano):1])
plot(r)
wm <- which.max(r)
xmn <- maxnz[1,1] - 10 * colFromCell(r, wm)
xmx <- maxnz[1,1] + 10 * (ncol(r) - colFromCell(r, wm))
ymn <- maxnz[1,2] - 10 * (nrow(r) - rowFromCell(r, wm))
ymx <- maxnz[1,2] + 10 * rowFromCell(r, wm)
rr <- setExtent(r, extent(xmn, xmx, ymn, ymx))

projection(rr) <- prj
plot(rr)
abline(v = maxnz[1,1], h = maxnz[1,2])
#mapview::mapview(rasterToContour(rr))
im <- ceramic::cc_location(rr, zoom = 18)  ## hardcode zoom
plotRGB(im)
plot(spTransform(rasterToContour(rr), projection(im)), add = TRUE, 
     lwd = 3, col = "lightgrey")




mesh <- anglr::as.mesh3d(rr, image_texture = im)
anglr::plot3d(mesh);rgl::aspect3d("iso")
cl <- rasterToContour(rr)
cl$level <- as.numeric(levels(cl$level)[cl$level]) + 1 #(add a fudge to elevate)
anglr::plot3d(anglr::copy_down(silicate::SC(cl), "level"), add = TRUE, lwd = 3)

With decent zoom from ceramic it looks pretty neat

image

not sure what to do about the texture problem, save the mesh3d and hard code it to look up the system.file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant