Type: Package
Title: Interface to Various NASA API's
Version: 0.9.0
Author: Eduardo Flores
Maintainer: Eduardo Flores <eduardo@enelmargen.org>
Description: Provides functions to access NASA's Earth Imagery and Assets API and the Earth Observatory Natural Event Tracker (EONET) webservice.
License: CC0
Imports: plyr, dplyr, png, jsonlite
LazyData: TRUE
RoxygenNote: 5.0.1
NeedsCompilation: no
Packaged: 2016-05-06 06:20:33 UTC; eduardoflores
Repository: CRAN
Date/Publication: 2016-05-07 00:41:17

Call Asset API

Description

Calls NASA's Earth Imagery Assets API and returns data.frame with information on time and location of images between two dates.

Usage

earth_asset(key, lon, lat, start_date, end_date = Sys.Date())

Arguments

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.

Examples

## Not run: 
key <- "123key"
img <- earth_asset(key, -100.31008, 25.66779, "2016-01-01")

## End(Not run)

Calls EONET webservice

Description

Calls NASA's Earth Observatory Natural Event Tracker (EONET) webservice and returns a data.frame with individual event or events.

Usage

earth_event(status = "all", sources = "all", category_id = "all",
  limit = 10, days = 20, LimitType = "limit", TrySimplify = TRUE)

Arguments

status

Accepts 1 or 0 (open or closed). Defaults to "all", which includes both.

sources

Accepts character id strings from EONET sources (see eonet_sources)

category_id

Accepts number id strings from EONET category tree (se eonet_categories)

limit

Limit of events to download. If LimitType = "days" this is not considered. Defaults to 10.

days

Limit of days (less than today) to download events from. If LimitType = "limit" this is not considered. Defaults to 20.

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).

Examples

## Not run: 
event <- earth_event(limit = 1)

## End(Not run)

Fetches image from Earth Imagery API

Description

Calls NASA's Earth Imagery API and returns list with identification information and image.

Usage

earth_image(key, lon, lat, date, cloud_score = TRUE, plot = FALSE,
  meta_only = FALSE)

Arguments

key

Key for API authentication.

lon

Longitud of coordinate position.

lat

Latitud 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.

Examples

## Not run: 
key <- "123key"
img <- earth_image(key, -100.31008, 25.66779, "2016-01-01")

## End(Not run)

Calls EONET category webservice

Description

Calls NASA's EONET Webservice and returns all categories available.

Usage

eonet_categories()

Details

Returns data.frame with 5 columns @field id Unique id (can be used to filter earth_event) @field title Title of category @field link Direct json link (the result is equal to filtering all earth_event with category) @field description Description of category @field layers Layers of category (see oficial documentation)

Examples

## Not run: 
categories <- eonet_categories()

## End(Not run)

Calls EONET sources webservice

Description

Calls NASA's EONET Webservice and returns all sources available.

Usage

eonet_sources()

Details

Returns data.frame with 4 columns @field id Unique id (can be used to filter earth_event) @field title Title of source @field source Official source URL @field link Direct json link (the result is equal to filtering all earth_event with source)

Examples

## Not run: 
sources <- eonet_sources()

## End(Not run)

Plots the image to device

Description

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

Usage

plot_earth_image(image_png)

Arguments

image_png

image downloaded using earth_image.

See Also

earth_image

Examples

## Not run: 
key <- "123key"
img <- earth_image(key, -100.31008, 25.66779, "2016-01-01")
plot_earth_image(img$image_png)

## End(Not run)