我有一个与美国县的档案,我读到r与readOGR()。我需要将美国3,000个县合并成更大的区域,例如929核心统计区域(NBER提供了一个从县FIPS到它的人行横道)。在平面设计中,这将是形状的结合。我可以在不使用地理信息系统的情况下以编程方式在R中这样做吗?
发布于 2018-06-21 12:26:56
使用来自rmapshaper的函数rmapshaper。例如,将县的形状统一为州:
library(rmapshaper)
# Download the shapefile for US counties from here and save in some/dir
# www2.census.gov/geo/tiger/GENZ2010/gz_2010_us_050_00_5m.zip
counties <- readOGR(dsn="some/dir",layer="gz_2010_us_050_00_5m")
# Drop Alaska, hawaii, Puerto Rico
counties <- counties[!(counties$STATE %in% c("02","15","72")), ]
# Plot counties
plot(counties)
# Unite shapes
library(rmapshaper)
states <- ms_dissolve(counties, field = "STATE")
plot(states)县图:

县联盟各州地图:

发布于 2018-06-21 12:27:17
sf包中的友联市函数可能就是您要寻找的。sf (简单特性)使空间数据的处理比使用QGIS或ArcGis要容易得多。
https://stackoverflow.com/questions/50968220
复制相似问题