Learn R Programming

stplanr (version 0.5.0)

points2line: Convert a series of points, or a matrix of coordinates, into a line

Description

This is a simple wrapper around spLines() that makes the creation of SpatialLines objects easy and intuitive

Usage

points2line(p)

Arguments

p

A spatial (points) obect or matrix representing the coordinates of points.

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(), toptail_buff(), toptailgs(), update_line_geometry()

Examples

Run this code
# NOT RUN {
p <- matrix(1:4, ncol = 2)
library(sp)
l <- points2line(p)
plot(l)
l <- points2line(cents)
plot(l)
p <- line2points(routes_fast)
l <- points2line(p)
plot(l)
l_sf <- points2line(cents_sf)
plot(l_sf)
# }

Run the code above in your browser using DataLab