Package org.geotools.gce.geotiff
Class GeoTiffReader
- Object
-
- AbstractGridCoverage2DReader
-
- GeoTiffReader
-
- All Implemented Interfaces:
GridCoverageReader
,GridCoverage2DReader
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
Fields Modifier and Type Field Description 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, dtLayout, EPS, gzipped, highestRes, hints, inStream, inStreamSPI, numOverviews, offsets, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, scales, 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, MULTICRS_EPSGCODES, MULTICRS_READER, PAM_DATASET, REPROJECTING_READER, SOURCE_URL_PROPERTY, TIME_DOMAIN, TIME_DOMAIN_MAXIMUM, TIME_DOMAIN_MINIMUM, TIME_DOMAIN_RESOLUTION
-
-
Constructor Summary
Constructors Constructor Description GeoTiffReader(Object input)
Creates a new instance of GeoTiffReaderGeoTiffReader(Object input, Hints uHints)
Creates a new instance of GeoTiffReader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkName(String coverageName)
This method is responsible for checking the provided coverage name against the coverage name for thisGridCoverage2DReader
.protected GridCoverage2D
createCoverage(PlanarImage image, MathTransform raster2Model, ROI roi)
Creates aGridCoverage
for the providedPlanarImage
using theAbstractGridCoverage2DReader.raster2Model
that was provided for this coverage.protected List<FileGroupProvider.FileGroup>
getFiles()
Returns a list of files making up the source data for this reader (as a whole).Format
getFormat()
Returns the format handled by thisGridCoverageReader
.int
getGridCoverageCount()
Number of coverages for this reader is 1GroundControlPoints
getGroundControlPoints()
Return the ground control points for the default coverage, or null if there are noneResourceInfo
getInfo(String coverageName)
Default implementation returns a FileResourceInfo containing same fileGroup list contained in the ServiceInfo object.MaskOverviewProvider
getMaskOverviewProvider()
Returns theMaskOverviewProvider
used by this reader.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
addAllSiblings, addSiblings, collectScaleOffset, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, dispose, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getGridCoverageNames, getGroundControlPoints, getHighestRes, getHighestRes, getImageLayout, getImageLayout, getInfo, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getMultiLevelROIProvider, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getOverviewGridEnvelope, getOverviewGridEnvelope, getPamDataset, getPamDataset, getReadingResolutions, getReadingResolutions, getRescaledRasterToModel, getResolution, getResolutionLevels, getResolutionLevels, getSibling, getSource, getSourceAsFile, read, setlayout, setLayout, setReadParams, setReadParams
-
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface GridCoverage2DReader
getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getImageLayout, getImageLayout, getInfo, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, read
-
Methods inherited from interface GridCoverageReader
dispose, getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource
-
-
-
-
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 fileuHints
- 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 thisGridCoverageReader
.- Specified by:
getFormat
in interfaceGridCoverageReader
- See Also:
GridCoverageReader.getFormat()
-
getInfo
public ResourceInfo getInfo(String coverageName)
Description copied from class:AbstractGridCoverage2DReader
Default implementation returns a FileResourceInfo containing same fileGroup list contained in the ServiceInfo object.- Specified by:
getInfo
in interfaceGridCoverage2DReader
- Overrides:
getInfo
in classAbstractGridCoverage2DReader
- Returns:
- ResourceInfo describing a specific coverage.
-
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 interfaceGridCoverage2DReader
- Specified by:
read
in interfaceGridCoverageReader
- Specified by:
read
in classAbstractGridCoverage2DReader
- 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, ROI roi) throws IOException
Creates aGridCoverage
for the providedPlanarImage
using theAbstractGridCoverage2DReader.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 theMathTransform
that maps from the raster space to the model space.roi
- Optional ROI used as Mask- Returns:
- a
GridCoverage
- Throws:
IOException
-
checkName
protected boolean checkName(String coverageName)
Description copied from class:AbstractGridCoverage2DReader
This method is responsible for checking the provided coverage name against the coverage name for thisGridCoverage2DReader
.- Overrides:
checkName
in classAbstractGridCoverage2DReader
- Parameters:
coverageName
- the coverage name to check.- Returns:
true
if thisGridCoverage2DReader
contains the provided coverage name,false
otherwise.
-
getGridCoverageCount
public int getGridCoverageCount()
Number of coverages for this reader is 1- Specified by:
getGridCoverageCount
in interfaceGridCoverageReader
- Overrides:
getGridCoverageCount
in classAbstractGridCoverage2DReader
- Returns:
- the number of coverages for this reader.
- See Also:
GridCoverageReader.getGridCoverageCount()
-
getGroundControlPoints
public GroundControlPoints getGroundControlPoints()
Description copied from class:AbstractGridCoverage2DReader
Return the ground control points for the default coverage, or null if there are none- Overrides:
getGroundControlPoints
in classAbstractGridCoverage2DReader
-
getFiles
protected List<FileGroupProvider.FileGroup> getFiles()
Description copied from class:AbstractGridCoverage2DReader
Returns a list of files making up the source data for this reader (as a whole). The default implementation returns the source, if it can be made into a File object, or null otherwise.- Overrides:
getFiles
in classAbstractGridCoverage2DReader
-
getMaskOverviewProvider
public MaskOverviewProvider getMaskOverviewProvider()
Returns theMaskOverviewProvider
used by this reader. For testing purposes.
-
-