line_azimuth: Extract azimuths of line segments

View source: R/various.R

line_azimuthR Documentation

Extract azimuths of line segments

Description

Extract azimuths of line segments

Usage

line_azimuth(x, warn = TRUE)

lines_azimuths(x)

Arguments

x

sf object of type "LINESTRING" or "MULTILINESTRING"

warn

logical; if TRUE, warn if "MULTILINESTRING" (default).

Details

It is recommended to perform line_azimuth() on single line objects, i.e. type "LINESTRING", instead of "MULTILINESTRING". This is because the azimuth of the last point of a line will be calculated to the first point of the next line otherwise. This will cause a warning message (if warn = TRUE). For "MULTILINESTRING" objects, use lines_azimuths().

Value

sf object of type "POINT" with the columns and entries of the first row of x

Examples

data("plates")

# one line:
subset(plates, pair == "af-eu") |>
  smoothr::densify() |>
  line_azimuth()

# multiple lines:
lines_azimuths(plates[1:5, ])

tectonicr documentation built on April 4, 2025, 12:54 a.m.