dms2dd {RWmisc}R Documentation

Convert from degrees, minutes, and seconds to decimal degrees

Description

Convert latitudes and longitudes from degrees, minutes, and seconds to decimal degrees for conversion to spatial objects.

Usage

dms2dd(lon, lat)

Arguments

lon

a character vector of longitude coordinates in degrees, minutes, and seconds; see details

lat

a character vector of latitude coordinates in degrees, minutes, and seconds; see details

Details

lon and lat are expected to be in the format ⁠"degrees° minutes' seconds" (direction)"⁠ where direction is optional. If direction is not present, dms2dd will use negative signs (-) to determine positioning of coordinates.

Value

An n * 2 matrix where n is the length of lon and lat.

Examples

ll <- data.frame(lon = c("-122° 19' 55\"",
                         "71° 3' 32\" W"),
                 lat = c("47° 36' 22\"",
                         "42° 21' 36\" N"),
                 stringsAsFactors = FALSE)
dms2dd(ll[, 'lon'], ll[, 'lat'])

[Package RWmisc version 0.1.2 Index]