Learn R Programming

stplanr (version 0.5.0)

toptail_buff: Clip the beginning and ends SpatialLines to the edge of SpatialPolygon borders

Description

Takes lines and removes the start and end point, to a distance determined by the nearest polygon border.

Usage

toptail_buff(l, buff, ...)

Arguments

l

A SpatialLines object

buff

A SpatialPolygons object to act as the buffer

...

Arguments passed to rgeos::gBuffer()

See Also

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

Examples

Run this code
# NOT RUN {
r_toptail <- toptail_buff(routes_fast, zones)
sel <- row.names(routes_fast) %in% row.names(r_toptail)
rf_cross_poly <- routes_fast[sel, ]
plot(zones)
plot(routes_fast, col = "blue", lwd = 4, add = TRUE)
# note adjacent lines removed
plot(rf_cross_poly, add = TRUE, lwd = 2)
plot(r_toptail, col = "red", add = TRUE)
# }

Run the code above in your browser using DataLab