Hi Simone, thanks for the exaplanation. I would still like to use the acceleration provided through the mlib wrapper, is there a way to use it through maven?
Regarding the colors: all the cells are displayed in shades of grey, despite my styling that contains something like: <ColorMapEntry color="#ffffff" quantity="-1.0" opacity="1.0"/> <ColorMapEntry color="#000000" quantity="0.0" opacity="1.0"/> <ColorMapEntry color="#ffff00" quantity="1.0" opacity="1.0"/> <ColorMapEntry color="#00ff00" quantity="2.0" opacity="1.0"/> <ColorMapEntry color="#00ffff" quantity="3.0" opacity="1.0"/> <ColorMapEntry color="#0000ff" quantity="4.0" opacity="1.0"/> <ColorMapEntry color="#ff00ff" quantity="5.0" opacity="1.0"/> <ColorMapEntry color="#ff0000" quantity="6.0" opacity="1.0"/> So, for instance, I would assume cells with a value of 6 to be rendered as #ff0000 (red), is that right? Thanks Martin Simone Giannecchini wrote: > Ciao Martin, > what you are seeing is just a warning, the only consequence (or at > least the one you should care of) is that JAI will work in pure java > mode, withou native acceleration. > > About the shaded gray, can you be more specific? > > > 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, Feb 17, 2009 at 11:46 AM, Martin Tomko <martin.to...@geo.uzh.ch> > wrote: > >> Dear Simone, >> thank you very much for the simplified sld and the code. Indeed, there is >> progress: the change to the last two lines : >> >> rsh.visit(rs); >> ((GridCoverage2D)rsh.getOutput()).show(); >> >> helped. I guess this is the way it should be included in the tutorial as >> well. However, not all is good yet - while I get the output, it is all only >> in shades of grey, and I am getting the followng error (see stack trace at >> the end of the message). My reading is that it results from the missing >> library (I think the JAI libraries, specially mlibwrapper_jai.jar ). Now, I >> did not install the jai on my machine, as I ues maven to handle my >> classpaths. I searched for a dependency for mlibwrapper_jai.jar without >> success (tried: >> <dependency> >> <groupId>javax.media</groupId> >> <artifactId>mlibwrapper_jai</artifactId> >> <version>${jai.version}</version> >> </dependency>) >> but that throws errors. Even in mvnbrowser there is not artefact declared >> for this class. I have found soem discussion pointing to this requirement in >> the new geotools >> (http://www.mail-archive.com/geotools-de...@lists.sourceforge.net/msg16471.html). >> Is there a way to run this without the mlibwrapper_jai yet, or a way to >> add this as a dependency in the maven build? As I am going to package my >> program as a webservice, I cannot rely on external installation of jai, I am >> afraid. >> >> Thanks a lot for all the help. >> >> Martin >> >> >> >> >> Feb 17, 2009 11:37:13 AM org.geotools.styling.SLDParser parseUserLayer >> INFO: layer name: raster_layer >> Error: Could not find mediaLib accelerator wrapper classes. Continuing in >> pure Java mode. >> Occurs in: com.sun.media.jai.mlib.MediaLibAccessor >> java.lang.NoClassDefFoundError: com/sun/medialib/mlib/Image >> at >> com.sun.media.jai.mlib.MediaLibAccessor$1.run(MediaLibAccessor.java:248) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> com.sun.media.jai.mlib.MediaLibAccessor.setUseMlib(MediaLibAccessor.java:245) >> at >> com.sun.media.jai.mlib.MediaLibAccessor.useMlib(MediaLibAccessor.java:177) >> at >> com.sun.media.jai.mlib.MediaLibAccessor.isMediaLibCompatible(MediaLibAccessor.java:357) >> at com.sun.media.jai.mlib.MlibExtremaRIF.create(MlibExtremaRIF.java:44) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:597) >> at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122) >> at >> javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674) >> at >> javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473) >> at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332) >> at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819) >> at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867) >> at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888) >> at javax.media.jai.RenderedOp$1.getPropertyNames(RenderedOp.java:1791) >> at >> javax.media.jai.PropertyEnvironment.mapDefaults(PropertyEnvironment.java:270) >> at >> javax.media.jai.PropertyEnvironment.getPropertyNames(PropertyEnvironment.java:125) >> at >> javax.media.jai.WritablePropertySourceImpl.addProperties(WritablePropertySourceImpl.java:298) >> at javax.media.jai.RenderedOp.createPropertySource(RenderedOp.java:1817) >> at javax.media.jai.RenderedOp.getProperty(RenderedOp.java:1968) >> at >> org.geotools.image.ImageWorker.getComputedProperty(ImageWorker.java:585) >> at org.geotools.image.ImageWorker.getExtremas(ImageWorker.java:605) >> at org.geotools.image.ImageWorker.rescaleToBytes(ImageWorker.java:748) >> at >> org.geotools.renderer.lite.gridcoverage2d.RasterSymbolizerHelper.execute(RasterSymbolizerHelper.java:108) >> 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) >> 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:209) >> Caused by: java.lang.ClassNotFoundException: com.sun.medialib.mlib.Image >> at java.net.URLClassLoader$1.run(URLClassLoader.java:200) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java:188) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:306) >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:251) >> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) >> ... 34 more >> >> >> >> >> Simone Giannecchini wrote: >> >>> Ciao Martin, >>> I copied and pasted (with few modifications) your stile inside the >>> renderer tests and it worked. I am attaching it to this email. >>> >>> The code used is as follows: >>> >>> RasterSymbolizerHelper rsh = new RasterSymbolizerHelper(gc, >>> null); >>> final UserLayer nl = (UserLayer) sld.getStyledLayers()[0]; >>> final Style style = nl.getUserStyles()[0]; >>> final FeatureTypeStyle fts = >>> style.getFeatureTypeStyles()[0]; >>> final Rule rule = fts.getRules()[0]; >>> RasterSymbolizer rs = (RasterSymbolizer) >>> rule.getSymbolizers()[0]; >>> rsh.visit(rs); >>> ((GridCoverage2D)rsh.getOutput()).show(); >>> >>> What are the characteristics of your data? A gdalinfo might help. >>> >>> Let me know if this works. >>> >>> 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 6:15 PM, Martin Tomko <martin.to...@geo.uzh.ch> >>> wrote: >>> >>> >>>> Hi Simone, >>>> I used the one in your example, with changed values that are to be >>>> mapped, >>>> as follows: >>>> Thanks >>>> Martin >>>> >>>> <?xml version="1.0" encoding="UTF-8" ?> >>>> - <#> <StyledLayerDescriptor xmlns="*http://www.opengis.net/sld*" >>>> xmlns:ogc="*http://www.opengis.net/ogc*" >>>> xmlns:xlink="*http://www.w3.org/1999/xlink*" >>>> xmlns:xsi="*http://www.w3.org/2001/XMLSchema-instance*" >>>> xsi:schemaLocation="*http://www.opengis.net/sld >>>> http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd?*" >>>> version="*1.0.0*"> >>>> - <#> <UserLayer> >>>> <Name>raster_layer</Name> >>>> - <#> <LayerFeatureConstraints> >>>> <FeatureTypeConstraint /> >>>> </LayerFeatureConstraints> >>>> - <#> <UserStyle> >>>> <Name>raster</Name> >>>> <Title>A boring default style</Title> >>>> <Abstract>A sample style for rasters</Abstract> >>>> - <#> <FeatureTypeStyle> >>>> <FeatureTypeName>Feature</FeatureTypeName> >>>> - <#> <Rule> >>>> - <#> <RasterSymbolizer> >>>> - <#> <!-- >>>> >>>> ColorMap type="ramp" extended="true"> >>>> <ColorMapEntry color="#000000" quantity="-1.0" opacity="1.0"/> >>>> <ColorMapEntry color="#ff0000" quantity="0.0" opacity="1.0"/> >>>> <ColorMapEntry color="#ffff00" quantity="1.0" opacity="1.0"/> >>>> <ColorMapEntry color="#00ff00" quantity="2.0" opacity="1.0"/> >>>> <ColorMapEntry color="#00ffff" quantity="3.0" opacity="1.0"/> >>>> <ColorMapEntry color="#0000ff" quantity="4.0" opacity="1.0"/> >>>> <ColorMapEntry color="#ff00ff" quantity="5.0" opacity="1.0"/> >>>> <ColorMapEntry color="#ffffff" quantity="6.0" opacity="1.0"/> >>>> </ColorMap >>>> --> >>>> <Opacity>1.0</Opacity> >>>> - <#> <ChannelSelection> >>>> - <#> <GrayChannel> >>>> <SourceChannelName>1</SourceChannelName> >>>> - <#> <ContrastEnhancement> >>>> <Normalize /> >>>> </ContrastEnhancement> >>>> </GrayChannel> >>>> </ChannelSelection> >>>> - <#> <ContrastEnhancement> >>>> <GammaValue>1</GammaValue> >>>> </ContrastEnhancement> >>>> </RasterSymbolizer> >>>> </Rule> >>>> </FeatureTypeStyle> >>>> </UserStyle> >>>> </UserLayer> >>>> </StyledLayerDescriptor> >>>> >>>> >>>> Simone Giannecchini wrote: >>>> >>>> >>>>> 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 <martin.to...@geo.uzh.ch> >>>>> 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 >>>>>>> <martin.to...@geo.uzh.ch> >>>>>>> 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 >>>>>>>> Geotools-gt2-users@lists.sourceforge.net >>>>>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> -- >>>> Martin Tomko >>>> Postdoctoral Research Assistant Geographic Information Systems Division >>>> Department of Geography >>>> University of Zurich - Irchel >>>> Winterthurerstr. 190 >>>> CH-8057 Zurich, Switzerland >>>> >>>> email: martin.to...@geo.uzh.ch >>>> site: http://www.geo.uzh.ch/~mtomko >>>> mob: +41-788 629 558 >>>> tel: +41-44-6355256 >>>> fax: +41-44-6356848 >>>> >>>> >>>> >>>> >> >> >> > > > ------------------------------------------------------------------------------ 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 Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users