R语言,可视化,地图,mapdeck包,mapview包,leaflet包,交互地图,地图可视化,地信,R语言gis,地图散点图,交互地图显示点,热图,地图热力图,地图信息点展示,在线地图
# Mon Oct 26 17:04:43 2020 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.3 for window 10
# cgh163email@163.com
# 个人笔记不负责任
# —— 拎了个梨🍐
.rs.restartR()
require(sf)
require(mapdeck)
library(mapview)
require(leaflet)
require(leafletCN)
rm(list=ls());gc()
# 肺炎临床试验
# 引用信息:
#蒋荣猛,刘闯,许哲平,申艳,石瑞香.
#新型冠状病毒肺炎临床试验中国注册数量空间分布数 据集[DB/J].
#全球变化数据仓储,2020.DOI:10.3974/geodb.2020.03.29.V1.
# 到这儿下载两个rds文件
# https://gitee.com/youmigo/open-file/tree/master/sf&gis++
map.all <- st_read('Chinaregis_COVID-19CliTrial.shp')
map.all2 <- st_read('Chinaregis_COVID-19CliTrial_CCTR/Chinaregis_COVID-19CliTrial_CCTR.shp')
names(map.all);plot(map.all[1])
plot(map.all2[1])
map.zg <- st_read('https://geo.datav.aliyun.com/areas/bound/geojson?code=100000_full')
saveRDS(map.all,file = '散点信息sf对象.Rdata')
saveRDS(map.all2,file = '散点信息sf对象2.Rdata')
# Mon Oct 26 17:06:18 2020 --
require(mapdeck)
set_token(key) # mapbox.com注册key,是免费的。
# 地界+热图作业:
mapdeck( style = mapdeck_style('dark'), pitch = 45 ) %>%
add_path(data = map.zg) %>%
add_heatmap(
data = map.all,
lon = NULL,
lat = NULL,
polyline = NULL,
weight = NULL,
colour_range = NULL,
radius_pixels = 30,
intensity = 1,
threshold = 0.05,
layer_id = NULL,
update_view = TRUE,
focus_layer = FALSE,
digits = 6,
transitions = NULL
)
# Mon Oct 26 20:40:11 2020 --第二份数据
mapdeck( style = mapdeck_style('dark'), pitch = 45 ) %>%
add_path(data = map.zg) %>%
add_heatmap(
data = map.all2,
lon = NULL,
lat = NULL,
polyline = NULL,
weight = NULL,
colour_range = NULL,
radius_pixels = 30,
intensity = 1,
threshold = 0.05,
layer_id = NULL,
update_view = TRUE,
focus_layer = FALSE,
digits = 6,
transitions = NULL
)
# Mon Oct 26 21:09:23 2020 ---用mapview包---------------------------
library(mapview)
# Not run:
mapview() # 测试
mapview(map.all,col.regions='white')+map.zg
mapview(map.all2,col.regions='white')+map.zg
# Tue Oct 27 01:01:39 2020 ----leaflet包展示--------------------------
require(leaflet)
require(leafletCN)
names(map.all)
demomap('广州') # 测试
demomap('china') %>% amap() %>% addMarkers(data = map.all,popup = ~City_CN)
names(map.all2)
demomap('china') %>% amap() %>% addMarkers(data = map.all2,popup = ~Instit_CN)
# Tue Oct 27 01:27:03 2020 --End