结合两个邻国的SpatialPolygonsDataFrame

时间:2015-06-29 06:15:09

标签: r spatial raster shapefile

我想结合巴基斯坦和印度这两个邻国的SpatialPolygonsDataFrame。我的MWE如下:

library(raster)
Pakistan.adm1.spdf <- 
  getData(
    "GADM"
    , country = "Pakistan"
    , level = 1
  )

India.adm1.spdf <- 
  getData(
    "GADM"
    , country = "India"
    , level = 1
  )

如何组合这两个shapefile?

1 个答案:

答案 0 :(得分:4)

the answerthis question,使用rbind和参数makeUniqueIDs

adm1.spdf <- rbind(Pakistan.adm1.spdf, India.adm1.spdf, makeUniqueIDs = TRUE)
plot(adm1.spdf)

enter image description here