Learn R Programming

MazamaCoreUtils (version 0.6.2)

validateLonLat: Validate longitude and latitude values

Description

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

Usage

validateLonLat(longitude = NULL, latitude = NULL)

Value

Invisibly returns TRUE if validation succeeds.

Arguments

longitude

Single longitude in decimal degrees east.

latitude

Single latitude in decimal degrees north.

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

Run this code
validateLonLat(-122.5, 47.5)

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

Run the code above in your browser using DataLab