if (interactive()) {
# Create example data
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))
),
green_index = runif(5)
)
st_crs(lines) <- 4326
mapbox_token <- "your_mapbox_token"
create_linestring_3D(lines, "green_index", mapbox_token)
}
Run the code above in your browser using DataLab