org.geotools.gce.geotiff
Class GeoTiffReader

Object
  extended by AbstractGridCoverage2DReader
      extended by GeoTiffReader
All Implemented Interfaces:
GridCoverageReader

public final class GeoTiffReader
extends AbstractGridCoverage2DReader
implements GridCoverageReader

this class is responsible for exposing the data and the Georeferencing metadata available to the Geotools library. This reader is heavily based on the capabilities provided by the ImageIO tools and JAI libraries.

Since:
2.1
Author:
Bryce Nordgren, USDA Forest Service, Simone Giannecchini
Module:

Field Summary
 
Fields inherited from class AbstractGridCoverage2DReader
closeMe, coverageFactory, coverageName, crs, demColors, EPS, gzipped, highestRes, hints, inStream, numOverviews, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, source
 
Constructor Summary
GeoTiffReader(Object input)
          Creates a new instance of GeoTiffReader
GeoTiffReader(Object input, Hints uHints)
          Creates a new instance of GeoTiffReader
 
Method Summary
protected  GridCoverage createCoverage(PlanarImage image, MathTransform raster2Model)
          Creates a GridCoverage for the provided PlanarImage using the AbstractGridCoverage2DReader.raster2Model that was provided for this coverage.
 Format getFormat()
           
 int getGridCoverageCount()
          Number of coverages for this reader is 1
 GeoTiffIIOMetadataDecoder getMetadata()
          Returns the geotiff metadata for this geotiff file.
 GridCoverage read(GeneralParameterValue[] params)
          This method reads in the TIFF image, constructs an appropriate CRS, determines the math transform from raster to the CRS model, and constructs a GridCoverage.
 
Methods inherited from class AbstractGridCoverage2DReader
createImageCoverage, createImageCoverage, decimationOnReadingControl, dispose, finalize, getCrs, getCurrentSubname, getInfo, getMetadataNames, getMetadataValue, getOriginalEnvelope, getOriginalGridRange, getOriginalGridToWorld, getResolution, getSource, hasMoreGridCoverages, listSubNames, setReadParams, setReadParams, skip
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface GridCoverageReader
dispose, getCurrentSubname, getMetadataNames, getMetadataValue, getSource, hasMoreGridCoverages, listSubNames, skip
 

Constructor Detail

GeoTiffReader

public GeoTiffReader(Object input)
              throws DataSourceException
Creates a new instance of GeoTiffReader

Parameters:
input - the GeoTiff file
Throws:
DataSourceException

GeoTiffReader

public GeoTiffReader(Object input,
                     Hints uHints)
              throws DataSourceException
Creates a new instance of GeoTiffReader

Parameters:
input - the GeoTiff file
uHints - user-supplied hints TODO currently are unused
Throws:
DataSourceException
Method Detail

getGridCoverageCount

public int getGridCoverageCount()
Number of coverages for this reader is 1

Overrides:
getGridCoverageCount in class AbstractGridCoverage2DReader
Returns:
the number of coverages for this reader.
See Also:
org.opengis.coverage.grid.GridCoverageReader#getGridCoverageCount()

getFormat

public Format getFormat()
Specified by:
getFormat in interface GridCoverageReader
See Also:
GridCoverageReader.getFormat()

read

public GridCoverage read(GeneralParameterValue[] params)
                  throws IOException
This method reads in the TIFF image, constructs an appropriate CRS, determines the math transform from raster to the CRS model, and constructs a GridCoverage.

Specified by:
read in interface GridCoverageReader
Parameters:
params - currently ignored, potentially may be used for hints.
Returns:
grid coverage represented by the image
Throws:
IOException - on any IO related troubles

getMetadata

public GeoTiffIIOMetadataDecoder getMetadata()
Returns the geotiff metadata for this geotiff file.

Returns:
the metadata

createCoverage

protected final GridCoverage createCoverage(PlanarImage image,
                                            MathTransform raster2Model)
                                     throws IOException
Creates a GridCoverage for the provided PlanarImage using the AbstractGridCoverage2DReader.raster2Model that was provided for this coverage.

This method is vital when working with coverages that have a raster to model transformation that is not a simple scale and translate.

Parameters:
image - contains the data for the coverage to create.
raster2Model - is the MathTransform that maps from the raster space to the model space.
Returns:
a GridCoverage
Throws:
IOException


Copyright © 1996-2009 Geotools. All Rights Reserved.