Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Re: [-DETECTION SPAM-] [Geotools-devel] Re: Raster Data Images

Hi Martin,
talking about Raster Data Images support, I have the follwing problem
with the non geophysic view of data.

As you know I am trying to write the plugin to read and write
images+world file. The problem I ran into is that when I create a grid
coverage from a REAL buffered image (which means not just a container
for FLOAT, DOUBLE or other geophisic data) the GridCoverage2D class
automatically tries to create a non geophysisc view of it.
I saw that I can control this using the HInts but this control is
quite limited for several reasons.

1>I can only set the sample dimension type for reascaling to byte and
ushort, therefore if I have more than 16 bit on an image's band it
will get rescaled no matter what I want to do.
2>If I have a multiband image and if it gets rescaled, you
automatically choose an IndexColorModel based on the band 0 (if no
visible band has been set). This is not good since if I have a
multiband image I will get it back from the non geophisic view as a
grayscale image!

You might object, ok then use the geophysic view of your data and stop
bothering me! :-)

Well, it is not that simple, for 2 reasons:
1>In the world image writer I get to work with all kind of grid
coverages, regardless the type of input data they were created from,
therefore they might be metereological floating point model as well as
ikonos geotiff images, therefore I always need to rely and the fact
that the non-geophysics view of the GC is the one  I want to show and
write down as an image.
2>As you might know me and Alessio are close to have a, let's say, 0.1
version of WCS which is also able to render GC throught the WMS (in
geoserver). Well it turned out that WMS renderers GC using the non
geophysic view of them. Therefore again we need a way to control the
creation of such non-geophysic view for GC because it is gaining more
and more importance with the implementation of the WCS.


Now that I might have conviced you that we need to find a way to
control the creation of the non-geophysic view, I can try to propose a
quick solution.

I carefully read all your code for the coverage package and
subpackages, and I think that it should be easy and painless to
achieve that by adding a new Hint in

org.geotools.factory.Hints, let's say Hints.AVOID_NON_GEOPHYSICS

which would control the rescaling process.

Once we have this hint you should add a slightly modified version of
the GridCoverage2D contructors that accepts a RenderedImage a Hint as
the last parameter, and you should also do the same with the private
constructor whose signature is

private GridCoverage2D(final CharSequence             name,
                           final PlanarImage             image,
                           final CoordinateReferenceSystem crs,
                                 GridGeometry2D   gridGeometry, // ONE
and only one of those two
                                 GeneralEnvelope      envelope, //
arguments should be non-null.
                           final GridSampleDimension[] sdBands,
                           final GridCoverage[]        sources,
                           final Map                properties)
            throws MismatchedDimensionException, IllegalArgumentException

Once this is in place you need to update the static method of
GridSampleDimension class whose signature is:

static boolean create(final CharSequence        name,
                          final RenderedImage       image,
                          final GridSampleDimension[] src,
                          final GridSampleDimension[] dst)

which allows you to create the SampleDimensions for the GC.

In this method you should simply pass the hint to the private create
method of that same class whose signature is

    private static void create(final CharSequence          name,
                               final RectIter              iterator,
                               final int                   rasterType,
                               double[]                    min,
                               double[]                    max,
                               final Unit                  units,
                               final Color[][]             colors,
                               final GridSampleDimension[] dst,
                               final RenderingHints        hints)
    
Well in this method you should simply check if non-geophysic view is
needed, and if not using the identity transformation to build the
cateogyr for each band. with the result that geophysic(false)==
geophysic(true) for such a GC2D.


Ok, sorry for being so talkative but I wanted to be very clear. We
really need this feature and I already implemented this way and it
seems to works. How should I proceed? Do you want me to send you this
code?

Simone.

On 5/13/05, simone giannecchini <simboss1@xxxxxxxxx> wrote:
> On 5/13/05, Martin Desruisseaux <martin.desruisseaux@xxxxxxxxxxxxx> wrote:
> > simone giannecchini a écrit :
> > > Just a note on this, the "world plus image" plugin is reaching a
> > > decent stage. I would like to have someone to work on it for testing
> > > and improvement.
> >
> > Thanks for the tip. After a quick look to the "world plus image", I
> > think that the two code (the new plugin and the legacy
> > ExoreferencedGridCoverageReader) are complementary. The layer was a kind
> > of general framework for reading text files in different format. The new
> > plugins concern more specifically the file for specific image format. I
> > will looks how to merge them when I will have a chance.
> 
> I agree. I focused more on supporting real images format for the
> moment but when I ported the gtopo30 I made some experience on the
> fraw files therefore I would really like to help you out with this
> second issue.
> 
> > As a side note, I wonder if we could find a more intutive package name
> > than org.geotools.gce. What about org.geotools.coverage.io?
> >
> >         Martin.
> >
> No exceptions reaised from here. I will make change but we should wait
> one or two weeks 'cause I have not time for that now!
> 
> Simone.
>


Back to the top