R/intersect.R

library(sf)
pt <- st_point(c(2,3))
circle <- st_buffer(pt,0.75)
square1 <- st_polygon(list(rbind(c(1,1), c(1,3), c(3,3), c(3,1), c(1,1))))
square2 <- st_polygon(list(rbind(c(1,3), c(1,5), c(3,5), c(3,3), c(1,3))))
squares <- st_sf(st_sfc(list(square1, square2)),data.frame(id = c(1,2)))
plot(squares)
plot(circle, add=T)
intersxn <- st_intersection(circle,squares)
plot(st_boundary(intersxn))
willbmisled/lakescape documentation built on May 5, 2019, 9:03 p.m.