That code nees to be update, you cannot apply a colormap element on a multiband image unless you select a band first using the channelselection element.
Simone. ------------------------------------------------------- Ing. Simone Giannecchini GeoSolutions S.A.S. Owner - Software Engineer Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob: +39 333 8128928 http://www.geo-solutions.it http://simboss.blogspot.com/ http://www.linkedin.com/in/simonegiannecchini ------------------------------------------------------- On Tue, Apr 7, 2009 at 4:15 PM, 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
