I had tracked an issue with GeoWave's implementation of AbstractGridFormat
in which it seems the AbstractGridCoverage2DReader was storing and
retrieving source images that had a single 16-bit band from landsat8 (so
the data type for this sample model is unsigned short). The GridCoverage2D
tiles that were being returned from the reader looked correct, but as it
passed through the rendering pipeline in geotools it converted the image to
8-bits per band and rescaled the samples. This rescaling was based on a
calculation of local extrema performed by ImageWorker (at least local to
the tile request). For a mosaic the result was this:
https://s3-us-west-2.amazonaws.com/geowave-content/example_byte_rescale_issue.png
In digging into the code a bit, the tile request is rescaled to byte here
using that local extrema calculation:
https://github.com/geotools/geotools/blob/master/modules/library/render/src/main/java/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerHelper.java#L130
I am using the raster SLD that comes with geoserver out of the box, and
have looked at ways to apply rescaling using pre-defined global extrema. I
*think* that one workaround could be to add a ContrastEnhancement tag to
the SLD with a normalize tag for a predefined min and max. Having to
hard-code it in an sld doesn't seem particularly desirable. In the global
mosaic case, for example, the extrema may change as new data is ingested,
and generally its always an extra step with an opportunity for user error.
Considering we persist an overall histogram per (mosaic'ed) grid coverage
layer it seems that within our raster format implementation we could
automate this.
So in the meantime, my takeaway from reading the code is that there is
ultimately a need to convert the image to 8-bit at some point in the render
pipeline and perhaps it may make sense to always do that conversion upfront
within our raster format where we have a little more control? If that's
the case, to do this, my current work-around trying to re-use as much of
the existing classes is to get an instance of an ImageWorker that allows me
to set global statistics:
https://github.com/ngageoint/geowave/blob/GEOWAVE-346-landsat8/extensions/adapters/raster/src/main/java/mil/nga/giat/geowave/adapter/raster/ImageWorkerPredefineStats.java
Then I can call rescaleToBytes() using the global extrema for any grid
coverage prior to returning it from our raster format. Does that seem
reasonable? Am I missing something obvious or misusing the library in some
way?
Thanks in advance for the feedback!
Rich
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel