Geotiffwrite without compression

조회 수: 4 (최근 30일)
Albin
Albin 2012년 2월 20일
Hi,
I am struggling to use "geotiffwrite" without compression.
Writing the file with:
geotiffwrite('output.TIF', A, R, 'GeoKeyDirectoryTag', info.GeoTIFFTags.GeoKeyDirectoryTag);
works fine. But using
geotiffwrite('output.TIF', A, R, 'GeoKeyDirectoryTag', info.GeoTIFFTags.GeoKeyDirectoryTag, 'TiffTags', Tiff.Compression.None);
or any similar code does not work.
errormsg:
"Error using ==> geotiffwrite Expected TiffTags to be one of these types:
struct
Instead its type was double."
Which is right, Tiff.Compression.None is 1, but any ohter input, like Tiff.Compression does not work either.
Could anyone help me with the exact coding or writing a geotiff without compression?
thanks in advance,
ah

채택된 답변

Rob Comer
Rob Comer 2012년 3월 25일
You almost have it. As the error (and help) indicate, you need to follow 'TiffTags' with a structure when calling geotiffwrite. You can do it in-line, like this:
geotiffwrite('output.TIF',A,R,'GeoKeyDirectoryTag',info.GeoTIFFTags.GeoKeyDirectoryTag,'TiffTags',struct('Compression',Tiff.Compression.None))
or you can first create a TIFF tags structure, like this, for example:
tags.Compression = Tiff.Compression.None;
geotiffwrite('output.TIF',A,R,'GeoKeyDirectoryTag',info.GeoTIFFTags.GeoKeyDirectoryTag,'TiffTags',tags)
In this case, tags has only one field. But you can add others, such as RowsPerStrip, for example, as needed.

추가 답변 (1개)

Albin
Albin 2012년 3월 26일
Hi Rob,
thanks very much. you have solved my problem!
Albin

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by