Learn R Programming

GeoThinneR (version 2.1.0)

is_lonlat: Check for Longitude/Latitude Coordinates

Description

This function checks whether a pair of coordinate vectors represent geographic longitude and latitude values. The function returns `TRUE` if all longitude values are within -180 (- tolerance) and 180 (+ tolerance) and the latitude is within -90 (- tolerance) and 90 (+ tolerance).

Usage

is_lonlat(lon, lat, tolerance = 0.1)

Value

A logical value. `TRUE` if values are within the ranges and `FALSE` otherwise.

Arguments

lon

Numeric vector of longitudes in degrees.

lat

Numeric vector of latitudes in degrees.

tolerance

Numeric tolerance (in degrees) for checking the global longitude/latitude bounds. Default is 0.1.

Examples

Run this code
is_lonlat(lon = c(-3, 10, 179), lat = c(40, -20, 5))
is_lonlat(lon = c(100000, 150000), lat = c(4500000, 4600000))

Run the code above in your browser using DataLab