Learn R Programming

ursa (version 3.9.4)

get_earthdata: Retrive data from Global Imagery Browse Services (GIBS) using API for Developers

Description

get_earthdata allows retrieving georeferences optical satellite images of low and moderate spatial resolution (up to 250m per cell) using GIBS API for Developers.

Usage

get_earthdata(bbox = NA, res = c("2km", "1km", "500m", "250m"),
              date = NA, product = "", geocode = "",
              expand = 1.05, border = 0, display = FALSE,
              cache = NA, verbose = FALSE)

Arguments

bbox

Numeric of length 4 or character. Spatial extent in the notation c(minx,miny,maxx,maxy). Can be in utits of meters or degrees. If all absolute values are less than 360, then units are in degrees and projection is EPSG:3857, else units are in meters and projection is EPSG:3413. If bbox=NULL, then function return list of available products. If bbox=NA then boundary box is attempted for taking from session grid. If character, then boundary box is taken from geocoding. Default is region of Vaigach Island.

res

Character or numeric. Parameter, which is responsible for dimension of output raster image. If character, then zoom is selected using keyword list c("2km", "1km", "500m", "250m") for EPSG:3413. If res<10 then it is interpreted as zoom for Web Map Tile Service (WMTS). If res>100 then res is interpreted as preffered image dimension. If res=NA then res=480L.

date

Character or "Date" object. Date for image retrieving. Default is Sys.Date()-1L.

product

Character of integer. Data product form GIBS. Currently only MODIS-oriented (corrected reflectance) products are available:

  1. "MODIS_Aqua_CorrectedReflectance_Bands721"

  2. "MODIS_Terra_CorrectedReflectance_Bands721"

  3. "MODIS_Aqua_CorrectedReflectance_TrueColor"

  4. "MODIS_Terra_CorrectedReflectance_TrueColor"

  5. "VIIRS_SNPP_CorrectedReflectance_TrueColor"

  6. "Coastlines"

Please check actual list by calling get_earthdata(bbox=NULL).

If numeric, then index of item among available products. Regular expressions can be used to simplify value of product, e.g., case-insensitive "aqua 721", "terra truecolor", "suomi", "SNNP".

geocode

Character. Keyword for geocode service. Valid values are "google", "nominatim". Default is ""; several services are considered in the case of failure.

expand

Numeric. Multiplier for plotting panel zoom in relation to extent of plotting geometry. Ignored if geocoding is not applied. Default is 1.05.

border

Integer. Value in pixels of fixed margins around plotting geometry. Ignored if geocoding is not applied. Default is 0L.

display

Logical. Value TRUE forces to display image instead of return it. Default is FALSE.

cache

Logical. Is cache used? Default is NA, which is interpreted as TRUE for any requested date excepting not late time of today (approximately 17:00 UTC).

verbose

Logical. Value TRUE may provide some additional information on console. Default is FALSE.

Value

If bbox=NULL, then character vector of available products.

If display=FALSE then object of class ursaRaster with RGBA image.

If display=TRUE then returned value of display_brick.

Details

Argument method="libcurl" is used in function download.file for tile downloading. Please check capabilities("libcurl").

Valid zoom values (e. g., specified via res argument) are 3:6 for EPSG:3413 and 0:8 for EPSG:3587.

Longitude 180 degrees has a seam in EPSG:3857 (e.g., see bbox=c(170,68,-170,73) and bbox=c(-1600000,1308000,-1370000,1570000) for Wrangel Island. If region crosses longitude 180 degrees in EPSG:3857, then the prior day is taken for Western Hemisphere.

References

GIBS API for Developers

Examples

Run this code
# NOT RUN {
session_grid(NULL)
pr <- get_earthdata()
print(pr,quote=FALSE)

# }
# NOT RUN {
 ## internet connection is required -- begin
a1 <- get_earthdata(bbox=c(2000000,400000,2300000,700000))
display(a1)
# }
# NOT RUN {
 ## internet connection is required -- end
a2 <- get_earthdata(product=2,date=Sys.Date()-7L,res=7,bbox=c(57.8,69.4,62.3,70.8))
display(a2)
# }

Run the code above in your browser using DataLab