Learn R Programming

stplanr (version 0.1.4)

toptailgs: Clip the first and last n metres of SpatialLines

Description

Takes lines and removes the start and end point, to a distance determined by the user. Uses the geosphere::distHaversine function and requires coordinates in WGS84 (lng/lat).

Usage

toptailgs(l, toptail_dist, tail_dist = NULL)

Arguments

l
A SpatialLines object
toptail_dist
The distance (in metres) to top the line by. Can be either a single value or a vector of the same length as the SpatialLines object. If tail_dist is missing, is used as the tail distnce.
tail_dist
The distance (in metres) to tail the line by. Can be either a single value or a vector of the same length as the SpatialLines object.

Examples

Run this code
data("routes_fast")
r_toptail <- toptailgs(routes_fast, toptail_dist = 300)
plot(routes_fast, lwd = 3)
plot(r_toptail, col = "red", add = TRUE)
plot(cents, add = TRUE)

Run the code above in your browser using DataLab