Class GeoTiffReader
- All Implemented Interfaces:
org.geotools.api.coverage.grid.GridCoverageReader,org.geotools.coverage.grid.io.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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RenderingHints.KeyHint to override the ImageReaderSpi used for loading TIFF data.static final StringWith this java switch I can control whether or not an external PRJ files takes precedence over the internal CRS definitionFields inherited from class org.geotools.coverage.grid.io.AbstractGridCoverage2DReader
closeMe, coverageFactory, coverageName, crs, dtLayout, EPS, gzipped, highestRes, hints, inStream, inStreamSPI, numOverviews, offsets, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, scales, sourceFields inherited from interface org.geotools.coverage.grid.io.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
ConstructorsConstructorDescriptionGeoTiffReader(Object input) Creates a new instance of GeoTiffReaderGeoTiffReader(Object input, org.geotools.util.factory.Hints uHints) Creates a new instance of GeoTiffReader -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected final org.geotools.coverage.grid.GridCoverage2DcreateCoverage(javax.media.jai.PlanarImage image, org.geotools.api.referencing.operation.MathTransform raster2Model, javax.media.jai.ROI roi) Creates aGridCoveragefor the providedPlanarImageusing theAbstractGridCoverage2DReader.raster2Modelthat was provided for this coverage.protected List<org.geotools.api.data.FileGroupProvider.FileGroup>getFiles()org.geotools.api.coverage.grid.FormatintNumber of coverages for this reader is 1org.geotools.coverage.grid.io.GroundControlPointsorg.geotools.api.data.ResourceInfoorg.geotools.coverage.grid.io.imageio.MaskOverviewProviderReturns theMaskOverviewProviderused by this reader.org.geotools.coverage.grid.io.imageio.geotiff.GeoTiffIIOMetadataDecoderReturns the geotiff metadata for this geotiff file.org.geotools.coverage.grid.GridCoverage2Dread(org.geotools.api.parameter.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 org.geotools.coverage.grid.io.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, setReadParamsMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geotools.coverage.grid.io.GridCoverage2DReader
getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getImageLayout, getImageLayout, getInfo, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, readMethods inherited from interface org.geotools.api.coverage.grid.GridCoverageReader
dispose, getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource
-
Field Details
-
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:
-
HINT_READER_SPI
Hint to override the ImageReaderSpi used for loading TIFF data. Otherwise this class defaults to using the image-io-ext TIFF reader, rather than one looked up from JAI's registry, so we must use a separate mechanism to support overriding (instead of Java's pluggable services that JAI uses)
-
-
Constructor Details
-
GeoTiffReader
Creates a new instance of GeoTiffReader
- Parameters:
input- the GeoTiff file- Throws:
org.geotools.api.data.DataSourceException
-
GeoTiffReader
public GeoTiffReader(Object input, org.geotools.util.factory.Hints uHints) throws org.geotools.api.data.DataSourceException Creates a new instance of GeoTiffReader
- Parameters:
input- the GeoTiff fileuHints- user-supplied hints TODO currently are unused- Throws:
org.geotools.api.data.DataSourceException
-
-
Method Details
-
getFormat
public org.geotools.api.coverage.grid.Format getFormat()- Specified by:
getFormatin interfaceorg.geotools.api.coverage.grid.GridCoverageReader- See Also:
-
GridCoverageReader.getFormat()
-
getInfo
- Specified by:
getInfoin interfaceorg.geotools.coverage.grid.io.GridCoverage2DReader- Overrides:
getInfoin classorg.geotools.coverage.grid.io.AbstractGridCoverage2DReader
-
read
public org.geotools.coverage.grid.GridCoverage2D read(org.geotools.api.parameter.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:
readin interfaceorg.geotools.coverage.grid.io.GridCoverage2DReader- Specified by:
readin interfaceorg.geotools.api.coverage.grid.GridCoverageReader- Specified by:
readin classorg.geotools.coverage.grid.io.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 org.geotools.coverage.grid.io.imageio.geotiff.GeoTiffIIOMetadataDecoder getMetadata()Returns the geotiff metadata for this geotiff file.
- Returns:
- the metadata
-
createCoverage
protected final org.geotools.coverage.grid.GridCoverage2D createCoverage(javax.media.jai.PlanarImage image, org.geotools.api.referencing.operation.MathTransform raster2Model, javax.media.jai.ROI roi) throws IOException Creates a
GridCoveragefor the providedPlanarImageusing theAbstractGridCoverage2DReader.raster2Modelthat 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 theMathTransformthat maps from the raster space to the model space.roi- Optional ROI used as Mask- Returns:
- a
GridCoverage - Throws:
IOException
-
checkName
- Overrides:
checkNamein classorg.geotools.coverage.grid.io.AbstractGridCoverage2DReader
-
getGridCoverageCount
public int getGridCoverageCount()Number of coverages for this reader is 1
- Specified by:
getGridCoverageCountin interfaceorg.geotools.api.coverage.grid.GridCoverageReader- Overrides:
getGridCoverageCountin classorg.geotools.coverage.grid.io.AbstractGridCoverage2DReader- Returns:
- the number of coverages for this reader.
-
getGroundControlPoints
public org.geotools.coverage.grid.io.GroundControlPoints getGroundControlPoints()- Overrides:
getGroundControlPointsin classorg.geotools.coverage.grid.io.AbstractGridCoverage2DReader
-
getFiles
- Overrides:
getFilesin classorg.geotools.coverage.grid.io.AbstractGridCoverage2DReader
-
getMaskOverviewProvider
public org.geotools.coverage.grid.io.imageio.MaskOverviewProvider getMaskOverviewProvider()Returns theMaskOverviewProviderused by this reader. For testing purposes.
-