R语言,rayshader包,raster_to_matrix函数栅格转矩阵

转为矩阵作图

来源
# Wed Oct 07 09:49:01 2020 -

# 字符编码:UTF-8
# R 版本:R x64 4.0.2 for window 10
# [email protected]
#个人笔记不负责任
# —— 拎了个梨
require(rayshader)
# raster_to_matrix栅格转矩阵
rm(list=ls());gc()

# 将montereybay保存为栅格并使用文件名打开。


temp_raster_filename = paste0(tempfile(),".tif")
temp_raster_filename %>% head()

raster::writeRaster(raster::raster(t(montereybay)),temp_raster_filename)
elmat = raster_to_matrix(temp_raster_filename)
elmat %>%
  sphere_shade() %>%
  plot_map()

# Tue Oct 13 16:52:44 2020 ------diy------------------------
img.mat <- raster_to_matrix('https://imgchr.com/content/images/system/logo_1587118523477_d70867.png')
img.mat %>% sphere_shade() %>% plot_map()


你可能感兴趣的:(R语言,rayshader包,raster_to_matrix函数栅格转矩阵)