GetOverpasses {spectator}R Documentation

Gets overpasses for an area of interest

Description

Retrieves the footprint polygons of past and/or (near)future overpasses of specified satellites over an area of interest.

Usage

GetOverpasses(
  aoi,
  satellites = NULL,
  days_before = 0,
  days_after = 7,
  acquisitions = TRUE,
  api_key = Sys.getenv("spectator_earth_api_key")
)

Arguments

aoi

'sf' (or 'Spatial*') object defining the area of interest. Can be of any geometry as only the bounding box is used.

satellites

character vector, if specified only the listed satellites will be retrieved, if NULL (default value) the acquisition plans for all possible satellites will be retrieved. For simplicity, the satellites names can be abbreviated to "S-1A", "S-1B", "S-2A", "S-2B", "L-8", "L-9" or "S1A", "S1B", "S2A", "S2B", "L8", "L9". Default: NULL

days_before

integer indicating the number of days before the current date for which overpasses should be computed. Default: 0

days_after

integer indicating the number of days after the current date for which overpasses should be computed. Default: 7

acquisitions

logical indicating if only the overpasses when the data acquisition will take place should be reported. Default: TRUE

api_key

character containing your API key. Default: Sys.getenv("spectator_earth_api_key")

Details

This function requires an API key that is automatically generated for every registered account at https://app.spectator.earth. You can find it under 'Your profile' (bottom left button). By default, the API key is retrieved from the environment variable spectator_earth_api_key, but you can choose any other way of providing it (it is recommended NOT to include it in your scripts).

Value

Object of class 'sf' with 'POLYGON' geometry type and attributes

id

integer identifier

acquisitions

logical whether the overpass collects the data

date

POSIXct timestamp of the overpass (UTC - to be checked)

satellite

character satellite name

Source

https://api.spectator.earth/#satellite-overpasses

Examples

if(interactive()){
 library(sf)
 # get the Luxembourg country shape as area of interest
 boundary <- read_sf(system.file("extdata", "luxembourg.geojson", package = "spectator"))
 # look for Sentinel-2 A and B, use shorthand notation, default time frame
 pass <- GetOverpasses(boundary, satellites = "S-2", acquisitions = TRUE)
 # do some nice graphs
 library(maps)
 days <- range(as.Date(pass$date))
 satellites <- sort(unique(pass$satellite))
 map(database = "world", region = c("Belgium", "Netherlands", "Germany", "Luxembourg",
     "France", "Switzerland"), col = "lightgrey", fill = TRUE)
 plot(sf::st_geometry(boundary), add = TRUE, col = "red", border = FALSE)
 plot(sf::st_geometry(pass), add = TRUE)
 title(main = sprintf("%s overpasses for period %s", paste(satellites, collapse = "/"), 
                      paste(days, collapse = ":")))
 }

[Package spectator version 0.2.0 Index]