Learn R Programming

GSODR (version 4.1.3)

nearest_stations: Find Nearest GSOD Stations to a Specified Latitude and Longitude

Description

Given latitude and longitude values entered as decimal degrees (DD), this function returns a list (as an atomic vector) of station ID values, which can be used inget_GSOD() to query for specific stations as an argument in the station parameter of that function.

Usage

nearest_stations(LAT, LON, distance)

Value

A data.table::data.table with full station metadata including the distance from the user specified coordinates from nearest to farthest.

Arguments

LAT

Latitude expressed as decimal degrees (DD) (WGS84)

LON

Longitude expressed as decimal degrees (DD) (WGS84)

distance

Distance in kilometres from point for which stations are to be returned.

Author

Adam H. Sparks, adamhsparks@gmail.com

Examples

Run this code
if (FALSE) { # interactive()
# Find stations within a 100km radius of Toowoomba, QLD, AUS

n <- nearest_stations(LAT = -27.5598, LON = 151.9507, distance = 100)
n
}

Run the code above in your browser using DataLab