R中的传单地图上的3D Barplot可视化

问题描述:

我正在使用R和Leaflet(在闪亮的应用程序中). 我有要通过地图上的3D图可视化的点数据-像这样:

I am using R and Leaflet (in a shiny app). I have point data which I want to visualize through a 3D plot on a map - like this: https://slipiste.wordpress.com/2015/09/29/3d-bar-plot-on-a-map-in-r/ Understandable how to do that if not done on leaflet. But how to do plot that on a leaflet map? Is there a way to do that?

我认为他们必须在我的传单地图上覆盖一个shapefile(透明),然后在该shapefile上绘制3D Barplot.但是,这似乎是一个混乱的解决方法.但是,我没有找到有关该主题的任何网站.有提示吗?

They way I see it would have to overlay a shapefile (transparent) over my leaflet map and plot the 3D Barplot on that shapefile. However, that seems like a messy workaround. But, I did not find any websites on that topic. Any hints?

library(mapdeck)上的几年时间可以让您在地图上绘制3D条形图

A few years on library(mapdeck) lets you plot a 3D bars on a map

library(mapdeck)

set_token("MAPBOX_TOKEN") ## you'll need an API token

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

mapdeck(
  style = mapdeck_style('dark')
  , pitch = 45 
  ) %>%
  add_grid(
    data = df[1:30000, ]
    , lat = "lat"
    , lon = "lng"
    , cell_size = 1000
    , elevation_scale = 50
    , layer_id = "grid_layer"
  )

从v0.2.1006开始,您可以使用add_column()函数

And from v0.2.1006 you can use the add_column() function