我正在使用传单包在我闪亮的应用程序上制作 chloropleth us state map。我发现渲染地图非常慢。谷歌搜索后,看起来 shapefile 可能过于复杂和简化,这可能会使其速度更快。根据这篇文章,简化 shapefile 可能是答案。
读取形状文件工作正常。我能够渲染我的传单地图。
states_shape <- tigris::states(cb = TRUE, resolution='500k')
leaflet(states_shape) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(fillColor = "white",
color = "black",
weight = 0.5) %>%
setView(-98.5795, 39.8282, zoom=3)
我试图简化我的 shapefilermapshaper::ms_simplify
states_shape_simple <- rmapshaper::ms_simplify(states_shape, keep = 0.05, keep_shapes = TRUE)
我收到如下错误:
Error in FUN(X[[i]], ...) : isTRUE(gpclibPermitStatus()) is not TRUE
我不知道这意味着什么以及该怎么做。有谁知道为什么会发生这种情况以及如何使其工作?非常感谢!