Skip to contents

Convert between different representations of latitude and longitude, namely degrees-minutes-decimal minutes (DDMMmm) and decimal degrees (DD.dd).

Adapted from geo::geoconvert to be dplyr pipe friendly

Usage

geo_convert(x, inverse = FALSE, na = FALSE)

Arguments

x

A vector of the form DDMMmm or DD.dd

inverse

Which conversion should be undertaken, default from degrees-minutes-decimal minutes (DDMMmm) to decimal degrees (DD.dd)

na

A boolean, if FALSE (default) minutes larger than 60 are rounded up, if TRUE returns NA's. Only appicable when inverse TRUE.

Author

Hoskuldur Bjornsson <hoski@hafro.is>

Examples

geo_convert(c(-124598, 032269))
#> [1] -12.766333   3.378167
geo_convert(c(-124598, 037569), na = TRUE)
#> [1] -12.76633        NA
geo_convert(c(-12.766333, 3.378167), inverse = TRUE)
#> [1] -124598   32269