Hi,

i have a problem with the GeoTiff writer:
I create a GridCoverage which is correctly colored and showed, for e.g. by
executing gc.show(). Writing it into png and normal tif-files works also
without any problem, but not in GeoTiff.
For inking the image i use the SLDParser with an associated style file.

Coupling the rendered image to the GridCoverage2D is processed here:

////////////////
GridCoverage2D toWrite = CoverageFactoryFinder.getGridCoverageFactory(null)
                                .create("Precipitation",
                                
((GridCoverage2D)rsh_SLD.getOutput()).geophysics(false).getRenderedImage(),
                                env,gsdPrec,null,null);
///////////////

Writing the Geotiff is processed here:

///////////////
GeoTiffFormat format = new GeoTiffFormat();
        /*final File writeFile = new File("Test.tiff");
                final GridCoverageWriter writer = format.getWriter(writeFile);
        toWrite.show();*/

        GeoTiffWriteParams wp = new GeoTiffWriteParams();

                wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
                wp.setCompressionType("LZW");
                ParameterValueGroup paramWrite = format.getWriteParameters();
                
paramWrite.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue(wp);

        try
        {
           File filetiff = new File(filename);
           GeoTiffWriter gcw = (GeoTiffWriter)format.getWriter(filetiff);
           gcw.write(toWrite,
(GeneralParameterValue[])paramWrite.values().toArray(new
                                        GeneralParameterValue[1]));
           gcw.dispose();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
/////////////////

The written files size is about 3MB so i think it is not empty, but it is
only black.

Any ideas?

Thank you,

Matthias Hofmann


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to