Given a spatial polygon
library(sf) df <- data.frame( lon = c(119.4, 119.4, 119.4, 119.5, 119.5), lat = c(-5.192, -5.192, -5.167, -5.167, -5.191) ) polyg