SuccessChanges

Summary

  1. Make GeoKeyDirectory parsing more fault tolerant (details)
  2. Add comment on return type for `readGeoKeyEntry` (details)
Commit 1445a974cafaa51d866d4855bc2231594c73703e by cbrown
Make GeoKeyDirectory parsing more fault tolerant
This commit makes the reading of GeoKeyDirectory entries more fault
tolerant to cover cases where the `NumberOfKeys` entry in the directory
header has an incorrect number of headers that is actually larger than
the number of keys. This manifested itself when attempting to read a
tiff created by a geoprocessing service from an ArcGIS server. The tiff
could be read and parsed by other tools (GDAL, QGIS) without issue but
when attempting to open it with GeoTrellis a `scala.MatchError` would be
thrown in `readGeoKeyEntry`.
The workaround introduced here is that if a geokey is read and fails to
match then it likely means there are no longer any valid geokeys to
read. I'm open to other approaches to the workaround than the one
offered here - one option is to introduce a try/catch and only catch on
`java.nio.Exception` which can happen if the number of keys is large
enough that reading too many keys (and ignoring them) leads to a buffer
underflow.
Signed-off-by: Chris Brown <cbrown@azavea.com>
The file was modifiedraster/data/geotiff-test-files.zip (diff)
The file was modifiedraster/src/test/scala/geotrellis/raster/io/geotiff/reader/GeoTiffReaderSpec.scala (diff)
The file was modifiedraster/src/main/scala/geotrellis/raster/io/geotiff/tags/GeoKeyReader.scala (diff)
Commit 788a03464d05420ebf6f97da9b5b170d223e2072 by cbrown
Add comment on return type for `readGeoKeyEntry`
The file was modifiedraster/src/main/scala/geotrellis/raster/io/geotiff/tags/GeoKeyReader.scala (diff)