0

Is there a way (better in R not to download any additional datasets) how to make polygon (or more visible country borders) in leaflet

Using simple code

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

m
Humpelstielzchen
  • 6,126
  • 3
  • 14
  • 34
Thomas Kyle
  • 101
  • 1
  • 8

1 Answers1

1

There is a world sf-dataset in spData-package.

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()

enter image description here

Humpelstielzchen
  • 6,126
  • 3
  • 14
  • 34
  • Thank zou very muth I used you advice and rewrite it a bit so the polygons are only around the country `addPolygons(data = world, col = 'black', fillOpacity = 0.0001, smoothFactor = 0.0001, weight = 2)` – Thomas Kyle Oct 12 '19 at 19:53