Hi Daniele,

i was able to recover the error. It was my faulty user code again.
I did not set the tiling parameters for the geotiff correctly. I switched
the GeoTiff file writing method to

try
        {
            GeoTiffFormat format = new GeoTiffFormat();
            GeoTiffWriteParams wp = new GeoTiffWriteParams();
            File filetiff = new File(filename);
            GeoTiffWriter gcw = (GeoTiffWriter)format.getWriter(filetiff);

            wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
            wp.setCompressionType("LZW");
            wp.setTilingMode(GeoToolsWriteParams.MODE_DEFAULT);

            ParameterValueGroup paramWrite = format.getWriteParameters();
            
paramWrite.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue(wp);


                        gcw.write(toWrite,
(GeneralParameterValue[])paramWrite.values().toArray(new
                                        GeneralParameterValue[1]));
                }
        catch (Exception e1)
        {
            e1.printStackTrace();
        }

and it performs well.

Thank you,

Matthias Hofmann


> Hi Matthias,
> if you can share a whole test case (I mean: a fully coded java class as
> well
> as the sample data needed to test it) I can take a look on it.
> How do you "View" the output geotiff? (Which software are you using?)
> Could you run a "gdalinfo -stats youroutputfile.tif" and let me know what
> is
> reported?
>
> Please, let me know.
> Best Regards,
> Daniele
>
>
> On Tue, Feb 23, 2010 at 11:51 AM, Matthias Hofmann <
> [email protected]> wrote:
>
>> 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&#174; 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
>>
>
>
>
> --
> -------------------------------------------------------
> Eng. Daniele Romagnoli
> Software Engineer
>
> GeoSolutions S.A.S.
> Via Carignoni 51
> 55041 Camaiore (LU)
> Italy
>
> phone: +39 0584983027
> fax:     +39 0584983027
> mob:   +39 328 0559267
>
>
> http://www.geo-solutions.it
>
> -------------------------------------------------------
>



------------------------------------------------------------------------------
Download Intel&#174; 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