formatCoord: Format Geographical Coordinates

View source: R/formatCoord.R

formatCoordR Documentation

Format Geographical Coordinates

Description

This function formats geographical coordinates to decimal degrees and replaces missing coordinates by the coordinates obtained from the gazetteer.

Usage

formatCoord(
  coords,
  lat = "decimalLatitude",
  lon = "decimalLongitude",
  flag = TRUE,
  lat.orig = "decimalLatitude",
  lon.orig = "decimalLongitude",
  lat.gazet = "latitude.gazetteer",
  lon.gazet = "longitude.gazetteer",
  res.gazet = "resolution.gazetteer",
  lat.new = "decimalLatitude.new",
  lon.new = "decimalLongitude.new",
  rm.gazet = FALSE
)

Arguments

coords

data.frame

lat

character. The name of the column containing the latitude. Default to "decimalLatitude".

lon

character. The name of the column containing the longitude. Default to "decimalLongitude".

flag

logical. Should the differences between the original and edited coordinates be flagged? Default to TRUE.

lat.orig

character. The name of the column containing the latitude. Default to "decimalLatitude".

lon.orig

character. The name of the column containing the longitude. Default to "decimalLongitude".

lat.gazet

character. The name of the column containing the latitude from the gazetteer. Default to "latitude.gazetteer".

lon.gazet

character. The name of the column containing the longitude from the gazetteer. Default to "longitude.gazetteer".

res.gazet

character. The name of the column containing the resolution of the locality information from which the gazetteer coordinates were obtained.

lat.new

character. The name of the column containing the edited latitude, combining the coordinates from the source data and the gazetteer. Default to "decimalLatitude.new".

lon.new

character. The name of the column containing the working longitude combining the coordinates from the source data and the gazetteer. Default to "decimalLongitude.new".

rm.gazet

logical. Should the coordinates form the gazetteer be removed from the data after the replacement of missing coordinates? Default to FALSE.

Details

The function works as a wrapper, where the individuals steps of the proposed plantR workflow for editing the geographical coordinates are performed altogether (see the plantR tutorial and the help of each function for details).

The input data frame usually contains the following fields (the function defaults):

  • the source coordinates: 'decimalLongitude' and 'decimalLatitude';

  • the gazetteer coordinates: 'latitude.gazetteer' and 'longitude.gazetteer';

  • the precision of the gazetteer coordinates: 'resolution.gazetteer';

  • the working coordinates: 'decimalLatitude.new' and 'decimalLongitude.new'.

Value

The input data frame coords, plus the new columns 'origin.coord' and 'precision.coord' with the formatted information. The new columns have the same name as proposed by the Darwin Core standards followed by the suffix '.new'.

See Also

prepCoord and getCoord.


LimaRAF/plantR documentation built on Jan. 1, 2023, 10:18 a.m.