Rasters.jl
Rasters.jl copied to clipboard
How do I write a RasterStack object to a GeoTIFF file using the Rasters package?
trafficstars
I want to create a GeoTIFF file with a screenshot of the 'rasstack' variable. Can someone assist with this?
Is there a reason to use RasterStack specifically here? This is easier using RasterSeries as what you have is a series of rasters of identical size and type along a time dimension.
Something like this should work:
using Rasters, ArchGDAL
# a RasterSeries can be created from the list of files
series = RasterSeries(tif_filenames, Band(basename.(tiff_filenames))
# combine turns the slices of a RasterSeries into a single Raster we can write as one file.
raster = Rasters.combine(series, Band)
# Now we can write the geotiff
write("output_filename.tif", raster)
Although I can test it without a MWE.
Closed due to lack of reply from Op, not clear what to add here.