我正在尝试从伦敦下层超级输出区 (LSOA) 的多边形列表中构建邻居列表。我从伦敦数据存储区获得了我的 shapefile,通过此处下载:https ://data.london.gov.uk/dataset/statistical-gis-boundary-files-london
当我阅读 2004 shapefile ( LSOA_2004_London_Low_Resolution.shp
) 时,它运行良好:
ldn <- st_read("statistical-gis-boundaries-london/ESRI/LSOA_2004_London_Low_Resolution.shp")
#make into sp
ldn_sp <- as(ldn, "Spatial")
#create a list of neighbours using the Queen criteria (default, if you want rook chage to queen = FALSE)
w <- poly2nb(ldn_sp)
plot(ldn_sp, border = "grey60")
plot(w, coordinates(ldn_sp), pch = 19, cex = 0.6, add = TRUE)
然而,当我阅读 2011 年 shapefile ( LSOA_2011_London_gen_MHW.shp
) 时,似乎认为大多数 LSOA 没有邻居。
当我使用具有相同代码的 2011 版本时,我得到以下信息:
ldn <- st_read("statistical-gis-boundaries-london/ESRI/LSOA_2011_London_gen_MHW.shp")
ldn_sp <- as(ldn, "Spatial")
w <- poly2nb(ldn_sp)
plot(ldn_sp, border = "grey60")
plot(w, coordinates(ldn_sp), pch = 19, cex = 0.6, add = TRUE)
有谁知道我做错了什么?显然应该有邻居的 LSOA 显示为 0 个链接。我不知道为什么...!