TheiaCollection {theiaR} | R Documentation |
A collection of tiles from Theia
Description
Generate and manage collection of tiles from Theia. This collection can be
created either from a cart file ('.meta4') downloaded from Theia website,
from a TheiaQuery
object or from a list of
TheiaTile
(not implemented yet).
Usage
c <- TheiaCollection$new(cart.path = NULL, tiles = NULL, query = NULL, dir.path = NULL, check = TRUE) quiet = TRUE) c$download(auth, overwrite = FALSE, check = TRUE, quiet = TRUE) c$check() c$status c$extract(overwrite = FALSE, dest.dir = NULL) c$read(bands) c$as_gdalcube(out.file = "gdalcube_collection.sqlite")
Arguments
- c:
A
TheiaCollection
object- dir.path:
The path to the directory containing zip files
- check:
Whether or not to check existing files on collection's creation
- quiet:
Control verbose output
- tiles:
A list of TheiaTile objects
- cart:
An XML cart parsed from a 'meta4' file downloaded from Theia
website. Used only if Collection is created from a cart
- query:
A TheiaQuery object, used only if collection is created from a TheiaQuery object. Can also be a list with search terms. In this case, it will create a 'TheiaQuery' object from it. See
TheiaQuery
for details on query syntax- auth:
A character string giving the file path to Theia credentials. Or a
TheiaAuth
object- overwrite:
Overwrite existing tiles (default to 'FALSE')
- bands:
A character vector of bands to load from tiles
- out.file:
Filename to store gdalcubes' image collection
Details
TheiaCollection$new()
Create a new instance of the class
c$download(overwrite = FALSE, check = TRUE)
Download the tiles of the collection
and check the resulting files
$ccheck()
Check the tiles of the collection
c$status
Return the status of each tile of the collection
c$extract(overwrite = FALSE, dest.dir = NULL)
Extract archives to
dest.dir if supplied, or to the same directory as the archives otherwise
c$read(bands)
Read requested bands, apply corrections on values
(as specified in Theia's product information), and return a list of
RasterStack objects (one stack per tile)
c$as_gdalcube(out.file)
Create a 'gdalcubes' image collection from
downloaded tiles. See https://github.com/appelmar/gdalcubes_R for
more details.
Examples
# Create a collection from a query
## Create a query to Theia database, looking for tiles from Sentinel2
## satellite around Grenoble, between 2018-07-01 and 2018-07-06.
query <- list(collection = "SENTINEL2",
town = "Grenoble",
start.date = "2018-07-01",
end.date = "2018-07-06")
## Create a collecion of tiles from this query
mycollection <- TheiaCollection$new(query = query, dir.path = ".")
print(mycollection)
# Alternatively, you can create a collection from a cart file (that you can
# download from Theia's website)
cart.path <- system.file("extdata", "cart.meta4", package = "theiaR")
mycollection <- TheiaCollection$new(cart.path = cart.path,
dir.path = ".")
print(mycollection)
## Not run:
# Download the tiles in the collection
mycollection$download()
## End(Not run)
## Not run:
# Finally, you can extract zip archives containing the tiles
mycollection$extract(overwrite = FALSE)
## End(Not run)