library(ASAPI)
library(jsonlite)
library(kableExtra)

email = "user.example@agrospace.cl"
password = "contra1234"
auth = asapi_auth(email = email,password = password)
client = auth$client
api_key = auth$api_key
user = auth$user

AgroSpace API

print(auth)

Client Information

asapi_client_get(client, email, api_key)

User's Information

user = asapi_user_get(client, email, user, api_key)
counted_calls=user$counted_calls
toJSON(user,pretty = TRUE)

kbl(user$counted_calls) %>%
  kable_styling(bootstrap_options = c("hover", "condensed")) %>% 
  kable_material_dark()

Farm information

farm = "farm1example"
shp = asapi_farm_get(client, farm, email, api_key)
toJSON(shp$response,pretty = TRUE)

Vectorial data

raster::plot(shp$shp)

Retrieve tabulate time series information

tableid = "levelzero"
sensor = "S2SR"
index = "NDVI"
date_start="2021-01-01"
date_end="2021-02-01"
table = asapi_table(client, farm, tableid, sensor, index,
                    date_start, date_end, email, api_key)
kbl(table) %>%
  kable_styling(bootstrap_options = c("hover", "condensed")) %>% 
  kable_material_dark()

Retrieve Satelite Data - NDVI

date = table$date[1]
rst = asapi_image(client, farm, sensor, index, date, email,
                  api_key)
raster::plot(rst$rst)


agrospace/ASAPI documentation built on Nov. 26, 2021, 3:36 a.m.