Используя st_cast(.,"POINT")
, st_coordinates()
и наконечник, предоставленный @Allan_Cameron:
library(sf)
#reprex
yourshape.sfc <- st_geometry(st_read(system.file("shape/nc.shp",
package = "sf")))[1]
# Cast to points
yourpoints <- st_cast(yourshape.sfc, "POINT")
#Get unique coords
coords = as.data.frame(unique(st_coordinates(yourpoints)))
#Asses minimimun and unique
index <- which(coords$Y == min(coords$Y))
minims = yourpoints[index]
minims
#> Geometry set for 1 feature
#> geometry type: POINT
#> dimension: XY
#> bbox: xmin: -81.47276 ymin: 36.23436 xmax: -81.47276 ymax: 36.23436
#> epsg (SRID): 4267
#> proj4string: +proj=longlat +datum=NAD27 +no_defs
#> POINT (-81.47276 36.23436)
plot(st_geometry(yourshape.sfc))
plot(minims, col = "green", pch = 20, cex = 2, add = TRUE)
plot(yourpoints, col = "red", pch = 20, add = TRUE)
Создано в 2020- 03-03 * представьте пакет (v0.3.0)