Sharing html link produced with leaflet package

I produced a map with leaflet package, and saved it as an html widget. This produces also a folder with the javascript data.

I want to share the html link to people who don't have the javascript folder, but the link doesn't work alone. How I can send the html link alone?

R code:
leaflet() %>%
addProviderTiles( "OpenStreetMap.Mapnik" ) %>%
addCircleMarkers(....
addRasterImage(....
saveWidget( "mypath.html", selfcontained=F)

If I try 'Selfcontained=T', I get an error regarding PANDOC.

Thanks

1 Like

This seems unusual... htmltools::saveWidget should not have anything to do with PANDOC. Strange.

Consider this code, it produces the plainest of plain vanilla leaflets & saves it as a html document. It is also reproducible :slight_smile:

library(sf)
library(leaflet)

# the iris of spatial data...
shape <- st_read(system.file("shape/nc.shp", package="sf")) %>%  # included with sf package
  st_transform(4326) # just because WGS84

# the plainest of plain vanilla leaflets
map <- leaflet() %>% 
  addProviderTiles(providers$Stamen.Toner) %>% 
  addPolygons(data = shape, color = "red", 
              label = ~NAME) 

# save it!
htmlwidgets::saveWidget(map, "map.html", selfcontained = T)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.