2017-04-22 8 views
0

복수의 .shp 파일을 하나의 객체로 읽는 방법?여러 개의 .shp 파일을 하나의 객체로 읽으시겠습니까?

코드 아래처럼 간단하게 읽고 싶습니다.

nc <- st_read(dsn = "nc", 
       layer = c("nc1","nc2")) 

여러 파일을 개체로 읽는 가장 좋은 방법은 무엇입니까? 당신이 공간 - 다각형의 data.frame로 읽고있는 경우 [여기]를 제안

library(sf) 
nc <- st_read(system.file("shape/nc.shp", package="sf")) 

nc1 <- nc[1:50, ] 
nc2 <- nc[51:100, ] 

st_write(nc1, 
     dsn = "nc", 
     layer = "nc1", 
     driver = "ESRI Shapefile") 

st_write(nc2, 
     dsn = "nc", 
     layer = "nc2", 
     driver = "ESRI Shapefile",update = T) 
+2

, 당신은 https://gis.stackexchange.com/questions/155328/merging-multiple- (병합 수 spatialpolygondataframes-into-1-spdf-in-r), 그렇지 않으면, 당신은 아크가없는 해결책을 찾아야 할 것입니다. –

답변

2
do.call(rbind, lapply(c("nc1", "nc2"), function(x) st_read("nc", layer = x)))