r - rMap 塞尔维亚在哪里找?
问题描述
有人可以帮我在哪里下载塞尔维亚地图,rMaps
以及如何在这张地图上将一些变量与市政当局联系起来?
我已经安装rMaps
...
mtq <- st_read("C:/Users/vjovanovic/Documents/R/win-library/3.5/cartography/shape/martinique.shp")
plot(st_geometry(mtq))
propSymbolsLayer(x = mtq, var = "P13_POP", legend.title.txt = "Population", col = "#a7dfb4")
srb <- st_read("C:/Users/vjovanovic/Documents/R/win-library/3.5/cartography/shape/rs_10km.shp")
plot(st_geometry(srb))
解决方案
https://gadm.org/ 你可以根据坚果在这里下载地图。我建议你使用sp package R 。下载你想要的地图数据的sp文件。然后你可以用 .
serbia<-readRDS(" your path of the map file here") .
这是一种特殊的数据类,称为 sp 包的 spatialpolygons 数据帧。此数据有插槽。您可以查看插槽名称。
slotNames(serbia)
您可以根据ID添加您想要的数据。这是一个例子。 https://rpubs.com/BeccaStubbs/bringing_shapefiles_into_R