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

Writing of multiple images supported? #379

Open
aLemonFox opened this issue Jul 31, 2023 · 4 comments
Open

Writing of multiple images supported? #379

aLemonFox opened this issue Jul 31, 2023 · 4 comments

Comments

@aLemonFox
Copy link

Hey, I was wondering how to write multiple 'subfiles' or images. One image works fine following the example in the docs, but I can't really figure out how I would add a second or third dataset as image so I could do tiff.getImage(1).

const values = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const metadata = {
  height: 3,
  width: 3
};
const arrayBuffer = await writeArrayBuffer(values, metadata);
const tiff = await fromArrayBuffer(arrayBuffer);
const image = await tiff.getImage();
const image = await tiff.getImage(1); // not possible now

How would I add another image to this file?

@DanielJDufour
Copy link
Contributor

Hi @aLemonFox , that's a great question! Unfortunately, that's not currently a capability that the geotiffwriter has. Would you be interested in working on a PR?

@aLemonFox
Copy link
Author

aLemonFox commented Aug 1, 2023

@DanielJDufour I would love to try and help out, but this is the first time for me working with geotiffs. So I am not really aware of how these files work. I took a look at the code and I am guessing we need to somehow write multiple IFD's to store multiple datasets in the same file? If you could point me in the right direction I might be able to figure something out.

@DanielJDufour
Copy link
Contributor

I think you are on the right path! Could you describe in a little more detail your use case for writing multiple images? Are you simply trying to write simplified overviews of your data? Or are you trying to leverage tiff files ability to store multiple "pages/scans" of a "document"? Just wanting to double check we are talking about the same thing :-)

@aLemonFox
Copy link
Author

I have a few 2d datasets all of the same size. All of the metadata is the same. So currently I have multiple standalone .tif files for each dataset. This works fine but based on the getImage() function I thought it might be easier (storage wise) if these datasets are merged into the same file. These files themselves are related to eachother. Each image contains some radar data on a five minute interval so instead of having to load each file independently, I could just call getImage(x) with the images I currently need.

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