Examples for 'stplanr::line2points'


Convert a spatial (linestring) object to points

Aliases: line2points line2pointsn line2vertices

Keywords:

### ** Examples

l <- routes_fast_sf[2, ]
lpoints <- line2points(l)
Error in st_geometry.sf(x): attr(obj, "sf_column") does not point to a geometry column.
Did you rename it, without setting st_geometry(obj) <- "newname"?
plot(l$geometry)
Error in xy.coords(x, y, xlabel, ylabel, log): 'x' is a list, but does not have components 'x' and 'y'
plot(lpoints, add = TRUE)
Error in plot(lpoints, add = TRUE): object 'lpoints' not found
# test all vertices:
plot(l$geometry)
Error in xy.coords(x, y, xlabel, ylabel, log): 'x' is a list, but does not have components 'x' and 'y'
lpoints2 <- line2pointsn(l)
Error in st_geometry.sf(x): attr(obj, "sf_column") does not point to a geometry column.
Did you rename it, without setting st_geometry(obj) <- "newname"?
plot(lpoints2$geometry, add = TRUE)
Error in plot(lpoints2$geometry, add = TRUE): object 'lpoints2' not found
# extract only internal vertices
l_internal_vertices <- line2vertices(l)
Error in st_geometry.sf(x): attr(obj, "sf_column") does not point to a geometry column.
Did you rename it, without setting st_geometry(obj) <- "newname"?
plot(sf::st_geometry(l), reset = FALSE)
Error in st_geometry.sf(l): attr(obj, "sf_column") does not point to a geometry column.
Did you rename it, without setting st_geometry(obj) <- "newname"?
plot(l_internal_vertices, add = TRUE)
Error in plot(l_internal_vertices, add = TRUE): object 'l_internal_vertices' not found
# The boundary points are missing

[Package stplanr version 1.2.2 Index]