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 Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users