# Thu Oct 22 16:13:24 2020 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.3 for window 10
# [email protected]
# 个人笔记不负责任
# —— 拎了个梨
.rs.restartR()
require(leafletCN)
# read.geoShape函数,json地图读取为sp对象
rm(list=ls());gc()
# 用于将geojson形状文件读入R的函数,它是一个SpatialPolygonsDataFrame对象
filePath = system.file("geojson/china.json",package = "leafletCN")
map = read.geoShape(filePath)
plot(map)
map.add <- 'https://geo.datav.aliyun.com/areas/bound/geojson?code=440100_full'
map <- read.geoShape(map.add)
leaflet(map) %>% amap() %>%
addPolygons(
stroke = TRUE,
smoothFactor = 1,
fillOpacity = 0.7,
weight = 1, )
# Thu Oct 22 16:28:25 2020 --