Description Usage Arguments Value Note Author(s) Examples
The function build a virtual raster from a Sentinel2 SAFE product, eventually translating it in another spatial format. For now, only L1C and L2a with long name (< 2016/12/06) are recognised. Output vrt is at 10m resolution.
1 2 3 4 |
infile |
Full path of the input SAFE folder (alternatively, full path of the xml file of the product with metadata). |
outdir |
(optional) Full name of the output directory where
the files should be created (default: current directory).
|
subdirs |
(optional) Logical: if TRUE, differet output products are
placed in separated |
tmpdir |
(optional) Path where intermediate files (VRT) will be created. Default is a temporary directory. |
rmtmp |
(optional) Logical: should temporary files be removed? (Default: TRUE). This parameter takes effect only if the output files are not VRT (in this case temporary files cannot be deleted, because rasters of source bands are included within them). |
prod_type |
(optional) Vector of types to be produced as outputs (see safe_shortname for the list of accepted values). Default is reflectance ("TOA" for level 1C, "BOA" for level 2A). |
tiles |
(optional) Character vector with the desired output tile IDs (id specified IDs are not present in the input SAFE product, they are not produced). Default (NA) is to process all the found tiles. |
res |
(optional) Spatial resolution (one between '10m', '20m' or '60m');
default is '10m'. Notice that, choosing '10m' or '20m', bands with lower
resolution will be rescaled to |
format |
(optional) Format of the output file (in a format recognised by GDAL). Default value is "VRT" (Virtual Raster). |
compress |
(optional) In the case a GTiff format is chosen, the compression indicated with this parameter is used. |
vrt_rel_paths |
(optional) Logical: if TRUE (default on Linux),
the paths present in the VRT output file are relative to the VRT position;
if FALSE (default on Windows), they are absolute.
This takes effect only with |
utmzone |
(optional) UTM zone of output products (default: the first one retrieved from input granules). Note that this function does not perform reprojections: if no granules refer to the specified UTM zone, no output is created. |
overwrite |
Logical value: should existing output files be overwritten? (default: FALSE) |
A vector with the names of the created output files (just created or already existing).
License: GPL 3.0
Luigi Ranghetti, phD (2017) ranghetti.l@irea.cnr.it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
s2_l1c_example <- file.path(
"/existing/path",
"S2A_MSIL1C_20170603T101031_N0205_R022_T32TQQ_20170603T101026.SAFE")
s2_l1c_example <- file.path(
"/existing/path",
"S2A_MSIL2A_20170603T101031_N0205_R022_T32TQQ_20170603T101026.SAFE")
# Create a single TOA GeoTIFF in the same directory
s2_translate(s2_l1c_example, format="GTiff")
# Create a single BOA VRT with a custom name
s2_translate(s2_l2a_example, "/new/path/example_sentinel2_sr.vrt",
vrt_rel_paths=TRUE)
# Create three products (ENVI) in the same directory at 60m resolution
s2_translate(s2_example, format="ENVI", prod_type=c("BOA","TCI","SCL"),
res="60m", subdirs=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.