Extracts coordinates from an sf points object and returns them as a plain numeric vector, dropping any geometry list-column.

extract_coords(points_sf)

Arguments

points_sf

An sf or sfc points object.

Value

A numeric vector of coordinates.

Examples

pt <- sf::st_sf(
  id = 1,
  geometry = sf::st_sfc(sf::st_point(c(3, 4)), crs = 4326)
)
extract_coords(pt)
#> [1] 3 4