Thanks Michael,
I have already try some JAI Descriptors but the point is that I cannot write
the resulting coverage in a tif file because I always receive Java heap
space exception(see below). Perhaps I need to provide some parameters to
avoid such an exception.
Regards.
Agossa.
---------------------
RenderedImage img1 = cov1.getRenderedImage();
RenderedImage img2 = cov2.getRenderedImage();
RenderedImage result = MultiplyDescriptor.create(img1, img2, null);
GridCoverageFactory gcf=new GridCoverageFactory();
cov2 = gcf.create("dd", result,
cov2.getEnvelope(),cov2.getSampleDimensions(),null,null);
GeoTiffWriter geotiffw=null;
try {
geotiffw= new GeoTiffWriter(new
File("d:/data/try.tif"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
geotiffw.write(cov2, null);
-------------------
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.lang.AbstractStringBuilder.<init>(Unknown Source)
at java.lang.StringBuffer.<init>(Unknown Source)
at
com.sun.media.imageioimpl.plugins.tiff.TIFFFieldNode.initialize(TIFFFieldNode.java:165)
at
com.sun.media.imageioimpl.plugins.tiff.TIFFFieldNode.getLength(TIFFFieldNode.java:205)
at org.jdom.input.DOMBuilder.buildTree(DOMBuilder.java:276)
at org.jdom.input.DOMBuilder.buildTree(DOMBuilder.java:280)
at org.jdom.input.DOMBuilder.buildTree(DOMBuilder.java:280)
at org.jdom.input.DOMBuilder.build(DOMBuilder.java:147)
at
org.geotools.gce.geotiff.GeoTiffWriter.createGeoTiffIIOMetadata(GeoTiffWriter.java:436)
at
org.geotools.gce.geotiff.GeoTiffWriter.writeImage(GeoTiffWriter.java:384)
at org.geotools.gce.geotiff.GeoTiffWriter.write(GeoTiffWriter.java:225)
Michael Bedward wrote:
>
> No - that hasn't been included in the OperationJAI classes. The
> easiest way for you to do it is to use JAI directly.
>
> For example, assuming that your two grid coverages have the same
> bounds here is one was of doing it...
>
> import javax.media.jai.operator.MultiplyDescriptor;
>
> RenderedImage img1 = cov1.getRenderedImage();
> RenderedImage img2 = cov2.getRenderedImage();
> RenderedImage result = MultiplyDescriptor.create(img1, img2, null);
>
> Then you can use GridCoverageFactory to create a coverage from the result
> image
> http://javadoc.geotools.fr/2.5/org/geotools/coverage/grid/GridCoverageFactory.html
>
> Hope this helps
>
> Michael
>
> ------------------------------------------------------------------------------
> 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
>
>
--
View this message in context:
http://n2.nabble.com/Making-an-Operation-with-two-GridCoverages-as-operand--in-Geotools-tp2347456p2353660.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
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