Fri Dec 18 15:29:49 2020 -
R语言mapedit包,drawFeatures交互地图画画
leaflet家族,
可调用各种底图
# 字符编码:UTF-8
# R 版本:R x64 4.0.3 for window 10
# [email protected]
# 个人笔记不负责任
# —— 拎了个梨
.rs.restartR()
require(mapedit)
require(leaflet)
require(leafletCN)
# drawFeatures在地图上简单画画
rm(list=ls());gc()
dr.dt<- leaflet() %>% amap() %>% # 高德地图打底
drawFeatures(
map = .,
sf = TRUE, #返回sf或genjson对象
record = FALSE,
viewer = shiny::paneViewer(),
title = "鼠标画图",
editor = c("leaflet.extras", "leafpm"),
editorOptions = list(),
)
plot(dr.dt)
dev.copy(png,'默认是sf对象.jpg');dev.off()
# Fri Dec 18 17:05:42 2020 ------mapbox做底图------------------------
require(mapboxapi)
require(leaflet)
require(mapedit)
mapbox.dr.sf <- leaflet() %>%
addMapboxTiles(style_id = "light-v9",
username = "mapbox") %>%
drawFeatures(map = ., sf = TRUE,
title = 'mapbox做底图')
plot(mapbox.dr.sf[1])
# Fri Dec 18 17:06:52 2020 --end