Hi folks,

I am working on upgrading an application from a much older version of
geotools (15.1) to the latest stable. I've hit a roadblock regarding image
mosaics consisting of indexed PNG files that I think I have narrowed down
to this change:

https://github.com/geotools/geotools/commit/585b021d15df7d132bd6963d7fb78338e814b625


What appears to be happening is that the call to getRawColorModel is
advancing the underlying image stream. Later on in the process that same
stream stream is "seeked" back to the zero position in preparation for the
actual read operation, and that throws an exception:

java.lang.IllegalArgumentException: pos < flushedPos!
at
it.geosolutions.imageio.stream.input.FileImageInputStreamExtImpl.seek(FileImageInputStreamExtImpl.java:285)
at org.geotools.coverage.grid.io.imageio.ReadType$2.read(ReadType.java:131)
at
org.geotools.gce.imagemosaic.GranuleDescriptor.loadRaster(GranuleDescriptor.java:928)


I am guessing it's perhaps some limitation with the PNG format (which I
know is about the worst possible format to be rendering imagery from 🤔 ).

So I guess my first question is would this be considered a bug? Or more or
a limitation with this particular file format? I am guessing a bug since
prior to this change this scenario works.

Assuming that bug is the consensus I'd be happy to attempt a patch but
probably need some guidance on how to proceed. My initial thought for a
"quick fix" was that perhaps we could add a flag to the mosaic
configuration or a read parameter that specified explicitly that the images
in the mosaic have an IndexColorModel so that we can forgo the check and
hence not pre-advance the image stream?

Thoughts appreciated.

Thanks!

-Justin
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to