Grid2DSampleDimension creation does a full scan of a coverage (float32 data) 
-----------------------------------------------------------------------------

                 Key: GEOT-1737
                 URL: http://jira.codehaus.org/browse/GEOT-1737
             Project: GeoTools
          Issue Type: Improvement
          Components: core coverage
            Reporter: Daniele Romagnoli
            Assignee: Martin Desruisseaux
         Attachments: a.tiff

GT-2.4

The creation of a Grid2DSampleDimension for a Coverage containing floating data 
does the full coverage scan in order to determine the range of geophysics 
values to build a category.
This may kill the machine when working with big coverages (WxH iterations scan 
to find min and max on a WxH float array, where W and H are the image Size).

Here below, a standalone testcase to debug the Grid2DSampleDimension creation 
where no sampleDimensions, sources and properties have been provided to the 
GridCoverageFactory.
In attachment, the datasample for test.


/**
 * 
 */
package org.geotools.coverage;
 
import java.io.File;

import javax.imageio.ImageIO;
import javax.media.jai.PlanarImage;

import junit.framework.TestCase;

import org.geotools.coverage.grid.GeneralGridRange;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.GeneralEnvelope;
 
/**
 * @author Daniele 
 */
public class GridSampleDimensionBugTest extends TestCase {
 
        private PlanarImage image;
 
        /**
         * @param name
         */
        public GridSampleDimensionBugTest(String name) {
                super(name);
        }
 
        /**
         * @see junit.framework.TestCase#setUp()
         */
        protected void setUp() throws Exception {
                image=PlanarImage.wrapRenderedImage(ImageIO.read(new 
File("c:\\a.tiff")));
                super.setUp();
        }
 
        /**
         * @see junit.framework.TestCase#tearDown()
         */
        protected void tearDown() throws Exception {
                super.tearDown();
        }
 
        public void test(){
                final GridGeometry2D gg= new GridGeometry2D(new 
GeneralGridRange(image.getBounds()), new GeneralEnvelope(new double[]{0,0},new 
double[]{20,20}));
                final GridCoverage2D 
gc=FactoryFinder.getGridCoverageFactory(null).create("sample", image, gg, null, 
null,null);
                assertNotNull(gc);
        }
 }




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to