Hello Michael,
DiskMemImage seems exactly what I was looking for.

Thanks for the link and also for writing so useful piece of code.
I'll try it right now!

César



El día 1 de noviembre de 2009 10:56, Michael Bedward
<[email protected]> escribió:
> Sigh...
>
> Here's the example again with the unnecessary loops and call to
> getTile omitted.  I quickly hacked the example from something else but
> not carefully enough.
>
> Michael
>
>
> package org.geotools.demo.coverage;
>
> import java.awt.Rectangle;
> import java.awt.RenderingHints;
> import java.io.File;
> import javax.media.jai.ImageLayout;
> import javax.media.jai.JAI;
> import javax.media.jai.ParameterBlockJAI;
> import javax.media.jai.RenderedOp;
> import org.geotools.coverage.grid.GridCoverage2D;
> import org.geotools.coverage.grid.GridCoverageFactory;
> import org.geotools.gce.geotiff.GeoTiffWriter;
> import org.geotools.geometry.jts.ReferencedEnvelope;
> import org.geotools.swing.data.JFileDataStoreChooser;
>
> /**
>  * This example illustrates creating a large coverage, avoiding the need to 
> hold
>  * all of the data in memory at one time.
>  *
>  * @author Michael Bedward
>  */
> public class BigCoverage {
>
>    private static final int IMAGE_WIDTH = 10000;
>    private static final int IMAGE_HEIGHT = 10000;
>
>    public static void main(String[] args) throws Exception {
>        JFileDataStoreChooser chooser = new JFileDataStoreChooser("tif");
>        chooser.setDialogTitle("Create GeoTiff file");
>
>        File file = null;
>        if (chooser.showSaveDialog(null) ==
> JFileDataStoreChooser.APPROVE_OPTION) {
>            file = chooser.getSelectedFile();
>        }
>
>        if (file == null) {
>            return;
>        }
>
>        ParameterBlockJAI pb = new ParameterBlockJAI("Constant");
>        pb.setParameter("width", (float)IMAGE_WIDTH);
>        pb.setParameter("height", (float)IMAGE_HEIGHT);
>        pb.setParameter("bandValues", new Double[]{0.0d});
>
>        final int tileWidth = 512;
>
>        ImageLayout layout = new ImageLayout();
>        layout.setTileWidth(tileWidth);
>        layout.setTileHeight(tileWidth);
>
>        RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, 
> layout);
>
>        RenderedOp image = JAI.create("Constant", pb, hints);
>
>        GeoTiffWriter writer = new GeoTiffWriter(file, null);
>        GridCoverageFactory factory = new GridCoverageFactory();
>        ReferencedEnvelope env = new ReferencedEnvelope(
>                new Rectangle(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT), null);
>        GridCoverage2D coverage = factory.create("coverage", image, env);
>        writer.write(coverage, null);
>    }
>
> }
>



-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   César Martínez Izquierdo
   GIS developer
   -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
   ETC-LUSI: http://etc-lusi.eionet.europa.eu/
   Universitat Autònoma de Barcelona (SPAIN)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to