checkLL: lat-long coordinate check

Description Usage Arguments Value Author(s) See Also Examples

View source: R/checkLL.R

Description

check lat-long coordinates for plausibility

Usage

1
checkLL(lat, long, data, fun = stop, ...)

Arguments

lat, long

Latitude (North/South) and longitude (East/West) coordinates in decimal degrees

data

Optional: data.frame with the columns lat and long

fun

One of the functions stop, warning, or message. DEFAULT: stop

...

Further arguments passed to fun

Value

Invisible T/F vector showing which of the coordinates is violated in the order: minlat, maxlat, minlong, maxlong. Only returned if check is passed or fun != stop

Author(s)

Berry Boessenkool, [email protected], Aug 2016

See Also

pointsMap, putm, berryFunctions::checkFile

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
checkLL(lat=52, long=130)
checkLL(130, 52, fun=message)
checkLL(85:95, 0, fun=message)

d <- data.frame(x=0, y=0)
checkLL(y,x, d)

# informative errors:
library("berryFunctions")
is.error(   checkLL(85:95, 0, fun="message"),  tell=TRUE)
is.error(   checkLL(170,35),  tell=TRUE)

mustfail <- function(expr) stopifnot(berryFunctions::is.error(expr))
mustfail( checkLL(100)         )
mustfail( checkLL(100, 200)    )
mustfail( checkLL(-100, 200)   )
mustfail( checkLL(90.000001, 0)   )

brry/OSMscale documentation built on April 18, 2018, 8:23 p.m.