# \donttest{
library(sf)
library(dplyr)
# Create example data with a CRS
lines <- st_sf(
id = 1:5,
geometry = st_sfc(
st_linestring(matrix(c(0,0, 1,1), ncol=2, byrow=TRUE)),
st_linestring(matrix(c(1,1, 2,2), ncol=2, byrow=TRUE)),
st_linestring(matrix(c(2,2, 3,3), ncol=2, byrow=TRUE)),
st_linestring(matrix(c(3,3, 4,4), ncol=2, byrow=TRUE)),
st_linestring(matrix(c(4,4, 5,5), ncol=2, byrow=TRUE))
),
crs = 4326 # Assign WGS84 CRS
)
# Convert geometries to points
points <- convert_to_point(lines)
# }
Run the code above in your browser using DataLab