Create a Location containing all of the provided properties. Latitude, Longitude, and Altitude are optional and if not provided will be queried from the DataScienceToolkit API using the Location name.

Location(
  name = NULL,
  abbreviation = NULL,
  country_code = NULL,
  country_name = NULL,
  program = NULL,
  type = NULL,
  latitude = NULL,
  longitude = NULL,
  altitude = NULL,
  noaa_station_id = NULL
)

Arguments

name

Unique location name (must not conflict with an existing location name)

abbreviation

Location abbreviation

country_code

ISO Alpha-3 country code

country_name

Uppercase english short name from the ISO standard

program

Name of one or more existing Breeding Programs

type

Location type (Farm, Field, Greenhouse, Screenhouse, Lab, Storage, Other)

latitude

(optional) Location latitude (decimal degrees)

longitude

(optional) Location longitude (decimal degrees)

altitude

(optional) Location elevation (meters)

noaa_station_id

(optional) NOAA Station ID (ex: GHCND:US1NYTM0042)

Value

Location

Details

The geocodeLocation function can be used to obtain lat/lon/alt properties from a more specific location name (such as a street address), the results of which can be used to create the Location.

The lookupNOAAStationId function can be used to obtain the NOAA Station ID of the location (using its lat and lon) if it is unknown.

Use the getCountryCodes function to get a list of supported country codes and the getLocationTypes function to get a list of supported location types.

Examples

# Use the Location name to query lat/lon/alt properties
location <- Location(
     "Batavia, NY",
     "BAT",
     "USA",
     "United States of America",
     "Cornell",
     "Field"
)

# Geocode an address to use as lat/lon/alt properties
geo <- geocodeLocation("2 Caldwell Drive, Ithaca, NY")
noaa_station_id <- lookupNOAAStationId(geo$latitude, geo$longitude)
#> Error in lookupNOAAStationId(geo$latitude, geo$longitude): could not find function "lookupNOAAStationId"
location <- Location(
     "Caldwell - Ithaca, NY", 
     "ITH_CALD",
     "USA",
     "United States of America",
     "Cornell",
     "Field",
     geo$latitude,
     geo$longitude,
     geo$altitude,
     noaa_station_id
)
#> Error in eval(expr, envir, enclos): object 'noaa_station_id' not found