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.
mt_azimuth(x, units)mt_turnangle(x, units)
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
.
a move2
object. Timestamps must be ordered within tracks and only contain location data and
it must be in a geographic coordinate system or without a coordinate reference system (See 'Details').
Optional. Valid values are character
, symbolic_units
or units
, for more details see the value
argument of units::as_units. If no units are stated (default) the function flexibly determines the units to return. Fixing the units can be useful if specific return units are for example required for subsequent functions. This argument only takes effect if the initial return value already has units.
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.
Other track-measures:
mt_distance()
,
mt_time()
data <- mt_sim_brownian_motion()
mt_azimuth(data)
mt_turnangle(data)
x <- mt_read(mt_example())[330:340, ]
mt_azimuth(x)
mt_turnangle(x)
Run the code above in your browser using DataLab