Skip to content

Savings a streaming MultibandGeoTiff creates a corrupted geotiff #2177

Closed

Description

@kthompson

Fails on Geotrellis Version: 1.1.0-RC4 and RC3

Issue cannot be reproduced in 1.1.0-RC2 but still does not work due to another issue where we just never return.

The following code produces the error above:

package com.agrian.analytics.ingest

import geotrellis.raster.io.geotiff.MultibandGeoTiff
import geotrellis.spark.io.http.util.HttpRangeReader
import geotrellis.util.StreamingByteReader

import scalaj.http.Http
import com.typesafe.scalalogging.LazyLogging

object TestApp extends LazyLogging {
  def main(args: Array[String]): Unit = {

    val s3Link = "https://s3-us-west-2.amazonaws.com/vtpkmsdybsdflk/1056026_2017-03-02_RE2_3A.tif"
    val streamer = HttpRangeReader.withoutHeadRequest(s3Link)
    val reader = StreamingByteReader(streamer)

    MultibandGeoTiff.streaming(reader).write("streamed_basetile.tiff")
  }
}

If you run gdalinfo basetile.tiff -hist -stats you get the resulting info:

Warning 1: LZWDecode:LZWDecode: Strip 515 not terminated with EOI code
ERROR 1: LZWDecode:Not enough data at scanline 515 (short 1179 bytes)
ERROR 1: TIFFReadEncodedStrip() failed.
ERROR 1: basetile.tiff, band 1: IReadBlock failed at X offset 0, Y offset 515

Some additional notes, if you change the MultibandGeoTiff.streaming(reader).write("streamed_basetile.tiff") line to:

    val geotiff = MultibandGeoTiff.streaming(reader)
    val extent@Extent(xmin, ymin, xmax, ymax) = geotiff.extent

    geotiff
      .crop(Extent(xmin + (extent.width * 0.1), ymin + (extent.height * 0.1), xmax, ymax))
      .write("streamed_basetile.tiff")

this will actually work on RC3 and RC4.

Activity

  1. changed the title [-]MalformedGeoTiffException: incorrect byte order produced from streaming geotiff[/-] [+]Savings a streaming MultibandGeoTiff creates a corrupted geotiff[/+] on May 4, 2017
  2. added this to the 1.1 milestone on May 6, 2017
  3. added a commit that references this issue on May 7, 2017
  4. self-assigned this
    on May 7, 2017
  5. added a commit that references this issue on May 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions