cartilage
所属分类:R语言
开发工具:R
文件大小:0KB
下载次数:0
上传日期:2021-06-30 09:51:44
上 传 者:
sh-1993
说明: 使用光栅和光线着色器的rgl坐标冒险,WIP
(Adventures in rgl coordinates with raster and rayshader, WIP)
文件列表:
.Rbuildignore (100, 2021-06-30)
CODE_OF_CONDUCT.md (1389, 2021-06-30)
DESCRIPTION (656, 2021-06-30)
NAMESPACE (238, 2021-06-30)
R/ (0, 2021-06-30)
R/cartilage-package.R (33, 2021-06-30)
R/spatial_rayshader.R (4726, 2021-06-30)
R/utils.R (294, 2021-06-30)
cartilage.Rproj (385, 2021-06-30)
data-raw/ (0, 2021-06-30)
data-raw/data-monterey.R (916, 2021-06-30)
data-raw/monterey_bay_dem.R (3567, 2021-06-30)
data-raw/monterey_bay_dem.Rmd (968, 2021-06-30)
data-raw/montereybay_abscoords_LCC.png (313274, 2021-06-30)
data-raw/montereybay_relative_coords.png (309410, 2021-06-30)
inst/ (0, 2021-06-30)
inst/extdata/ (0, 2021-06-30)
inst/extdata/monterey/ (0, 2021-06-30)
inst/extdata/monterey/monterey_dem.tif (1033466, 2021-06-30)
man/ (0, 2021-06-30)
man/cartilage-package.Rd (625, 2021-06-30)
man/rayshade_to_hex.Rd (304, 2021-06-30)
# cartilage
The goal of cartilage is to blend rayshader image forms with absolute
coordinates in rgl.
This is very much a work in progress. See functions `sphere`, `ray`,
`lamb` and `ambient`, which expect a raster and provide the same
interfaces as the corresponding `rayshader` `*_shade` functions. Be
careful not to input very large data, keep to something like 300\*300 or
so unless you outlandishly keen (we’ll add helpers).
The output of functions is the data used to build the scene, and
currently includes the `quadmesh`, the `hillshade` and the `raster` -
but we don’t have helpers for those yet. An internal function plots and
constructs this list output.
Feedback welcome\!
## Installation
Install from github with
``` r
devtools::install_github("hypertidy/cartilage")
```
## Example
We use the built-in GeoTIFF file of a reduced resolution Monterey Bay
elevation.
``` r
f <- system.file("extdata/monterey/monterey_dem.tif", package= "cartilage")
r <- raster::raster(f)
library(cartilage)
x <- sphere(r)
rgl::axes3d()
```
Now in in `x$qm` we have the rgl mesh3d form, so we can do some tricks:
``` r
## in x$qm we have the rgl mesh3d form, so we can do some tricks
qm <- x$quadmesh ## convert to Geocentric coordinates
qm$vb[1:3, ] <- t(proj4::ptransform(t(qm$vb[1:3, ]), raster::projection(r), "+proj=geocent +datum=WGS84"))
rgl::rgl.clear()
rgl::shade3d(qm) ## we are now geocentric
library(graticule)
g <- graticule(seq(-123, -120, by = 0.25), seq(35, 38, by = .2))
g <- silicate::SC(g) ## hypertidy/silicate
library(anglr) ## hypertidy/anglr
plot3d(anglr::globe(g), add = TRUE)
rgl::aspect3d(1, 1, 1)
```
## Getting raster data …
(… at reasonable resolution)
The ‘raster’ package has a pretty efficient ‘aggregate’ function, and
‘rgdal’ can read data at lower resolution than native using the
‘output.dim’ argument of ‘readGDAL’ - the
[stars](https://github.com/r-spatial/stars.git) project aims to
supersede both packages and provide the raster sf. Our favourite method
currently is to use
[lazyraster](https://github.com/hypertidy/lazyraster.git) which can read
directly from a file via GDAL into a raster of a desired resolution,
with helpers for setting an extent prior to reading any data.
The output of cartilage functions is the data used to build the scene,
but we don’t have helpers for those yet. A related idea is being pursued
in [SOmap](https://github.com/Maschette/SOmap.git) for Antarctica maps.
Please note that the ‘cartilage’ project is released with a [Contributor
Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project,
you agree to abide by its terms.
‘cartilage’ was originally named ‘montereybayshader’, as it was
motivated by getting a shareable data set and settled on Monterey Bay.
The original code was just to plot rayshader products in absolute
coordinates, or to mesh other products into a rayshader scene. Some
older notes are in data-raw/.
近期下载者:
相关文件:
收藏者: