R语言leafem包,addGeoRaster函数,将光栅图像添加到活页地图中
几个重要参数:
project = T, # crs投影坐标系传递
resolution = 256, # 渲染插值
opacity = .6, # 不透明度
colorOptions = colorOptions(palette = grey.colors(256))
# Wed Nov 04 00:24:32 2020 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.3 for window 10
# cgh163email@163.com
# 个人笔记不负责任
# —— 拎了个梨🍐
.rs.restartR()
require(leafem)
rm(list=ls());gc()
# addGeoRaster,将光栅图像添加到活页地图中。
interactive() # 是否交互运行
library(leaflet)
library(leafem)
library(stars)
tif = system.file("tif/L7_ETMs.tif", package = "stars")
x1 = read_stars(tif)
x1 = x1[, , , 3] # band 3
x1 %>% plot()
leaflet() %>%
addTiles() %>%
leafem:::addGeoRaster(
x1
, opacity = 1
, colorOptions = colorOptions(
palette = grey.colors(256)
)
)
# Wed Nov 04 00:36:06 2020 -diy-----------------------------
tif <- read_stars('https://gitee.com/youmigo/bate/blob/master/img.file/GAIA_1985_2018_70_030.tif')
# tif <- read_stars('001.tif')
plot(tif)
# tif <- tif[,,,3]
leaflet() %>%
addTiles() %>%
addGeoRaster(tif,project = T, # crs投影坐标系传递
resolution = 256, # 渲染插值
opacity = .6, # 不透明度
colorOptions = colorOptions(palette = grey.colors(256)))
t# Wed Nov 04 00:45:53 2020 --