ConvertToDD: Degrees Minutes Seconds/Decimal Minutes - Decimal Degrees...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ConvertToDD.R

Description

Takes a set of coordinates in either degrees minutes seconds or degrees decimal minutes, and converts them to decimal degrees format (##.#####; -##.#####). The function is flexible to take the input coordinates in several different formats.

Usage

1
ConvertToDD(XY, FileSep=NULL, LatColName, LongColName)

Arguments

XY

Input dataset; either the name of an object already in the workspace, or a file to be read in by specifying its file path as a character string.

FileSep

If XY is a character string that corresponds to a file path, choose the delimiter character for that file (e.g. "," for comma separated).

LatColName

Character string; the name of the column in XY containing latitude data.

LongColName

Character string; the name of the column in XY containing longitude data.

Details

There is flexibility in the layout of each degrees input format. For example, N-S/E-W can be described by positive-negative coordinates or by using respective letters at the end of each coordinate. For coordinates in degrees minutes seconds to be converted requires three numbers - degrees, minutes, and seconds - each separated by a single non-numeric character (e.g. 51d24'51.106"N 0d38'56.018"W). For coordinates in degrees minutes to be converted requires just two numbers - degrees and minutes (e.g. 51d24.106'N 0d38.018'W). Coordinates should not contain spaces in between the numbers. The degrees format does not have to be consistent throughout the data set.

Value

Output is a data frame of same dimensions as input, with each value converted to decimal degrees, named "DD.lat" and "DD.long".

Author(s)

Sean Tuck

See Also

MODISSubsets

Examples

1
2
data(ConvertExample)
ConvertToDD(XY=ConvertExample, LatColName="lat", LongColName="long")

seantuck12/MODISTools documentation built on May 29, 2019, 4:55 p.m.