结合两个邻国的SpatialPolygonsDataFrame [英] Combining SpatialPolygonsDataFrame of two neighbour countries
本文介绍了结合两个邻国的SpatialPolygonsDataFrame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想合并两个邻国(例如巴基斯坦和印度)的 SpatialPolygonsDataFrame
.我的 MWE 如下:
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
)
如何组合这两个 shapefile?
How can I combine these two shapefiles?
推荐答案
从答案到这个问题,使用rbind
和参数 makeUniqueIDs
.
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)
这篇关于结合两个邻国的SpatialPolygonsDataFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文