Title: | Interface to Various NASA API's |
---|---|
Description: | Provides functions to access NASA's Earth Imagery and Assets API and the Earth Observatory Natural Event Tracker (EONET) webservice. |
Authors: | Eduardo Flores, Viliam Simko |
Maintainer: | Eduardo Flores <[email protected]> |
License: | CC0 |
Version: | 0.10.0 |
Built: | 2025-03-05 03:01:28 UTC |
Source: | https://github.com/eflores89/nasadata |
Calls NASA's Earth Imagery Assets API and returns data.frame with information on time and location of images between two dates.
earth_asset(key, lon, lat, start_date, end_date = Sys.Date())
earth_asset(key, lon, lat, start_date, end_date = Sys.Date())
key |
Key for API authentication. |
lon |
Longitud of coordinate position. |
lat |
Latitud of coordinate position. |
start_date |
Start date to search for image. In YYYY-MM-DD format. |
end_date |
End date to search for image. In YYYY-MM-DD format. Defaults to current system date. |
Returns a data.frame
containing the following columns:
date |
date of the sample |
id |
identifier of the sample or "NO RESULTS" |
type |
type of the sample, currenlty always "Point" |
coordinates |
latitude and longitude as a string delimited by a space |
## Not run: key <- "123key" img <- earth_asset(key, -100.31008, 25.66779, "2016-01-01") ## End(Not run)
## Not run: key <- "123key" img <- earth_asset(key, -100.31008, 25.66779, "2016-01-01") ## End(Not run)
Calls NASA's Earth Observatory Natural Event Tracker (EONET) webservice and
returns a list containing individual events as data.frame
.
earth_event(status = c("all", "open", "closed"), sources = "all", category_id = "all", limit = 10, days = 20, LimitType = c("limit", "days", "all"), TrySimplify = TRUE)
earth_event(status = c("all", "open", "closed"), sources = "all", category_id = "all", limit = 10, days = 20, LimitType = c("limit", "days", "all"), TrySimplify = TRUE)
status |
Accepts "open" or "closed". Defaults to "all", which includes both. |
sources |
Accepts character id strings from EONET sources
(see |
category_id |
Accepts number id strings from EONET category tree
(see |
limit |
Limit of events to download. If |
days |
Limit of days (less than today) to download events from.
If |
LimitType |
Type of limit to consider: "limit" (count of events), "days" (days less than today) or "all" (both limits). |
TrySimplify |
If TRUE tries to coerce category and event data.frames into one (successful if there is one category per event). |
Returns a list
with individual events:
Events |
|
Sources |
|
Categories |
|
Geography |
|
Meta |
|
## Not run: event <- earth_event(limit = 1) ## End(Not run)
## Not run: event <- earth_event(limit = 1) ## End(Not run)
Calls NASA's Earth Imagery API and returns list with identification information and image.
earth_image(key, lon, lat, date, cloud_score = TRUE, plot = FALSE, meta_only = FALSE)
earth_image(key, lon, lat, date, cloud_score = TRUE, plot = FALSE, meta_only = FALSE)
key |
API Key for authentication. |
lon |
Longitude of coordinate position. |
lat |
Latitude of coordinate position. |
date |
In YYYY-MM-DD format. The API wil return the image that is closest to this date. |
cloud_score |
Gives a score of percentage of cloud cover, via algorithm (see official documentation). Defaults to TRUE. |
plot |
If TRUE will plot the image via generic plot function. |
meta_only |
If TRUE will only download the meta data for the image. |
Returns a list
of two elements:
image_metadata |
This contains a |
image_raster_data |
This contains an |
## Not run: key <- "123key" img <- earth_image(key, -100.31008, 25.66779, "2016-01-01") ## End(Not run)
## Not run: key <- "123key" img <- earth_image(key, -100.31008, 25.66779, "2016-01-01") ## End(Not run)
Calls NASA's EONET Webservice and returns all categories available.
eonet_categories()
eonet_categories()
Returns data.frame
with 5 columns:
id |
Unique id (can be used to filter |
title |
Title of category |
link |
Direct json link (the result is equal to filtering all
|
description |
Description of category |
layers |
Layers of category (see oficial documentation) |
## Not run: categories <- eonet_categories() ## End(Not run)
## Not run: categories <- eonet_categories() ## End(Not run)
Calls NASA's EONET Webservice and returns all sources available.
eonet_sources()
eonet_sources()
Returns data.frame
with 4 columns:
id |
Unique id (can be used to filter |
title |
Title of source |
source |
Official source URL |
link |
Direct json link (the result is equal to filtering all
|
## Not run: sources <- eonet_sources() ## End(Not run)
## Not run: sources <- eonet_sources() ## End(Not run)
To avoid S4 Classes and methods, this small wrapper simply plots an image
from NASA. If the purpose is to this interactively on one image, set the
parameter plot = TRUE
in earth_image
.
plot_earth_image(image_raster_data)
plot_earth_image(image_raster_data)
image_raster_data |
image downloaded using earth_image. |
nothing
earth_image
## Not run: key <- "123key" img <- earth_image(key, -100.31008, 25.66779, "2016-01-01") plot_earth_image(img$image_png) ## End(Not run)
## Not run: key <- "123key" img <- earth_image(key, -100.31008, 25.66779, "2016-01-01") plot_earth_image(img$image_png) ## End(Not run)