View source: R/weatherHelper.R
| stationSearch | R Documentation |
Search by location name, station name or latitude/longitude for GHCN weather stations
that can be loaded with read.ghcn. Note that you need to
acquire a Google Maps API key for the default functionality, which is to
search for stations close to a latitude/longitude as returned by a Google
Maps geocode.
stationSearch(geocode = NULL, stationName = NULL, lat = NULL, lon = NULL, nClosest = 5, country = NULL, state = NULL, elevThreshold = NULL)
geocode |
The default input. A string that will be sent to Google Maps to get a latitude/longitude. This must be loaded into your R session as "google_key" |
lat |
Latitude |
lon |
Longitude |
nClosest |
The number of stations to return when searching on latitude & longitude. Example: nClosest = 10 will show the 10 closest stations. Optional, defaults to 5. |
country |
an optional specification of country |
state |
an optional specification of us state |
name |
A name to search for in the list of station names. Evaluated as a regular expression. |
a data frame with information about the relevant stations found. In the case that you specified lat/lon instead of a name this will include station distance in miles from the searched location.
read.ghcn stationCompare
read.noaa
# Look for a weather station in Bend, Oregon
stationSearch("Bend, OR")
# Find the closest weather stations to a lat/lon pair
# specifying a location in the Columbia Basin
stationSearch(lat = 46.943, lon = -119.240)
# It can help to specify state for a common name
stationSearch("Madison")
stationSearch("Madison", state = "wisconsin")
# Do we have weather sites in Switzerland?
stationSearch(country = "Switzerland")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.