locationtech / locationtech/geotrellis

big tiff(height:65000, width: 57000) build overviews failed

Open
#3,571 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement
Dominant language
Scala
Stars
1.4k
Forks
360
Avg merge
6h 57m
Merged PRs (30d)
12

Description

Describe the bug

generating overviews of geo tiff (height:65000, width: 57000) failed.

To Reproduce

Provide as able:

  • Steps to reproduce the behavior
  • Code example
  • Inputs
  • Actual output
  • Expected output
code example
val tiff = GeoTiffReader.readMultiband("6.5w-5.7w.tif", streaming = true)
tiff.withOverviews(NearestNeighbor).write("6.5w-5.7w.ov.tif", true)
input

An geo tiff with height 65000 pixels and width 57000 pixels

Expected behavior

save successfully

Screenshots

If applicable, add screenshots to help explain your problem.

exception stacktrace

Exception in thread "main" java.lang.NegativeArraySizeException: -550109184
	at scala.reflect.ManifestFactory$ByteManifest.newArray(Manifest.scala:97)
	at scala.reflect.ManifestFactory$ByteManifest.newArray(Manifest.scala:95)
	at scala.Array$.ofDim(Array.scala:305)
	at geotrellis.raster.UByteArrayTile$.ofDim(UByteArrayTile.scala:236)
	at geotrellis.raster.UByteArrayTile$.empty(UByteArrayTile.scala:264)
	at geotrellis.raster.ArrayTile$.empty(ArrayTile.scala:455)
	at geotrellis.raster.io.geotiff.GeoTiffMultibandTile.$anonfun$crop$3(GeoTiffMultibandTile.scala:552)
	at scala.Array$.fill(Array.scala:354)
	at geotrellis.raster.io.geotiff.GeoTiffMultibandTile.$anonfun$crop$1(GeoTiffMultibandTile.scala:552)
	at scala.collection.immutable.List.foreach(List.scala:431)
	at geotrellis.raster.io.geotiff.GeoTiffMultibandTile.crop(GeoTiffMultibandTile.scala:545)
	at geotrellis.raster.io.geotiff.GeoTiffMultibandTile.crop(GeoTiffMultibandTile.scala:511)
	at geotrellis.raster.io.geotiff.GeoTiffMultibandTile.crop(GeoTiffMultibandTile.scala:500)
	at geotrellis.raster.io.geotiff.GeoTiffMultibandTile.toArrayTile(GeoTiffMultibandTile.scala:492)
	at geotrellis.raster.io.geotiff.MultibandGeoTiff.withOverviews(MultibandGeoTiff.scala:143)
	at ToCog$.main(ToCog.scala:11)
	at ToCog.main(ToCog.scala)

Environment

  • Java version: 17.0.5
  • Scala version: 2.12
  • GeoTrellis version: 3.7.1

Additional context

Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace in GeoTiffMultibandTile.scala, especially crop and toArrayTile, then follow the call from MultibandGeoTiff.withOverviews. Reproduce the failure with the supplied 65000-by-57000 GeoTIFF and verify that overview generation and writing complete successfully without the NegativeArraySizeException.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.