好像不支持png格式圖片!=骼F袈А!
# Fri Aug 28 11:35:51 2020 -
# 字符編碼:UTF-8
# R 版本:R x64 4.0.2
# cgh163email@163.com
# —— 拎了個(gè)梨??
#
# Add bitmap()
rm(list=ls());gc()
.rs.restartR() # 重啟RStudio
require(mapdeck)
require(raster)
set_token( key )
#路徑不支持本地文件
mapdeck(location = c(-122.3, 37.8), zoom = 10) %>%
add_bitmap(
image = paste0('http://www.tqyb.com.cn/designs/images/gzlogo.png')
, bounds = c(-122.519, 37.7045, -122.355, 37.829)
) # 已經(jīng)不支持png格式了
mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
add_bitmap(
image = 'https://upload.jianshu.io/users/upload_avatars/14391893/df57bc29-9bb7-4bd9-b9ee-8921c72abe5e.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/96/h/96'
, bounds = c(-80.425, 37.936, -71.516, 46.437)
) # JPG格式可以支持
mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
add_bitmap(
image = 'https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif'
, bounds = c(-80.425, 37.936, -71.516, 46.437)
)
mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
add_bitmap(
image = 'https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif'
, bounds = c(-80.425, 37.936, -71.516, 46.437)
, tint_colour = "#41ae3c" # 填充色
)
mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
add_bitmap(
image = 'https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif'
, bounds = c(-80.425, 37.936, -71.516, 46.437)
, desaturate = 1 # 轉(zhuǎn)為灰度圖
)
mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
add_bitmap(
image = 'radar.gif'
, bounds = c(-80.425, 37.936, -71.516, 46.437)
, desaturate = 1 # 轉(zhuǎn)為灰度圖
)
灰度或者填色都可以
機(jī)翻參數(shù)
復(fù)制到Excel用空格鍵分列可得:
Add bitmap Adds an image to a map 將圖像添加到地圖
map a mapdeck map object 一個(gè)mapdeck地圖對(duì)象
image url to an image to use on the map 網(wǎng)址到要在地圖上使用的圖像
bounds coordinates of the bounding box of the image [left, bottom, right, top] 圖像邊界框的坐標(biāo)[左刘陶,下胳赌,右,上]
desaturate the desatruation of the bitmap, in range [0,1], 0 being the original colour and 1 being greyscale 位圖的反破壞匙隔,范圍為[0,1]疑苫,0為原始顏色,1為灰度
transparent_colour the colour to use for transparent pixels as a hex string 用于透明像素(十六進(jìn)制字符串)的顏色
tint_colour the colour to tint the bipmap by, as a hex string 以十六進(jìn)制字符串作為著色bipmap的顏色
layer_id single value specifying an id for the layer. Use this value to distinguish between shape layers of the same type. Layers with the same id are likely to conflict and not plot correctly 指定圖層ID的單個(gè)值纷责。 使用此值可以區(qū)分相同類型的形狀圖層捍掺。 具有相同ID的圖層可能會(huì)發(fā)生沖突并且無(wú)法正確繪制
update_view logical indicating if the map should update the bounds to include this layer 邏輯指示地圖是否應(yīng)更新邊界以包括此圖層
focus_layer logical indicating if the map should update the bounds to only include this layer 邏輯指示地圖是否應(yīng)將邊界更新為僅包括此圖層