Martin Tomko a écrit :

> Now, I noticed that this approach is *similar*to some test cases in 
> http://svn.geotools.org/trunk/modules/library/coverage/src/test/java/org/geotools/coverage/grid/GridCoverageTestBase.java
>  
> 
> but in these test cases it does not seem to be necessary to create the 
> new SerializableRenderedImage. Can anyone please comment on this?

This test case is serializing GridCoverage2D, not RenderedImage. Like mentioned 
in my previous email, GridCoverage2D is already made serializable using the 
technic mentioned by Christian.


> What I need is the output of a Coverage (or Geotiff, anything that will 
> be contained aas one object and will contain georeferencing information 
> - at least the ReferencedEnvelope).
> I need to pass the coverage to a remote service that will decode it. The 
> coverage has a ReferencedEnvelope, and that is what I need to be passed 
> with the raw data.
> I have control over the decoding of the byte[] to an extent, so I can 
> have  a less standard way of decoding it.

If you have a GridCoverage2D instance, you can do:

// Writting
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(buffer);
out.writeObject(theCoverage);
out.close();
byte[] asArray = buffer.getArray();


// Reading
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(asArray));
GridCoverage2D theCoverage = (GridCoverage2D) in.readObject();
in.close();

        Martin

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to