This function provides tool for remote sensing image conversion using GDAL utility.
Usage
gdal_conversion(
in_path,
outfolder = NULL,
band_name = NULL,
tile_id = NULL,
just_band_name = TRUE,
target_format = ".tif"
)Arguments
- in_path
character: physical path to the image file.
- outfolder
character: physical path to the folder where you want to export the converted image. Default is NULL.
- band_name
character: band name of the image. Default is NULL.
- tile_id
character/numeric: id for differentiate different converted image tiles.
- just_band_name
logical: if we just want the band names of the image file. Default is TRUE.
- target_format
character: target image format. Default is .tif.
Details
Please note that, this function only supports conversions for one band of one image. If you want to convert multiple images or bands, make sure to loop over these targets. Currently tested H5, NetCDF, HDF4, and GeoTIFF formats. This function should be ready to any GDAL supported image format.
Examples
if (FALSE) { # \dontrun{
in_path <- "/projectnb/dietzelab/malmborg/CARB/HLS_data/MSLSP_10SDH_2016.nc"
outfolder <- "/projectnb/dietzelab/dongchen/anchorSites/NA_runs/MODIS_Phenology"
band_name <- "NumCycles"
# try grab all available bands from the target file.
band_names <-
gdal_conversion(in_path = in_path,
outfolder = outfolder,
band_name = NULL,
just_band_name = T)
# try convert the first band of the available band names to GeoTIFF file.
f <-
gdal_conversion(in_path = in_path,
outfolder = outfolder,
band_name = band_names[1],
just_band_name = F,
target_format = ".tif")
} # }