Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I write a RasterStack object to a GeoTIFF file using the Rasters package? #570

Closed
Ujjwal4CULS opened this issue Dec 4, 2023 · 2 comments

Comments

@Ujjwal4CULS
Copy link

I want to create a GeoTIFF file with a screenshot of the 'rasstack' variable. Can someone assist with this?
gmmp

@rafaqz
Copy link
Owner

rafaqz commented Dec 4, 2023

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.

@rafaqz rafaqz closed this as completed May 19, 2024
@rafaqz
Copy link
Owner

rafaqz commented May 19, 2024

Closed due to lack of reply from Op, not clear what to add here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants