Learn R Programming

TCHazaRds (version 1.1.2)

TCpoints2lines: Convert Points to Line Segments

Description

This function converts a set of point geometries into line segments. The input vector must be a set of points, and the function will draw line segments between consecutive points. An additional point is extrapolated from the last two points to ensure the final segment is complete.

Usage

TCpoints2lines(pts_v)

Value

A `SpatVector` containing line geometries created from the input points.

Arguments

pts_v

A `SpatVector` of points (from the `terra` package).

Examples

Run this code
library(terra)
# Create example points
pts <- vect(matrix(c(1, 1, 2, 2, 3, 3), ncol=2), type="points")
# Convert points to line segments
TClines <- TCpoints2lines(pts)

Run the code above in your browser using DataLab