首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Foundry中的代码工作簿中创建叶地图

在Foundry中的代码工作簿中创建叶地图
EN

Stack Overflow用户
提问于 2021-06-16 16:52:29
回答 1查看 66关注 0票数 3

有人在Code Workbook中使用r-Leaflet创建了一个leaflet地图吗?我有一个运行正常的脚本(也是在R中双重检查),但是我如何让它可视化,然后在报告中使用等。我尝试了各种调整,可以让它运行,但没有成功-任何想法

代码语言:javascript
复制
leaflet_map <- function(map_data) {
    library(leaflet)
data<-map_data
# first cut the continuous variable into bins
# these bins are now factors
data$Fill_rateLvl <- cut(data$Fill_rate, 
                        c(0,.5,0.6,0.7,0.8,0.9,1), include.lowest = T,
                        labels = c('<50%', '50-60%', '60-70%', '70-80%', '80-90%','90-100%'))

# then assign a palette to this using colorFactor
# in this case it goes from red for the smaller values to yellow and green
# standard stoplight for bad, good, and best
FillCol <- colorFactor(palette = 'RdYlGn', data$Fill_rateLvl)

m<-leaflet() %>%
addTiles() %>%
 addProviderTiles(providers$CartoDB.Positron)%>%
  setView(lng = -0, lat = 50, zoom = 8) %>%
      addCircleMarkers(data = data, lat = ~lat, lng = ~long,
                       color = ~FillCol(Fill_rateLvl), popup = data$Lead_employer,
                       radius = ~sqrt(Fill_rate*50), group = 'Fill rate') %>%
                        addLegend('bottomright', pal = FillCol, values = data$Fill_rateLvl,
            title = 'Fill rate for next two weeks',
            opacity = 1)
return(NULL)
}
EN

回答 1

Stack Overflow用户

发布于 2021-06-21 15:33:14

我不熟悉代码工作簿中的R,但在我看来,您需要将您的传单地图物化为数据集,然后在某种地图兼容的UI中使用它。

例如,slate有一个有传单支持的地图小部件。您可以在yourfoundrystackhere.com/workspace/documentation/product/slate/map-widget中找到相关的文档和示例

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67999372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档