dms_to_decimal {Tivy}R Documentation

Convert latitude or longitude to decimal degrees

Description

Converts coordinates expressed in degrees, minutes and seconds (DMS) or degrees and minutes (DM) format to decimal degrees. By default, coordinates are assumed to be in the southern hemisphere (negative latitudes). The function can automatically correct common errors such as minutes or seconds greater than 60.

Usage

dms_to_decimal(coordinates, hemisphere = "S", correct_errors = TRUE)

Arguments

coordinates

Character vector. Each element should be in formats such as: "D M S", "D M", "17 26 S"

hemisphere

Character indicating hemisphere when not specified in the coordinate. One of "N", "S", "E", "W" or "O". "S" and "W"/"O" generate negative values.

correct_errors

Logical. If TRUE, automatically corrects out-of-range values.

Value

Numeric vector with coordinates converted to decimal degrees.

Examples

dms_to_decimal(c("73 15 0"), hemisphere = "W")


[Package Tivy version 0.1.0 Index]