brapi_post_locations: post /locations

View source: R/brapi_post_locations.R

brapi_post_locationsR Documentation

post /locations

Description

Create new Locations

Usage

brapi_post_locations(
  con = NULL,
  abbreviation = "",
  additionalInfo = list(),
  coordinateDescription = "",
  coordinateUncertainty = "",
  coordinates = list(),
  countryCode = "",
  countryName = "",
  documentationURL = "",
  environmentType = "",
  exposure = "",
  externalReferences = "",
  instituteAddress = "",
  instituteName = "",
  locationName = "",
  locationType = "",
  siteStatus = "",
  slope = "",
  topography = ""
)

Arguments

con

list; required: TRUE; BrAPI connection object

abbreviation

character; required: FALSE; An abbreviation which represents this location

additionalInfo

list; required: FALSE; Additional arbitrary information. If provided use the following construct list(additionalProp1 = "string", additionalProp2 = "string", additionalProp3 = "string").

The Examples section shows an example on how to construct the additionalInfo argument as a list.

coordinateDescription

character; required: FALSE; Describes the precision and landmarks of the coordinate values used for this location. (ex. the site, the nearest town, a 10 kilometers radius circle, +/- 20 meters, etc).

coordinateUncertainty

character; required: FALSE; Uncertainty associated with the coordinates in meters. Leave the value empty if the uncertainty is unknown.

coordinates

list; required: FALSE; One geometry as defined by GeoJSON (RFC 7946). All coordinates are decimal values on the WGS84 geographic coordinate reference system. A coordinate position MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers. Altitude or elevation MAY be included as an optional third element and is specified in meters.

The coordinates list MUST contain the following two elements:

  • geometry as a list; required: TRUE; A geometry as defined by GeoJSON (RFC 7946). In this context, only Point or Polygon geometry are allowed .

    The Point geometry is described by exactly two elements:

    • coordinates as a vector of type character; required: TRUE; A point position containing two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers. Altitude or elevation MAY be included as an optional third element.

    • type as a character; required: TRUE; Literally specified as "Point"

    The Polygon geometry is described by exactly two elements:

    • coordinates as a list; required : TRUE; List of linear rings, where each linear ring is a list of at least four positions with the first equal to the last. The first linear ring specifies the exterior ring, and each subsequent ring an interior ring.

    • type as a character; required: TRUE; Literally specified as "Polygon".

  • type as a character; required: TRUE; Literally specified as "Feature".

The easiest way in R to construct the coordinates list is to use the geojsonR package. The Examples section shows how to create a coordinates list object for a point and a polygon geometry.

countryCode

character; required: FALSE; ISO_3166-1_alpha-3 specification MIAPPE V1.1 (DM-17) Geographic location (country) - The country where the experiment took place, either as a full name or preferably as a 2-letter code.

countryName

character; required: FALSE; The full name of the country where this location is MIAPPE V1.1 (DM-17) Geographic location (country) - The country where the experiment took place, either as a full name or preferably as a 2-letter code.

documentationURL

character; required: FALSE; A URL to the human readable documentation of this object.

environmentType

character; required: FALSE; Describes the general type of environment of the location. (ex. forest, field, nursery, etc).

exposure

character; required: FALSE: Describes the level of protection /exposure for things like sun light and wind.

externalReferences

data.frame; required: FALSE; A data.frame of external reference ids. These are references to this piece of data in an external system. Could be a simple string or a URI. The externalReferences argument data.frame should contain the following columns:

  • referenceID character; required: TRUE; The external reference ID. Could be a simple string or a URI.

  • referenceSource character; required: TRUE; An identifier for the source system or database of this reference.

The Examples section shows an example of how to construct the externalReferences argument as a data.frame.

instituteAddress

character; required: FALSE; The street address of the institute representing this location. MIAPPE V1.1 (DM-16) Contact institution - Name and address of the institution responsible for the study.

instituteName

character; required: FALSE; Each institute/laboratory can have several experimental field. MIAPPE V1.1 (DM-16) Contact institution - Name and address of the institution responsible for the study.

locationName

character; required: FALSE; A human readable name for this location. MIAPPE V1.1 (DM-18) Experimental site name - The name of the natural site, experimental field, greenhouse, phenotyping facility, etc., where the experiment took place.

locationType

character; required: FALSE; The type of location this represents (ex. Breeding Location, Storage Location, etc.).

siteStatus

character; required: FALSE: Description of the accessibility of the location (ex. Public, Private)

slope

character; required: FALSE; Describes the approximate slope (height/distance) of the location.

topography

character; required: FALSE; Describes the topography of the land at the location. (ex. Plateau, Cirque, Hill, Valley, etc.)

Details

Add new locations to database

Value

data.frame

Author(s)

Maikel Verouden

References

BrAPI SwaggerHub

See Also

Other brapi-core: brapi_get_commoncropnames(), brapi_get_lists_listDbId(), brapi_get_lists(), brapi_get_locations_locationDbId(), brapi_get_locations(), brapi_get_people_personDbId(), brapi_get_people(), brapi_get_programs_programDbId(), brapi_get_programs(), brapi_get_search_lists_searchResultsDbId(), brapi_get_search_locations_searchResultsDbId(), brapi_get_search_people_searchResultsDbId(), brapi_get_search_programs_searchResultsDbId(), brapi_get_search_studies_searchResultsDbId(), brapi_get_search_trials_searchResultsDbId(), brapi_get_seasons_seasonDbId(), brapi_get_seasons(), brapi_get_serverinfo(), brapi_get_studies_studyDbId(), brapi_get_studies(), brapi_get_studytypes(), brapi_get_trials_trialDbId(), brapi_get_trials(), brapi_post_lists_listDbId_items(), brapi_post_lists(), brapi_post_people(), brapi_post_programs(), brapi_post_search_lists(), brapi_post_search_locations(), brapi_post_search_people(), brapi_post_search_programs(), brapi_post_search_studies(), brapi_post_search_trials(), brapi_post_seasons(), brapi_post_studies(), brapi_post_trials(), brapi_put_lists_listDbId(), brapi_put_locations_locationDbId(), brapi_put_people_personDbId(), brapi_put_programs_programDbId(), brapi_put_seasons_seasonDbId(), brapi_put_studies_studyDbId(), brapi_put_trials_trialDbId()

Other Locations: brapi_get_locations_locationDbId(), brapi_get_locations(), brapi_get_search_locations_searchResultsDbId(), brapi_post_search_locations(), brapi_put_locations_locationDbId()

Examples

## Not run: 
con <- brapi_db()$testserver
con[["token"]] <- "YYYY"
abbreviation <- "L1"
additionalInfo <- list(dummyData = "True", example = "post_locations")
coordinateDescription <- "North East corner of greenhouse"
coordinateUncertainty <- "20"
## Load geojsonR package
library(geojsonR)
## Create a coordinates list object
## Point geometry
init <- TO_GeoJson$new()
pointGeometry <- list()
pointData <- c(-76.506042, # longitude
                42.417373, # lattitude
                      123) # altitude
pointGeometry[["geometry"]] <- init$Point(data = pointData,
                                          stringify = FALSE)
pointGeometry[["type"]] <- "Feature"
##
## Polygon geometry with an exterior and one interior ring
init <- TO_GeoJson$new()
## Individual polygon points are provided as c(longitude, latitude, altitude)
polygonData <- list(list(c(-76.476949, 42.447274, 123), # exterior ring (rectangle)
                         c(-76.474429, 42.447258, 123),
                         c(-76.474428, 42.446193, 123),
                         c(-76.476961, 42.446211, 123),
                         c(-76.476949, 42.447274, 123)),
                    list(c(-76.476733, 42.446916), # interior ring (triangle)
                         c(-76.475810, 42.447154),
                         c(-76.476306, 42.446281),
                         c(-76.476733, 42.446916)))
polygonGeometry <- list()
polygonGeometry[["geometry"]] <- init$Polygon(data = polygonData,
                                              stringify = FALSE)
polygonGeometry[["type"]] <- "Feature"
countryCode <- "PER"
countryName <- "Peru"
documentationURL <- "https://brapi.org"
environmentType <- "Nursery"
exposure <- "Structure, no exposure"
externalReferences <-
  data.frame(referenceID = c("doi:10.155454/12341234",
                             "http://purl.obolibrary.org/obo/ro.owl",
                             "75a50e76"),
             referenceSource = c("DOI",
                                 "OBO Library",
                                 "Remote Data Collection Upload Tool"))
instituteAddress <- "71 Pilgrim Avenue Chevy Chase MD 20815"
instituteName <- "Plant Science Institute"
locationName <- "Location 1"
locationType <- "Storage Location"
siteStatus <- "Private"
slope <- "0"
topography <- "Valley"

brapi_post_locations(con = con,
                     abbreviation = abbreviation,
                     additionalInfo = additionalInfo,
                     coordinateDescription = coordinateDescription,
                     coordinateUncertainty = coordinateUncertainty,
                     coordinates = pointGeometry,
                     countryCode = countryCode,
                     countryName = countryName,
                     documentationURL = documentationURL,
                     environmentType = environmentType,
                     exposure = exposure,
                     externalReferences = externalReferences,
                     instituteAddress = instituteAddress,
                     instituteName = instituteName,
                     locationName = locationName,
                     locationType = locationType,
                     siteStatus = siteStatus,
                     slope = slope,
                     topography = topography)

## End(Not run)


mverouden/brapir-v2 documentation built on April 22, 2022, 9:24 a.m.