Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

geo_toptail

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.

Usage

geo_toptail(l, toptail_dist, ...)

Arguments

l

A SpatialLines object

toptail_dist

The distance (in metres) to top and tail the line by. Can either be a single value or a vector of the same length as the SpatialLines object.

...

Arguments passed to rgeos::gBuffer()

Details

Note: toptailgs() is around 10 times faster, but only works on data with geographic CRS's due to its reliance on the geosphere package.

See Also

Examples

lib_versions <- sf::sf_extSoftVersion()
lib_versions
# dont test due to issues with sp classes on some set-ups
if (lib_versions[3] >= "6.3.1") {
  # l <- routes_fast[2:4, ] # to run with sp classes
  l <- routes_fast_sf[2:4, ]
  l_top_tail <- geo_toptail(l, 300)
  l_top_tail
  plot(sf::st_geometry(l_top_tail))
  plot(sf::st_geometry(geo_toptail(l, 600)), lwd = 9, add = TRUE)
}

stplanr

Sustainable Transport Planning

v0.8.2
MIT + file LICENSE
Authors
Robin Lovelace [aut, cre] (<https://orcid.org/0000-0001-5679-6536>), Richard Ellison [aut], Malcolm Morgan [aut] (<https://orcid.org/0000-0002-9488-9183>), Barry Rowlingson [ctb], Nick Bearman [ctb], Nikolai Berkoff [ctb], Scott Chamberlain [rev] (Scott reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/10), Mark Padgham [ctb], Andrea Gilardi [ctb] (<https://orcid.org/0000-0002-9424-7439>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.