mt_azimuth {move2} | R Documentation |
Calculate azimuths or turn angles
Description
-
mt_azimuth
: calculates the heading/azimuth/direction of movement of each segment between consecutive locations of a track. -
mt_turnangle
: calculates the relative angle between consecutive segments.
Usage
mt_azimuth(x, units)
mt_turnangle(x, units)
Arguments
x |
a |
units |
Optional. Valid values are |
Details
mt_is_time_ordered_non_empty_points
can be used to check if the timestamps are ordered and if the object only
contains location data. To omit empty locations use e.g. dplyr::filter(x,!sf::st_is_empty(x))
.
Currently the calculation of both angles is only implemented for data in a geographic coordinate system and data
without coordinates reference system. To reproject the data into long/lat use e.g.
sf::st_transform(x, crs="EPSG:4326")
Azimuths for geographic coordinates are calculated using lwgeom::st_geod_azimuth()
. The angles are relative to
the North pole.
Value
A vector of angles, currently default is in radians (between -pi
and pi
).
In mt_azimuth
north is represented by 0, positive values are movements towards the east, and negative values
towards the west. The last value for each track will be NA
.
In mt_turnangle
negative values are left turns and positive right turns. The first and the last value for each
track will be NA
.
See Also
Other track-measures:
mt_distance()
,
mt_time()
Examples
data <- mt_sim_brownian_motion()
mt_azimuth(data)
mt_turnangle(data)
x <- mt_read(mt_example())[330:340, ]
mt_azimuth(x)
mt_turnangle(x)