Morning Kedar: Thanks for joining us on the user list (perhaps you can
remove your comments added to the ImageLab page? Or I can when we sort
out the example again.

Since the ImageLab example was written GeoTools now has the ability to
make use of a raster symbolizer; I suspect that this new found skill
is what is tripping us up (I suspect we need to do a better job of
setting up our style prior to drawing).

Perhaps the style refers to "Band 3" expecting and RGB image? If it is
not around (say we are using a color indexed image) we would get an
error such as you describe.

Jody

On Wed, Apr 8, 2009 at 12:15 AM, kedar marathe <[email protected]> wrote:
> The ImageLab.java file in the "User Guide" for Geotools, if compiled "as it
> is", gives the error ...."variable 'style' not found" at the line:
>
>     renderer.paint( g, coverage, style );
>
> ....we removed this error by feeding this code before "renderer.paint( g,
> coverage, style ); "  :-
>
>  //---------------------------------------------------------------------------------------------
>
>             StyleFactory factory =
> CommonFactoryFinder.getStyleFactory(null);
>             StyleBuilder sb = new StyleBuilder(factory);
>
>
> ColorMap cm = sb.createColorMap(
>
> new String[]{"0", "255"},
>
> new double[]{0, 255},
>
> new Color[]{ new Color(0, 0, 0),new Color(255, 255, 255)}
>
> ,ColorMap.TYPE_RAMP);
>
>             RasterSymbolizer sym = sb.createRasterSymbolizer(cm, 1.0);
>             Style style = sb.createStyle(sym);
>  //---------------------------------------------------------------------------------------------
>
> But then we got the error :
>
> "The method paint(Graphics2D, GridCoverage2D, RasterSymbolizer) in the type
> GridCoverageRenderer is not applicable for the arguments (Graphics2D,
> GridCoverage2D, Style)"
>
> So then we added "sym" as a parameter to paint method instead of "style":
>
> //----------------------------------------------------------------------
>
> renderer.paint( g, coverage, sym /*style*/);
>
> //----------------------------------------------------------------------
>
> and now it builds and compiles alright, but instead of displaying the world
> image it gives the following error in the display pane:
>
> "Band number 3 is not valid"
>
> ....any suggestions? please help!
>
> -Kedar
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to