org.geotools.gce.geotiff
Class GeoTiffReader

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

public class GeoTiffReader
extends AbstractGridCoverage2DReader
implements GridCoverage2DReader

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

Field Summary
static String OVERRIDE_CRS_SWITCH
          With this java switch I can control whether or not an external PRJ files takes precedence over the internal CRS definition
 
Fields inherited from class AbstractGridCoverage2DReader
closeMe, coverageFactory, coverageName, crs, gzipped, highestRes, hints, inStream, inStreamSPI, numOverviews, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, source
 
Fields inherited from interface GridCoverage2DReader
ELEVATION_DOMAIN, ELEVATION_DOMAIN_MAXIMUM, ELEVATION_DOMAIN_MINIMUM, ELEVATION_DOMAIN_RESOLUTION, FILE_SOURCE_PROPERTY, HAS_ELEVATION_DOMAIN, HAS_TIME_DOMAIN, TIME_DOMAIN, TIME_DOMAIN_MAXIMUM, TIME_DOMAIN_MINIMUM, TIME_DOMAIN_RESOLUTION
 
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  GridCoverage2D createCoverage(PlanarImage image, MathTransform raster2Model)
          Creates a GridCoverage for the provided PlanarImage using the AbstractGridCoverage2DReader.raster2Model that was provided for this coverage.
 Format getFormat()
          Returns the format handled by this GridCoverageReader.
 int getGridCoverageCount()
          Number of coverages for this reader is 1
 GeoTiffIIOMetadataDecoder getMetadata()
          Returns the geotiff metadata for this geotiff file.
 GridCoverage2D 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
checkName, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, decimationOnReadingControl, dispose, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getCrs, getCurrentSubname, getDynamicParameters, getDynamicParameters, getGridCoverageNames, getHighestRes, getImageLayout, getImageLayout, getInfo, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getNumOverviews, getNumOverviews, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getOverviewGridEnvelope, getOverviewGridEnvelope, getReadingResolutions, getReadingResolutions, getResolution, getResolutionLevels, getResolutionLevels, getSource, hasMoreGridCoverages, listSubNames, read, setlayout, setLayout, setReadParams, setReadParams, skip
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface GridCoverage2DReader
getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDynamicParameters, getDynamicParameters, getImageLayout, getImageLayout, getNumOverviews, getNumOverviews, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, read
 
Methods inherited from interface GridCoverageReader
dispose, getCurrentSubname, getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource, hasMoreGridCoverages, listSubNames, skip
 

Field Detail

OVERRIDE_CRS_SWITCH

public static final String OVERRIDE_CRS_SWITCH
With this java switch I can control whether or not an external PRJ files takes precedence over the internal CRS definition

See Also:
Constant Field Values
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

getFormat

public Format getFormat()
Description copied from interface: GridCoverageReader
Returns the format handled by this GridCoverageReader.

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

read

public GridCoverage2D 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 GridCoverage2DReader
Specified by:
read in interface GridCoverageReader
Specified by:
read in class AbstractGridCoverage2DReader
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 GridCoverage2D 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

getGridCoverageCount

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

Specified by:
getGridCoverageCount in interface GridCoverageReader
Overrides:
getGridCoverageCount in class AbstractGridCoverage2DReader
Returns:
the number of coverages for this reader.
See Also:
GridCoverageReader.getGridCoverageCount()


Copyright © 1996-2014 Geotools. All Rights Reserved.