wch / webshot

Take screenshots of web pages from R
http://wch.github.io/webshot/
228 stars 40 forks source link

webshot does not preserve addWebGLHeatmap layer from leaflet.extras #67

Closed mgrogger closed 6 years ago

mgrogger commented 6 years ago

Hello, I noticed on Stack Overflow that there was an unresolved question about this dated to August 2017, and that in the comments someone suggested to open an issue here, but I did not see one posted.

My issue is this: when I execute the following code in RStudio, I produce this image:

map = leaflet(df) %>%
      addWebGLHeatmap(lng=~df$longitude, lat=~df$latitude, opacity= 1 , intensity = .5 ,size = 1000, gradientTexture='deep-sea', data=df)%>%
      addTiles(urlTemplate = map, attribution=attr)

screen shot 2018-07-12 at 4 31 22 pm However, when I try to save it using webshot with this code:

saveWidget(map, "tmp.html", selfcontained = F)
webshot("temp.html", file = "new_orleans.png", cliprect = "viewport")

It instead produces: new_orleans_la_map

Is there a way to resolve this? Thanks!

wch commented 6 years ago

The problem is that webshot uses phantomjs, which doesn't support WebGL. In the future, webshot will probably migrate to a different browser backend, but we don't have a timeline in place for that yet.