Learn R Programming

stplanr (version 0.9.0)

line_breakup: Break up line objects into shorter segments

Description

This function breaks up a LINESTRING geometries into smaller pieces.

Usage

line_breakup(l, z)

Arguments

l

An sf object with LINESTRING geometry

z

An sf object with POLYGON geometry or a number representing the resolution of grid cells used to break up the linestring objects

Value

An sf object with LINESTRING geometry created after breaking up the input object.

See Also

Other lines: angle_diff(), geo_toptail(), is_linepoint(), line2df(), line2points(), line_bearing(), line_midpoint(), line_sample(), line_segment_sf(), line_segment(), line_via(), mats2line(), n_sample_length(), n_vertices(), onewaygeo(), points2line(), toptail_buff(), toptailgs(), update_line_geometry()

Examples

Run this code
# NOT RUN {
library(sf)
z <- zones_sf$geometry
l <- routes_fast_sf$geometry[2]
l_split <- line_breakup(l, z)
l
l_split
sf::st_length(l)
sum(sf::st_length(l_split))
plot(z)
plot(l, add = TRUE, lwd = 9, col = "grey")
plot(l_split, add = TRUE, col = 1:length(l_split))
# }

Run the code above in your browser using DataLab