deg2str: Coordinate Conversion Functions

View source: R/deg2str.R

deg2strR Documentation

Coordinate Conversion Functions

Description

Convert a decimal-degree coordinate to a formatted character string suitable for printing.

Usage

deg2str(
  deg = NULL,
  latitude = NULL,
  longitude = NULL,
  clip = TRUE,
  northing = TRUE,
  easting = TRUE,
  as.list = FALSE,
  language = "english",
  ...
)

Arguments

deg

A numeric vector of coordinates in decimal degree format.

longitude, latitude

Numeric decimal degree coordinate value(s). If northing = TRUE or easting = TRUE then the corresponding Northing (i.e. "N" or "S") or Easting character (i.e. "E" or "W") is included in the output character string.

clip

A logical value. Whether to strip away coordinate seconds or minutes and seconds when they have zero values. The resulting output strings are of an abridged form. The default is TRUE.

northing, easting

Logical value specifying whether to include a Northing (i.e. "N" or "S") or Easting (i.e. "E" or "W") character in the output string when longitude or latitude are specified.

as.list

Logical value specifying whether to return the output as a list object. The default is FALSE.

language

Lanaguage with which to state easting and northing symbols.

Value

If a single argument is provided and as.list is FALSE, then the returned output is a character string vector. Otherwise, the output is returned as a list with fields longitude and latitude.

See Also

deg2dms, deg2dmm

Examples

# Convert generic coordinate:
deg2str(c(45, 47.5))
deg2str(c(45, 47.5), clip = FALSE)

# Convert latitude coordinate, which adds the northing character to the output:
deg2str(lat = c(45, 47.5))
deg2str(long = c(-66, -66.5))

# Convert vectors of lat-long coordinates, which are returned as a list:
deg2str(latitude = 45:47, longitude = -64:-66, clip = FALSE)


TobieSurette/gulf.spatial documentation built on Sept. 26, 2024, 7:41 p.m.