Ciao Martin, please, send over the SLD file you are using.
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 Mon, Feb 16, 2009 at 5:57 PM, Martin Tomko <[email protected]> wrote: > Hi Simone, > I have solved the Style factory problem as follows: > SLDParser stylereader = new SLDParser(new StyleFactoryImpl() , > sldfile); > I have imported the UserLayer, Style and all following classess from > org.geotools.styling (it seems that classes with the same name are also in > org.opemgis...). The methods called are shown as deprecated (I work with > 2.5-SNAPSHOT thorugh maven). Anyway, I tried to use them. > > I am not able to run your example because of the line: > rsh_SLD.visit(rs_1).show(); > > where > SubchainStyleVisitorCoverageProcessingAdapter rsh_SLD = new > RasterSymbolizerHelper(gc, null); > final RasterSymbolizer rs_1 = (RasterSymbolizer) rule.getSymbolizers()[0]; > > where show() cannot be invoked on a type void. Any idea why this is? > I tried a workaround (also tried through theexecute method): > GridCoverage2D tmpgc = (GridCoverage2D)rsh_SLD.getOutput(); > tmpgc.show(); > > but I am getting the following error: > Feb 16, 2009 5:49:01 PM org.geotools.styling.SLDParser parseUserLayer > INFO: layer name: raster_layer > Exception in thread "main" > org.geotools.coverage.processing.CoverageProcessingException: > java.lang.NullPointerException > at > org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.getOutput(BaseCoverageProcessingNode.java:339) > at > org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.getOutput(BaseCoverageProcessingNode.java:42) > at > org.geotools.renderer.lite.gridcoverage2d.StyleVisitorCoverageProcessingNodeAdapter.getOutput(StyleVisitorCoverageProcessingNodeAdapter.java:180) > at ch.uzh.geo.tomko.GTViewshed.GTtest.main(GTtest.java:207) > Caused by: java.lang.NullPointerException > at > org.geotools.renderer.lite.gridcoverage2d.RasterSymbolizerHelper.execute(RasterSymbolizerHelper.java:69) > at > org.geotools.renderer.lite.gridcoverage2d.RasterSymbolizerHelper.execute(RasterSymbolizerHelper.java:48) > at > org.geotools.renderer.lite.gridcoverage2d.StyleVisitorCoverageProcessingNodeAdapter$1.execute(StyleVisitorCoverageProcessingNodeAdapter.java:140) > at > org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.checkExecuted(BaseCoverageProcessingNode.java:235) > at > org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.getOutput(BaseCoverageProcessingNode.java:337) > ... 3 more > > Any help more than welcome, > Martin > > > Simone Giannecchini wrote: >> >> Ciao Martin, >> a way to achieve that is by using the RasterSymbolizer (2.5.0 and >> successive releases). >> See http://docs.codehaus.org/display/GEOTOOLS/Raster+Symbolizer+support >> for more information. >> >> >> 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 Mon, Feb 16, 2009 at 3:59 PM, Martin Tomko <[email protected]> >> wrote: >> >>> >>> Dear all, >>> I am creating a gridcoverage2D (and consequently a geotiff, based on >>> processing of a source geotiff DEM), and I want to quickly visualize the >>> results of the analysis. Instead of opening it in some GIS, I would like >>> to assign a color model to the result.and display it through the show() >>> method. I tried to change the viewtype, but it does not seem to help. >>> >>> My GridCoverage2D is created as follows: >>> >>> WritableRaster hor = ...; >>> GridCoverage2D gchor = gcFactoryhor.create("hor", hor, env); >>> gchor.view(ViewType.GEOPHYSICS); >>> gchor.show(); >>> >>> and I use a GeoTiffWriter to output the geoTiff. Note that ArcMap open >>> the geotiff fine (requiring classification to assign colors), as well as >>> a normal image viewer (e.g., XnView), but the result is just a binary >>> nodata/anydata black and white rendering. >>> >>> I see that it is possible to assign colors in the GridCoverage2D gchor = >>> gcFactoryhor.create(...) part, but I am not sure how to map the values >>> in the raster to the colors. Any hints welcome. >>> >>> Thanks >>> Martin >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, >>> CA >>> -OSBC tackles the biggest issue in open source: Open Sourcing the >>> Enterprise >>> -Strategies to boost innovation and cut costs with open source >>> participation >>> -Receive a $600 discount off the registration fee with the source code: >>> SFAD >>> http://p.sf.net/sfu/XcvMzF8H >>> _______________________________________________ >>> Geotools-gt2-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >>> >>> >> >> >> > > > > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
