Ciao,
your RasterSymbolizer is almost empty, you are not specifying a colormap.
An ArcGrid is a raster made by float data, therefore, it has not
implciti rendering. What the ArcGrid GeoTools plugin does is to set up
a standard color ramp useful for DEM data.
Long story short, your raster seems to have values close to zero
(green for DEM) and you are currently visualizing it using a default
color ramp; suggestion is to create a real coloramp:
http://docs.codehaus.org/display/GEOTOOLS/Raster+Symbolizer+support


Simone.
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Founder - 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://geo-solutions.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini
http://twitter.com/simogeo

-------------------------------------------------------



On Fri, May 14, 2010 at 11:15 PM, Adnila <[email protected]> wrote:
>
> Hey guys,
> can you help me?
>
> I am trying to display a GridCoverage2D. But I am just getting a green area.
> The whole grid is a green area. My code snippet looks like this:
>
> public MapContext mapRasterBrowse(ArcInfoGridReader aigrid) {
>                // method to visualize grid coverage 2D
>                ascfile = getAscFile(aigrid);
>                gc2D = aigrid.inputGridCoverage(ascfile);
>
>                // create a new map context
>                MapContext mapRasterInput = new DefaultMapContext();
>
>                // set title of map
>                mapRasterInput.setTitle("Map of raster input");
>                // add layer to map
>                try {
>                        style = createGreyscaleStyle();
>                        mapRasterInput.addLayer(gc2D, style);
>                        this.setRenderer(new StreamingRenderer());
>                        this.setMapContext(mapRasterInput);
>                        this.setDisplayArea(mapRasterInput.getLayerBounds());
>                } catch (Exception e1) {
>                        // auto-generated catch block
>                        e1.printStackTrace();
>                }
>                return mapRasterInput;
>        }
>
> and creategrayscale from ImageLab:
> /**
>         * create a style to display the GridCoverage2D as a greyscale layer
>         * @return a new style instance to render the image in greyscale
>         */
>        private Style createGreyscaleStyle() {
>                sf = CommonFactoryFinder.getStyleFactory(null);
>                ff = CommonFactoryFinder.getFilterFactory2(null);
>
>                ContrastEnhancement ce = 
> sf.contrastEnhancement(ff.literal(1.0),
> ContrastMethod.NORMALIZE);
>                SelectedChannelType sct = 
> sf.createSelectedChannelType(String.valueOf(1),
> ce);
>
>                RasterSymbolizer sym = sf.getDefaultRasterSymbolizer();
>                ChannelSelection sel = sf.channelSelection(sct);
>                sym.setChannelSelection(sel);
>
>                return SLD.wrapSymbolizers(sym);
>        }
>
> there is no error, but i am just seeing a green area. Where is the problem?
> Has anybody any idea?
> thanks in advance
>
> --
> View this message in context: 
> http://osgeo-org.1803224.n2.nabble.com/Problems-displaying-gridCoverage2D-everything-is-green-tp5057223p5057223.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

------------------------------------------------------------------------------

_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to