Combining SpatialPolygonsDataFrame of two neighbour countries

浪尽此生 提交于 2019-12-11 03:33:01

问题


I want to combine the SpatialPolygonsDataFrame of two neighbour countries like Pakistan and India. My MWE is below:

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

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

How can I combine these two shapefiles?


回答1:


From the answer to this question, use rbind and the argument makeUniqueIDs.

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



来源:https://stackoverflow.com/questions/31108927/combining-spatialpolygonsdataframe-of-two-neighbour-countries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!