getCoord | R Documentation |
This function assess the availability and precision of the original geographical coordinates of the occurrence and it replaces missing coordinates by the coordinates obtained from the gazetteer.
getCoord( x, 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 )
x |
a data.frame containing the original coordinates and the coordinates obtained from a gazetteer. |
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. |
The function was initially designed as part of a routine to edit and
validate geographical coordinates of plant occurrence data. It is possible
to use it separately, but it may be easier to use it under the workflow
presented in plantR tutorial (see functions getLoc
and prepCoord
).
If used separately, users should provide a data frame preferably with the
following six columns (the defaults): 'decimalLatitude',
'decimalLongitude', 'latitude.gazetteer', 'longitude.gazetteer',
'resolution.gazetteer', 'decimalLatitude.new' and 'decimalLongitude.new')
or to specify the respective columns in the input data.
The columns lat.new
and lon.new
are the columns containing the working
coordinates that may have been already edited by prepCoord()
. It is also
the columns were the function will store the coordinates from the gazetteer
in the case of missing coordinates. If these columns are not provided in
the input data, they are assumed to be equal to lat.orig
and lon.orig
and they are created internally.
The precision of the geographical coordinates are classified as: "degrees", "minutes", "seconds" and "miliseconds". This classification is performed for the latitude and longitude of each record and the worst precision retrieved is assigned to both of them (i.e. if lat = "minutes" and lon= "seconds", the precision = "minutes"). For simplicity, all latitude/longitude not classified as "degrees", "minutes" or "seconds" are classified as "miliseconds".
The function implicitly assumes that NA coordinates are missing and they are replaced by the coordinates coming from the gazetteer. See the examples below.
The data frame x
with the columns 'decimalLatitude.new' and
'decimalLongitude.new' containing the geographical coordinates at the best
locality resolution (i.e. 'administrative level') available. The function
also returns the precision of the coordinates.
Renato A. F. de Lima
getLoc and prepCoord.
(coords <- data.frame(decimalLatitude = c(-23.5, -23.475389, NA), decimalLongitude = c(-47.166667, -47.123768, NA), latitude.gazetteer = c(-23.524052, -23.524052, -23.524052), longitude.gazetteer = c(-47.122207, -47.122207, -47.122207), resolution.gazetteer = c("county", "county", "county"), decimalLatitude.new = c(-23.5, -23.475389, NA), decimalLongitude.new = c(-47.166667,-47.123768, NA) )) getCoord(coords)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.