How to find polygon from noisy points in sf package R

139 Views Asked by At

I am looking to create a polygon derived from a bunch of noisy points in sf. I currently have many points that roughly make a square (see image below). I would like to create a polygon that essentially fits a square around the majority of points and ignores the outliers.

enter image description here

1

There are 1 best solutions below

0
BEVAN On

I think that a minimum convex polygon around the points and playing with the percentage might achieve what you are looking for. There might be other methods but in the adehabitatHR package you need to convert your sf points to sp first

library(sf)
library(adehabitatHR)


sp_points <- as_Spatial(sf_points)

mcp_poly <-mcp(sp_points, percent = 75)