make a dataset of 2 sets of coordinates in longitude and latitude format, then using st_as_sf convert these into 2 geometry columns in r

main.r
# Create a dataset with 2 sets of coordinates
data <- data.frame(
  lon = c(10, 20),
  lat = c(45, 50)
)

library(sf)

# Convert the dataset into an sf object with 2 geometry columns
sf_data <- st_as_sf(data, coords = c("lon", "lat"), crs = 4326)
sf_data
255 chars
12 lines

related categories

gistlibby LogSnag