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

Fix writing multiband GeoTiff with compression #2246

Merged

Conversation

lossyrob
Copy link
Member

Ass reported by @stevekuo on Gitter:

I'm seeing GeoTiffOptions(DeflateCompression) being correctly observed with SinglebandGeoTiff, but ignored with MultibandGeoTiff.
Roughly my code is

val geotiff = SinglebandGeoTiff(tile, extent, crs, Tags.empty, GeoTiffOptions(DeflateCompression))
// OR
val geotiff = MultibandGeoTiff(tile, extent, crs, Tags.empty, GeoTiffOptions(DeflateCompression))

val geotiffArray = GeoTiffWriter.write(geotiff)
val stream = new ByteArrayInputStream(geotiffArray)

I then write out to a file. Using gdalinfo, the single band is COMPRESSION=DEFLATE, where as the multi band is not compressed.

This fixes the oversight that was causing the GeoTiff to be written as uncompressed.

@lossyrob lossyrob added this to the 1.1 milestone Jun 21, 2017
@stevekuo
Copy link

stevekuo commented Jun 21, 2017

tile is a MultibandTile. Workaround is to convert MultibandTile to MultibandGeoTiff and specify the GeoTiffOptions.

val geotiffTile = GeoTiffMultibandTile(tile, options)
MultibandGeoTiff(geotiffTile, extent, metadata.crs, Tags.empty, options)

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

Successfully merging this pull request may close these issues.

3 participants