R語言,mapdeck包,add_polygon多邊形圖層

演示
# Wed Sep 02 20:39:27 2020 -

# 字符編碼:UTF-8
# R 版本:R x64 4.0.2 for window 10
# cgh163email@163.com
# 個(gè)人筆記不負(fù)責(zé)任
# —— 拎了個(gè)梨??
rm(list=ls());gc()
.rs.restartR()
require(mapdeck)
# key <- 'abc'
set_token( key )

# Wed Sep 02 20:44:34 2020 -加載地圖矢量多邊形-----------------------------

library(geojsonsf)

sf <- geojsonsf::geojson_sf("https://geo.datav.aliyun.com/areas_v2/bound/440000_full.json")
names(sf)
# Wed Sep 02 20:44:58 2020 --作圖
mapdeck(
  style = mapdeck_style('dark')
) %>%
  add_polygon(
    data = sf
    , layer = "polygon_layer"
    # , fill_colour = "name" #  填色參數(shù)經(jīng)常出錯(cuò)
  )
# Wed Sep 02 20:45:34 2020 ---自帶地圖數(shù)據(jù)演示---------------------------

df <- melbourne  ## 具有編碼多義性的data.frame
df$elevation <- sample(100:5000, size = nrow(df))
df$info <- paste0("<b>SA2 - </b><br>",df$SA2_NAME)

mapdeck(pitch = 45,
  style = mapdeck_style('dark')
  , location = c(145, -38)
  , zoom = 8
) %>%
  add_polygon(
    data = df
    , polyline = "geometry" #  不影響
    , layer = "polygon_layer" #  不影響
    # , fill_colour = "SA2_NAME" #  填色經(jīng)常出錯(cuò)
    , elevation = "elevation" #  高程倍數(shù)
    , tooltip = 'info' #  備注信息
    , legend = T #  圖例湖饱?
    ,auto_highlight = T #  自動(dòng)高亮鼠標(biāo)位置
  )


空格分隔的表格:

參數(shù)機(jī)翻
1   map    a mapdeck map object 一個(gè)mapdeck地圖對(duì)象
2   data    data to be used in the layer. All coordinates are expected to be EPSG:4326 (WGS 84) coordinate system   圖層中要使用的數(shù)據(jù)。所有坐標(biāo)均應(yīng)為EPSG:4326(WGS 84)坐標(biāo)系
3   polyline    optional column of data containing the polylines, if using encoded polylines    如果使用編碼折線杀捻,則包含折線的數(shù)據(jù)的可選列
4   stroke_colour   variable of data or hex colour for the stroke. If used, elevation is ignored. If using a hex colour, use either a single value, or a column of hex colours on data  筆畫的數(shù)據(jù)變量或十六進(jìn)制顏色井厌。如果使用,則忽略高程水醋。如果使用十六進(jìn)制顏色旗笔,請?jiān)跀?shù)據(jù)上使用單個(gè)值或一列十六進(jìn)制顏色
5   stroke_width    width of the stroke in meters. If used, elevation is ignored. Default 1.    筆畫的寬度(以米為單位)。如果使用拄踪,則忽略高程蝇恶。默認(rèn)值1。
6   stroke_opacity  Either a string specifying the column of data containing the opacity of each shape, or a single value in [0,255], or [0, 1), to be applied to all the shapes. Default 255. If a hex-string is used as the colour, this argument is ignored and you should include the alpha on the hex string   指定包含每個(gè)形狀的不透明度的數(shù)據(jù)列的字符串惶桐,或者是[0,255]或[0撮弧,1)中的單個(gè)值潘懊,將應(yīng)用于所有形狀。默認(rèn)值255贿衍。如果將十六進(jìn)制字符串用作顏色授舟,則將忽略此參數(shù),并且應(yīng)在十六進(jìn)制字符串中包含alpha
7   fill_colour column of data or hex colour for the fill colour. If using a hex colour, use either a single value, or a column of hex colours on data  數(shù)據(jù)列或十六進(jìn)制顏色作為填充色贸辈。如果使用十六進(jìn)制顏色释树,請?jiān)跀?shù)據(jù)上使用單個(gè)值或一列十六進(jìn)制顏色
8   fill_opacity    Either a string specifying the column of data containing the opacity of each shape, or a single value in [0,255], or [0, 1), to be applied to all the shapes. Default 255. If a hex-string is used as the colour, this argument is ignored and you should include the alpha on the hex string   指定包含每個(gè)形狀的不透明度的數(shù)據(jù)列的字符串,或者是[0,255]或[0擎淤,1)中的單個(gè)值奢啥,將應(yīng)用于所有形狀。默認(rèn)值255嘴拢。如果將十六進(jìn)制字符串用作顏色桩盲,則將忽略此參數(shù),并且應(yīng)在十六進(jìn)制字符串中包含alpha
9   elevation   the height the polygon extrudes from the map. Only available if neitherstroke_colour or stroke_width are supplied. Default 0    多邊形從地圖突出的高度席吴。僅在未提供stroke_colour或stroke_width時(shí)可用赌结。默認(rèn)值0
10  tooltip variable of data containing text or HTML to render as a tooltip 包含文本或HTML的數(shù)據(jù)變量以呈現(xiàn)為工具提示
11  auto_highlight  logical indicating if the shape under the mouse should auto-highlight   邏輯指示鼠標(biāo)下方的形狀是否應(yīng)自動(dòng)突出顯示
12  elevation_scale elevation multiplier.   高程乘數(shù)。
13  highlight_colour    hex string colour to use for highlighting. Must contain the alpha component.    用于突出顯示的十六進(jìn)制字符串顏色孝冒。必須包含alpha分量柬姚。
14  light_settings  list of light setting parameters. See light_settings    燈光設(shè)置參數(shù)列表。參見light_settings
15  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ā)生沖突并且無法正確繪制
16  id  an id value in data to identify layers when interacting in Shiny apps.  數(shù)據(jù)中的ID值,以在“閃亮”應(yīng)用程序中進(jìn)行交互時(shí)識(shí)別圖層啼染。
17  palette "string or matrix. String will be one of colourvalues::colour_palettes(). A matrix must have at least 5 rows, and 3 or 4 columns of values between [0, 255], where the 4th column represents the alpha. You can use a named list to specify a different palette for different colour options (where available), e.g. list(fill_colour = "viridis", stroke_colour = "inferno")"  “字符串或矩陣宴合。字符串將是colourvalues :: colour_palettes()之一。矩陣必須至少包含5行迹鹅,且[0卦洽,255]之間的值包含3或4列,其中第4列表示Alpha斜棚。您可以使用命名列表為不同的顏色選項(xiàng)(如果有)指定不同的調(diào)色板阀蒂,例如list(fill_colour =“ viridis”,stroke_colour =“ inferno”)“
18  na_colour   hex string colour to use for NA values  用于NA值的十六進(jìn)制字符串顏色
19  legend  either a logical indiciating if the legend(s) should be displayed, or a named list indicating which colour attributes should be included in the legend. 邏輯指示是否應(yīng)顯示圖例弟蚀,或者是一個(gè)命名列表蚤霞,該列表指示應(yīng)在圖例中包括哪些顏色屬性。
20  legend_options  A list of options for controlling the legend.   用于控制圖例的選項(xiàng)列表义钉。
21  legend_format   A list containing functions to apply to legend values. See section legend   包含要應(yīng)用于圖例值的函數(shù)的列表昧绣。參見圖例
22  update_view logical indicating if the map should update the bounds to include this layer    邏輯指示地圖是否應(yīng)更新邊界以包括此圖層
23  focus_layer logical indicating if the map should update the bounds to only include this layer   邏輯指示地圖是否應(yīng)將邊界更新為僅包括此圖層
24  digits  number of digits for rounding coordinates   舍入坐標(biāo)的位數(shù)
25  transitions list specifying the duration of transitions.    指定過渡持續(xù)時(shí)間的列表。
26  brush_radius    radius of the brush in metres. Default NULL. If supplied, the arcs will only show if the origin or destination are within the radius of the mouse. If NULL, all arcs are displayed  畫筆的半徑(以米為單位)捶闸。默認(rèn)為NULL夜畴。如果提供了弧拖刃,則僅當(dāng)起點(diǎn)或終點(diǎn)在鼠標(biāo)的半徑內(nèi)時(shí)才會(huì)顯示弧。如果為NULL贪绘,則顯示所有弧
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末兑牡,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子税灌,更是在濱河造成了極大的恐慌均函,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,544評(píng)論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件垄琐,死亡現(xiàn)場離奇詭異边酒,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)狸窘,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,430評(píng)論 3 392
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來坯认,“玉大人翻擒,你說我怎么就攤上這事∨2福” “怎么了陋气?”我有些...
    開封第一講書人閱讀 162,764評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長引润。 經(jīng)常有香客問我巩趁,道長,這世上最難降的妖魔是什么淳附? 我笑而不...
    開封第一講書人閱讀 58,193評(píng)論 1 292
  • 正文 為了忘掉前任议慰,我火速辦了婚禮,結(jié)果婚禮上奴曙,老公的妹妹穿的比我還像新娘别凹。我一直安慰自己,他們只是感情好洽糟,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,216評(píng)論 6 388
  • 文/花漫 我一把揭開白布炉菲。 她就那樣靜靜地躺著,像睡著了一般坤溃。 火紅的嫁衣襯著肌膚如雪拍霜。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,182評(píng)論 1 299
  • 那天薪介,我揣著相機(jī)與錄音祠饺,去河邊找鬼。 笑死昭灵,一個(gè)胖子當(dāng)著我的面吹牛吠裆,可吹牛的內(nèi)容都是我干的伐谈。 我是一名探鬼主播,決...
    沈念sama閱讀 40,063評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼试疙,長吁一口氣:“原來是場噩夢啊……” “哼诵棵!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起祝旷,我...
    開封第一講書人閱讀 38,917評(píng)論 0 274
  • 序言:老撾萬榮一對(duì)情侶失蹤履澳,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后怀跛,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體距贷,經(jīng)...
    沈念sama閱讀 45,329評(píng)論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,543評(píng)論 2 332
  • 正文 我和宋清朗相戀三年吻谋,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了忠蝗。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,722評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡漓拾,死狀恐怖阁最,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情骇两,我是刑警寧澤速种,帶...
    沈念sama閱讀 35,425評(píng)論 5 343
  • 正文 年R本政府宣布,位于F島的核電站低千,受9級(jí)特大地震影響配阵,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜示血,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,019評(píng)論 3 326
  • 文/蒙蒙 一棋傍、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧矾芙,春花似錦舍沙、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,671評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至葱绒,卻和暖如春感帅,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背地淀。 一陣腳步聲響...
    開封第一講書人閱讀 32,825評(píng)論 1 269
  • 我被黑心中介騙來泰國打工失球, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 47,729評(píng)論 2 368
  • 正文 我出身青樓实苞,卻偏偏與公主長得像豺撑,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子黔牵,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,614評(píng)論 2 353