Hi Christian,
I concur, I was looking at that same bit of code as the likely culprit. I
can also verify from some of my test code that
my image is likely being read in through
ImageDecodedThread.readImage2
When I read in my image using similar code, it's type is indeed
BufferedImage.TYPE_CUSTOM.
If you can send me a jar for testing, that would be fantastic!
Thanks again,
Mike
On Wed, Jun 12, 2013 at 2:45 AM, Christian Mueller <
christian.muel...@os-solutions.at> wrote:
> Hi Mike
>
> I think I found the problem. It is in
>
> ImageComposerThread.getStartImage
>
>
> The unlucky code sequence is
>
> if (imageType == BufferedImage.TYPE_CUSTOM)
> imageType = ImageMosaicJDBCReader.DEFAULT_IMAGE_TYPE;
>
>
> I think your image type is custom and the default type is RGB wit 3 bands
> using bytes.
>
> Should I try to fix this code and send you a jar file for testing. The
> idea would be to create the start image with
> the following constructor
>
> public BufferedImage (ColorModel cm,
> WritableRaster raster,
> boolean isRasterPremultiplied,
> Hashtable<?,?> properties) {
>
> Perhaps this will do the trick.
> Please let me know
>
> Christian
>
>
>
>
>
>
>
>
>
>
> 2013/6/11 mrollans <mroll...@gmail.com>
>
>> Hi Christian,
>>
>> I was curious what that would reveal too, so I tried that yesterday
>> afternoon. I put together a small java jdbc program to run
>>
>> select st_astiff(rast) from test
>>
>> from my postgis database and dumped the result to a file. I then gdalinfo
>> my original file (prior to the postgis load) and the one output from
>> postgis
>> and diffed the results.
>>
>> The only differences between the two were the reported file names and a
>> slight difference in the reported NoData Value (which I suspect was due to
>> rounding differences). Otherwise, the output was identical, 1 reported
>> band
>> of type Float32, ColorInterp=Gray etc.
>>
>> I could open the tif output from postgis in QuantumGis and apply a color
>> style and view the data values just fine.
>>
>> I suspect this means the problem is somewhere downstream of the st_astiff
>> call. Perhaps something with the construction of the GridCoverage2d based
>> on the image in ImageComposerThread? I don't have the familiarity or
>> context around the GeoTools code to really understand what it is trying to
>> do just yet, but it seems like a strong possibility that something is
>> going
>> wrong in there someplace.
>>
>> As a point of interest, with fine detail logging turned on in GeoServer I
>> can see the following output when I try to preview my layer from the
>> geotiff
>> loaded from the filesystem.
>>
>> 11 Jun 13:01:47 DEBUG [geoserver.ows] - Getting layers and styles from
>> LAYERS an
>> d STYLES
>> 11 Jun 13:01:47 DEBUG [geoserver.ows] - establishing raster style for
>> cite:testf
>> s
>> 11 Jun 13:01:47 DEBUG [geoserver.wms] - setting up map
>> 11 Jun 13:01:47 DEBUG [wms.map] - setting up 578x330 image
>> 11 Jun 13:01:47 DEBUG [geotools.rendering] - Drawing coverage
>> GridCoverage2D["te
>> st", GeneralEnvelope[(-104.053125, 46.359375), (-99.415625, 49.003125)],
>> Default
>> GeographicCRS["WGS 84"]]
>> ? RenderedSampleDimension("GRAY_INDEX":[-3.402823E38 ... -3.402823E38])
>> ? ? Category("No data":[-3.402823E38 ... -3.402823E38])
>> ? Image=RenderedOp["ImageRead"]
>>
>> 11 Jun 13:01:47 DEBUG [geotools.rendering] - Transforming coverage
>> envelope
>> with
>> transform PARAM_MT["Affine",
>> PARAMETER["num_row", 3],
>> PARAMETER["num_col", 3]]
>> 11 Jun 13:01:47 DEBUG [geotools.rendering] - Using interpolation
>> javax.media.jai
>> .InterpolationNearest@1616dd6
>>
>>
>> Versus similar output when trying layer preview for my postgis raster.
>>
>>
>> 11 Jun 13:15:56 INFO [imagemosaic.jdbc] - Coverage test using spatial
>> table
>> null
>> , image table test
>> 11 Jun 13:15:56 INFO [jdbc.custom] - Using 2 CPU(s)
>> 11 Jun 13:15:56 INFO [jdbc.custom] - Getting 1 Tiles needs 125 millisecs
>> 11 Jun 13:15:57 INFO [jdbc.custom] - Getting and decoding 1 Tiles needs
>> 406
>> mil
>> lisecs
>> 11 Jun 13:15:57 INFO [imagemosaic.jdbc] - Mosaic Reader needs : 422
>> millisecs
>> 11 Jun 13:15:57 DEBUG [geotools.rendering] - Drawing coverage
>> GridCoverage2D["te
>> st", GeneralEnvelope[(-104.35202636719, 46.186743164062),
>> (-99.116723632811,
>> 49.
>> 175756835937)], DefaultGeographicCRS["WGS 84"]]
>> ? RenderedSampleDimension("test":[0.0 ... 255.0])
>> ? ? Category("test":[0...255])
>> ? RenderedSampleDimension("test":[0.0 ... 255.0])
>> ? ? Category("test":[0...255])
>> ? RenderedSampleDimension("test":[0.0 ... 255.0])
>> ? ? Category("test":[0...255])
>> ? Image=WritableRenderedImageAdapter[]
>>
>> 11 Jun 13:15:57 DEBUG [geotools.rendering] - Transforming coverage
>> envelope
>> with
>> transform PARAM_MT["Affine",
>> PARAMETER["num_row", 3],
>> PARAMETER["num_col", 3]]
>> 11 Jun 13:15:57 DEBUG [geotools.rendering] - Using interpolation
>> javax.media.jai
>> .InterpolationNearest@1136019
>>
>> So, by the point the GridCoverage2d is logged, the
>> RenderedSampleDimensions
>> are wrong in the second case.
>>
>> Mike
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://osgeo-org.1560.x6.nabble.com/Image-Mosaic-JDBC-single-band-raster-losing-data-values-tp5058549p5059493.html
>> Sent from the GeoServer - User mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> Geoserver-users mailing list
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>
>
>
> --
> DI Christian Mueller MSc (GIS), MSc (IT-Security)
> OSS Open Source Solutions GmbH
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users