Validate a single longitude/latitude pair to ensure both values are numeric scalars and fall within valid geographic bounds.

validateLonLat(longitude = NULL, latitude = NULL)

Arguments

longitude

Single longitude in decimal degrees east.

latitude

Single latitude in decimal degrees north.

Value

Invisibly returns TRUE if validation succeeds.

Details

Longitudes must fall between -180 and 180 degrees and latitudes must fall between -90 and 90 degrees. If validation fails, an error is generated.

Examples

validateLonLat(-122.5, 47.5)

if (FALSE) { # \dontrun{
validateLonLat(-200, 47.5)
validateLonLat(-122.5, NA)
} # }