View source: R/raster_to_matrix.R
raster_to_matrix | R Documentation |
Turns a raster into a matrix suitable for rayshader.
raster_to_matrix(raster, verbose = interactive())
raster |
The input raster. Either a RasterLayer object, a terra SpatRaster object, or a filename. |
verbose |
Default 'interactive()'. Will print dimensions of the resulting matrix. |
#Save montereybay as a raster and open using the filename.
if(run_documentation()) {
temp_raster_filename = paste0(tempfile(),".tif")
raster::writeRaster(raster::raster(t(montereybay)),temp_raster_filename)
elmat = raster_to_matrix(temp_raster_filename)
elmat %>%
sphere_shade() %>%
plot_map()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.