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

Bug in the LayoutTileSource by key reads #3420

Open
pomadchin opened this issue Oct 4, 2021 · 0 comments
Open

Bug in the LayoutTileSource by key reads #3420

pomadchin opened this issue Oct 4, 2021 · 0 comments
Labels

Comments

@pomadchin
Copy link
Member

pomadchin commented Oct 4, 2021

Describe the bug

Working on the AVIRIS imagery ingest bug, we noticed that some TMS requests are failing.

The original failing function is the renderMosaicMultiband function.

The source of the error is a call of the .tileToLayout(layoutDefinition).read(SpatialKey(x, y), subsetBands) function.

Full log:

java.lang.IllegalArgumentException: requirement failed: chunk at GridBounds(254,0,256,255) exceeds tile boundary at (256, 256)
backsplash_1              | 	at scala.Predef$.require(Predef.scala:281)
backsplash_1              | 	at geotrellis.raster.PaddedTile.<init>(PaddedTile.scala:33)
backsplash_1              | 	at geotrellis.layer.LayoutTileSource.$anonfun$read$3(LayoutTileSource.scala:102)
backsplash_1              | 	at geotrellis.layer.LayoutTileSource.$anonfun$read$3$adapted(LayoutTileSource.scala:101)
backsplash_1              | 	at geotrellis.raster.MultibandTile.mapBands(MultibandTile.scala:113)
backsplash_1              | 	at geotrellis.layer.LayoutTileSource.$anonfun$read$2(LayoutTileSource.scala:101)
backsplash_1              | 	at scala.Option.map(Option.scala:230)
backsplash_1              | 	at geotrellis.layer.LayoutTileSource.$anonfun$read$1(LayoutTileSource.scala:80)
backsplash_1              | 	at scala.Option.flatMap(Option.scala:271)
backsplash_1              | 	at geotrellis.layer.LayoutTileSource.read(LayoutTileSource.scala:79)
backsplash_1              | 	at com.rasterfoundry.backsplash.BacksplashGeotiff.$anonfun$read$5(BacksplashImage.scala:153)
backsplash_1              | 	at map @ com.rasterfoundry.backsplash.BacksplashGeotiff.$anonfun$read$4(BacksplashImage.scala:154)
backsplash_1              | 	at use @ doobie.util.transactor$Transactor$$anon$4.apply(transactor.scala:162)
backsplash_1              | 	at map @ com.colisweb.tracing.context.OpenTracingContext$.$anonfun$apply$2(OpenTracingContext.scala:57)
backsplash_1              | 	at eval @ org.http4s.server.blaze.BlazeServerBuilder.$anonfun$resource$1(BlazeServerBuilder.scala:434)
backsplash_1              | 	at use @ doobie.util.transactor$Transactor$$anon$4.apply(transactor.scala:162)
backsplash_1              | 	at make @ doobie.util.transactor$Transactor$fromDataSource$FromDataSourceUnapplied.$anonfun$apply$13(transactor.scala:282)
backsplash_1              | 	at make @ doobie.util.transactor$Transactor$fromDataSource$FromDataSourceUnapplied.$anonfun$apply$13(transactor.scala:282)
backsplash_1              | 	at use @ doobie.util.transactor$Transactor$$anon$4.apply(transactor.scala:162)
backsplash_1              | 	at map @ com.rasterfoundry.backsplash.BacksplashGeotiff.$anonfun$read$3(BacksplashImage.scala:148)

The error could be the result of

  1. A bug (very much likely) in the LayoutTileSource (confirmed, see replication steps)
  2. Incorrect out of bounds handling by the backsplash?

To Reproduce

    it("should tile to layout AVIRIS") {
      val tmsLevels = {
        val scheme = ZoomedLayoutScheme(WebMercator, 256)
        for (zoom <- 0 to 64) yield scheme.levelForZoom(zoom).layout
      }.toArray

      val z = 10

      val layoutDefinition = tmsLevels(z)

      // lives under the AWS GeoTrellis account
      val uri = "s3://geotrellis-test/issue-1340-rf-platform/f180627t01p00r05rdn_e_sc01_ort_img_falsecolor-cog.tiff"

      val rs = RasterSource(uri).reproject(WebMercator, method = NearestNeighbor)
      val tl = rs.tileToLayout(layoutDefinition)

      tl.keys.toList.map(tl.read)
    }

Expected behavior

No errors in the logs and the code above should not fail.

The branch: https://github.com/pomadchin/geotrellis/tree/bug/layout-tile-source
Commit: pomadchin@485857d

cc @aaronxsu

@pomadchin pomadchin added the bug label Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant