dms2dd {RWmisc} | R Documentation |
Convert latitudes and longitudes from degrees, minutes, and seconds to decimal degrees for conversion to spatial objects.
dms2dd(lon, lat)
lon |
a character vector of longitude coordinates in degrees, minutes,
and seconds; see |
lat |
a character vector of latitude coordinates in degrees, minutes,
and seconds; see |
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.
An n * 2
matrix where n is the length of lon
and lat
.
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'])