我想从下面例子中的四条线(a,b,c,d)所描绘的区域创建一个多边形.如果你能帮我,那就太好了!
a <- data.frame (x = c(1, 5, 9),
y = c(1, 0, 1))
b <- data.frame (x = c(2, 2),
y = c(0, 5))
c <- data.frame (x = c(1, 9),
y = c(4, 4))
d <- data.frame (x = c(8, 8),
y = c(0, 5))
a <- a %>%
st_as_sf(coords = c("x", "y")) %>%
dplyr::summarize(do_union=FALSE) %>%
st_cast("LINESTRING")
b <- b %>%
st_as_sf(coords = c("x", "y")) %>%
dplyr::summarize(do_union=FALSE) %>%
st_cast("LINESTRING")
c <- c %>%
st_as_sf(coords = c("x", "y")) %>%
dplyr::summarize(do_union=FALSE) %>%
st_cast("LINESTRING")
d <- d %>%
st_as_sf(coords = c("x", "y")) %>%
dplyr::summarize(do_union=FALSE) %>%
st_cast("LINESTRING")
ggplot() + geom_sf(data=a) + geom_sf(data=b) + geom_sf(data=c) + geom_sf(data=d)