特定距离内的 SPATSTAT 重复点

SPATSTAT duplicated points within a a specific distance

我在 R studio 中有一个坐标数据集,我正在尝试删除位于彼此一定距离(即 20 米)内的重复点。 任何的想法? 谢谢

winch2<- data.frame(Lon=c(-1.560367, -1.078330 ), Lat=c( 50.576342, 51.243823)) coordinates(winch2) <- ~Lon + Lat proj4string(winch2) <- latlong winch2 <- spTransform(winch2, bng) (floor (coordinates (winch2) / 1000) + 0.5) * 1000 W2<- owin(c(431500,464500), c( 75500, 149500)) Region<- allpop_strat[W2]

Subset from a bigger Window of points

summary(Region)

Marked planar point pattern: 371 points Average intensity 1.519247e-07 points per square unit

Coordinates are given to 2 decimal places i.e. rounded to the nearest multiple of 0.01 units

marks are numeric, of type ‘double’ Summary: Min. 1st Qu. Median
Mean 3rd Qu. Max. 0.0100 0.0100 0.0100 0.4078 1.0000 6.0000

Window: rectangle = [431500, 464500] x [75500, 149500] units Window area = 2.442e+09 square units

anyDuplicated(Region) 0

But I want any duplicated within a specific distanve


在关闭点成对出现的简单情况下,下面的代码 应该足以删除近邻。删除什么取决于 关于点的排序。如果距离内有很多点 R (例如20 m)彼此之间可能有很多解决方案 问题和下面的代码可能会或可能不会产生您需要的东西。

library(spatstat)
X <- unmark(amacrine) # Built-in dataset for demonstation
R <- 0.03 # Distance of "close pairs"
close_list = closepairs(X, rmax = R, twice = FALSE)
close_index <- close_list$j
plot(X, main = "Test data with points to be deleted in red")
plot(X[close_index], col = "red", pch = 20, add = TRUE)

Y <- X[-close_index]
plot(Y, main = "Retained points after removal of close points.")