MYaseen208
MYaseen208

Reputation: 23898

Combining SpatialPolygonsDataFrame of two neighbour countries

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?

Upvotes: 2

Views: 1870

Answers (1)

user3710546
user3710546

Reputation:

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)

enter image description here

Upvotes: 4

Related Questions