JGrass, some problems with GridSampleDimension in GrassCoverageReader

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JGrass, some problems with GridSampleDimension in GrassCoverageReader

Daniele Andreis
Hi all,

I have created a chain of JAI operation, in JGrass, which use to read the map  the JGrass extension of JAI image I/O.
I have done some test and it run well, but with one map it thrown an exception. The problem is in the GrassCoverageReader class (eu.hydrologis.jgrass.libs.iodrivers.geotools) in the method createGridSampleDimension.
With the other map at the line 550:

        if (!colorRules.matches(".*Infinty.*|.*NaN.*")) {
            colorRulesSplit = colorRules.split(GrassBinaryImageMetadata.RULESSPLIT);
        } else {
            List<String> defColorTable = JGrassColorTable.createDefaultColorTable(range, 255);
            colorRulesSplit = (String[]) defColorTable.toArray(new String[defColorTable.size()]);
        }

the condition is true but with this one is false. So at the line 599:

                Category dataCategory = new Category(sB.toString(), colors[i], lower, upper, scale,
                        offSet);

the value of scale and offset aren't valid value and the exception is thrown.

I haven't understand this part of the code (which is related with the color table, I think) so I ask if anybody can help me.




thanks and regards.

--
Daniele Andreis

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
Reply | Threaded
Open this post in threaded view
|

Re: JGrass, some problems with GridSampleDimension in GrassCoverageReader

Andrea Antonello
Hi Daniele,

> I have created a chain of JAI operation, in JGrass, which use to read the
> map  the JGrass extension of JAI image I/O.
> I have done some test and it run well, but with one map it thrown an
> exception. The problem is in the GrassCoverageReader class
> (eu.hydrologis.jgrass.libs.iodrivers.geotools) in the method
> createGridSampleDimension.
> With the other map at the line 550:
>
>>         if (!colorRules.matches(".*Infinty.*|.*NaN.*")) {
>>             colorRulesSplit =
>> colorRules.split(GrassBinaryImageMetadata.RULESSPLIT);
>>         } else {
>>             List<String> defColorTable =
>> JGrassColorTable.createDefaultColorTable(range, 255);
>>             colorRulesSplit = (String[]) defColorTable.toArray(new
>> String[defColorTable.size()]);
>>         }
>
> the condition is true but with this one is false. So at the line 599:
>
>                 Category dataCategory = new Category(sB.toString(),
> colors[i], lower, upper, scale,
>                         offSet);
>
> the value of scale and offset aren't valid value and the exception is
> thrown.
>
> I haven't understand this part of the code (which is related with the color
> table, I think) so I ask if anybody can help me.

yes, this part is definitely related to colortable and still a
bridgepoint between old grass raster reading based on grass colortable
and the new imageio based reading, which will then need to be SLD
based. The raster symbolizer migration is still missing, so some
workarounds were needed.

In the above example you will have to check why the condition gets
false, leading to error. Consider that the colortable is passed as a
string containing the color tripplets that form the colorramp also
used for the legend. From this the colors are created also fro the
map. So somehow the colortable contains an Infinity or NaN and a
default one is created (which bases on the grass rainbow colortable).
If it drops error, perhaps the default colortable is not created?

Ciao
Andrea





>
>
>
>
> thanks and regards.
>
> --
> Daniele Andreis
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
Reply | Threaded
Open this post in threaded view
|

Re: JGrass, some problems with GridSampleDimension in GrassCoverageReader

Daniele Andreis
Thanks for the help.

I have solved my problem (I haven't set correctly the range of the value in the read operation).

ciao
--
Daniele Andreis

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel