简体   繁体   English

leaflet 中的多边形背景

[英]Polygon background in leaflet

Is there a way (better in R not to download any additional datasets) how to make polygon (or more visible country borders) in leaflet有没有办法(在 R 中最好不要下载任何其他数据集)如何在 leaflet 中制作多边形(或更明显的国家边界)

Using simple code使用简单的代码

m = leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addCircles(lat=15,lng=18, radius = 300, color = "blue")

m

There is a world sf-dataset in spData -package. spData中有一个世界 sf 数据集。

library(leaflet)
library(sf)
library(spData)

leaflet() %>% 
addProviderTiles("CartoDB.Positron") %>% 
addPolygons(data = world[world$continent == "Europe",], weight = 1)

If you just want the outlines of the countries, use: addPolylines()如果您只想要国家/地区的轮廓,请使用: addPolylines()

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM