У меня есть два пространственных объекта, один - это точки nc_point
(n = 50), а другой - многоугольники sample_polygons
(n = 20). Некоторые точки разбиты на многоугольники, которые можно определить с помощью функции nc_point[sample_polygons , ]
.
Мой вопрос заключается в том, как получить подмножество всех точек, которые НЕ попадают ни в какие многоугольники, т.е. в остальные точки?
# points layer contain 50 points
nc_point <- st_read(system.file("shape/nc.shp", package="sf")) %>%
st_centroid()
# the number of polygons is 20
set.seed(1)
sample_polygons <- st_read(system.file("shape/nc.shp", package="sf")) %>%
sample_n(20) %>%
select(geometry) # to mimic a situation where points are only identified using spatial correlation.
# points that fall in polygons can be identified using:
points_in <- nc_point[sample_polygons , ]
# how to find out points that are not fallen in any polygons?
Спасибо,
Phil