flipSign | R Documentation |
Checks for coordinate sign mistakes by checking all possibilities against country occupancy.
flipSign(
coordVec,
country,
returnMultiple = FALSE,
filterByLand = TRUE,
crs = 4326
)
coordVec |
numeric vector of length 2: longitude, latitude |
country |
the country that is associated with the record |
returnMultiple |
if multiple sign flips lead to the correct country,
return all options. If |
filterByLand |
if |
crs |
the crs of the coordinate. |
This function generates all possible coordinates with different signs, and
runs closestCountry
on each, returning the coordinates that
lead to a country match. It ignores coordinate options that do not pass
filterByLand
.
If a point falls close to the boundary between two countries, it is still considered a match.
list with 2 elements
matched |
logical: Was the country matched |
newcoords |
matrix of coordinates that were successful. |
Pascal Title
#correct coordinates
flipSign(c(4.28, 39.98), country = 'Spain')
#mistake in coordinate sign
flipSign(c(115.436, 32.657), country = 'United States')
#incorrect sign on both long and lat, but not possible to distinguish for longitude
#except when we consider which alternative coords fall on land.
flipSign(c(-4.28, -39.98), country = 'Spain', filterByLand = FALSE, returnMultiple = TRUE)
flipSign(c(-4.28, -39.98), country = 'Spain', returnMultiple = TRUE)
#coordinates are incorrect
flipSign(c(4.28, 59.98), country = 'Spain')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.