nearest_stations: Retrieve Nearest Alternate Fuel Stations by Criteria

Description Usage Arguments Value Examples

View source: R/altfuel_api.R

Description

Location parameters can either be passed directly as arguments, or imported using the nrel_params() function to generate a list. Location passed as arguments takes precedence.

Usage

1
2
3
4
5
6
7
8
nearest_stations(
  api_key,
  location = NULL,
  latitude = NULL,
  longitude = NULL,
  radius = NULL,
  params = nrel_params(radius = "infinite")
)

Arguments

api_key

Character. An authorized API key for the NREL API service. API keys can be requested at https://developer.nrel.gov/signup/

location

A free-form input describing the address of the location. This may include the address given in a variety of formats, such as: street, city, state, postal code, etc.

latitude

Numeric. The latitude of the desired location.

longitude

Numeric. The longitude of the desired location.

radius

Numeric. The radius (in miles) around the search location to search for stations within. An explicit radius of up to 500.0 miles may be passed in, or the special infinite string may be passed in to find the nearest stations regardless of distance. Defaults to 'infinite'.

params

A list of parameters for the API call. See ?nrel_params for options.

Value

An object of class nrel_api, containing content, parameters, and response.

Examples

1
2
3
4
5
6
7
8
## Not run: 
# find the 5 nearest Tesla stations to FAA HQ in Washington DC
my_params <- nrel_params(fuel_type = "ELEC", ev_connector_type = "TESLA", limit = 5)
my_loc <- c("FAA Headquarters, Washington, DC")
tesla_stns <- nearest_stations(MY_API_KEY, location = my_loc, params = my_params)
stations(tesla_stns)

## End(Not run)

altfuelr documentation built on Jan. 13, 2021, 10:19 a.m.