Mapdeck Package in R - add_grid Does Not Appear to Render Anything

南楼画角 提交于 2019-12-12 21:52:38

问题


Problem:

The add_grid function in the R mapdeck package is very exciting. However, following the CRAN documentation, I cannot seem to get any data to actually plot on the returned map.

In other words, the map returns, but no data is plotted. Is this a known bug?

Code:

library(tidyverse)
library(mapdeck)

# - Enter mapdeck key ... Note that it is user-specific
key <- rstudioapi::askForPassword() 

# - Read Example Data Set
df <- read.csv(paste0(
  'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/',
  'examples/3d-heatmap/heatmap-data.csv'
))

# - Plot Data ... Note how the map returns, but not the data
mapdeck( token = key, style = 'mapbox://styles/mapbox/dark-v9', pitch = 45 ) %>%
  add_grid(
    data = df
    , lat = "lat"
    , lon = "lng"
    , cell_size = 5000
    , elevation_scale = 50
    , layer_id = "grid_layer"
  )

Created on 2018-09-23 by the reprex package (v0.2.1)

Output:


回答1:


This is not necessarily a 'bug' inside mapdeck itself, but more the way mapdeck communicates with RStudio. There are conflicts between the different javascript versions they use.

If you open the plot in a browser (by pressing the show in new window button in Rstudio) you should get your plot.

I've got this issue logged, but don't know the way forward yet.



来源:https://stackoverflow.com/questions/52468174/mapdeck-package-in-r-add-grid-does-not-appear-to-render-anything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!