R语言leafem包,addLogo函数,添加照片做logo
# Thu Nov 05 00:01:37 2020 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.3 for window 10
# cgh163email@163.com
# 个人笔记不负责任
# —— 拎了个梨🍐
.rs.restartR()
require(leafem)
rm(list=ls());gc()
# addLogo函数,添加照片做logo
# 此函数用于向地图添加图像。同时支持本地和远程(web)图像源。地图上的位置是完全可以控制的。
# png, jpg, gif, bmp, ...
library(leaflet)
# 默认位置是缩放控制旁边的左上角
img <- "https://www.r-project.org/logo/Rlogo.svg"
leaflet() %>% addTiles() %>% addLogo(img, url = "https://www.r-project.org/logo/")
## with local image
if (requireNamespace("png")) {
library(png)
img <- system.file("img", "Rlogo.png", package="png")
leaflet() %>% addTiles() %>% addLogo(img, src = "local", alpha = 0.3)
## dancing banana gif :-)
m <- leaflet() %>%
addTiles() %>%
addCircleMarkers(data = breweries91)
addLogo(m, "https://jeroenooms.github.io/images/banana.gif",
position = "bottomleft",
offset.x = 5,
offset.y = 40,
width = 100,
height = 100)
}
# Thu Nov 05 00:05:55 2020 --
leaflet() %>% addTiles() %>%
addLogo('ogc.gif',src = 'local') # 默认来自网路,需指定本地local
leaflet() %>% addTiles() %>%
addLogo('https://s1.ax1x.com/2020/10/27/BQCc2q.jpg') #
# Thu Nov 05 00:16:12 2020 --
leaflet() %>% addTiles() %>%
addLogo('https://s1.ax1x.com/2020/10/27/BQCc2q.jpg'
,alpha = .65 # 不透明度
,src ='remote' # 指定文件來源本地還是網絡。
,position = 'bottomright' # 放置方位
,offset.x = 5, # 尺寸和偏移
offset.y = 40,
width = 100,
height = 100
)
# end