Package org.geotools.gce.geotiff
Class GeoTiffReader
Object
AbstractGridCoverage2DReader
GeoTiffReader
- All Implemented Interfaces:
GridCoverageReader,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 ImageN libraries.
- Since:
- 2.1
- Author:
- Bryce Nordgren, USDA Forest Service, Simone Giannecchini
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic 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 AbstractGridCoverage2DReader
closeMe, coverageFactory, coverageName, crs, dtLayout, EPS, gzipped, highestRes, hints, inStream, inStreamSPI, numOverviews, offsets, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, scales, sourceFields 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
ConstructorsConstructorDescriptionGeoTiffReader(Object input) Creates a new instance of GeoTiffReaderGeoTiffReader(Object input, Hints uHints) Creates a new instance of GeoTiffReader -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanThis method is responsible for checking the provided coverage name against the coverage name for thisGridCoverage2DReader.protected final GridCoverage2DcreateCoverage(PlanarImage image, MathTransform raster2Model, ROI roi) Creates aGridCoveragefor the providedPlanarImageusing theAbstractGridCoverage2DReader.raster2Modelthat 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).Returns the format handled by thisGridCoverageReader.intNumber of coverages for this reader is 1Return the ground control points for the default coverage, or null if there are noneDefault implementation returns a FileResourceInfo containing same fileGroup list contained in the ServiceInfo object.Returns theMaskOverviewProviderused by this reader.Returns the geotiff metadata for this geotiff file.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, setReadParamsMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GridCoverage2DReader
getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getImageLayout, getImageLayout, getInfo, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, readMethods inherited from interface 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:
-
-
Constructor Details
-
GeoTiffReader
Creates a new instance of GeoTiffReader- Parameters:
input- the GeoTiff file- Throws:
DataSourceException
-
GeoTiffReader
Creates a new instance of GeoTiffReader- Parameters:
input- the GeoTiff fileuHints- user-supplied hints TODO currently are unused- Throws:
DataSourceException
-
-
Method Details
-
getFormat
Description copied from interface:GridCoverageReaderReturns the format handled by thisGridCoverageReader.- Specified by:
getFormatin interfaceGridCoverageReader- See Also:
-
getInfo
Description copied from class:AbstractGridCoverage2DReaderDefault implementation returns a FileResourceInfo containing same fileGroup list contained in the ServiceInfo object.- Specified by:
getInfoin interfaceGridCoverage2DReader- Overrides:
getInfoin classAbstractGridCoverage2DReader- Returns:
- ResourceInfo describing a specific coverage.
-
read
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 interfaceGridCoverage2DReader- Specified by:
readin interfaceGridCoverageReader- Specified by:
readin 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
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 aGridCoveragefor 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
Description copied from class:AbstractGridCoverage2DReaderThis method is responsible for checking the provided coverage name against the coverage name for thisGridCoverage2DReader.- Overrides:
checkNamein classAbstractGridCoverage2DReader- Parameters:
coverageName- the coverage name to check.- Returns:
trueif thisGridCoverage2DReadercontains the provided coverage name,falseotherwise.
-
getGridCoverageCount
public int getGridCoverageCount()Number of coverages for this reader is 1- Specified by:
getGridCoverageCountin interfaceGridCoverageReader- Overrides:
getGridCoverageCountin classAbstractGridCoverage2DReader- Returns:
- the number of coverages for this reader.
- See Also:
-
getGroundControlPoints
Description copied from class:AbstractGridCoverage2DReaderReturn the ground control points for the default coverage, or null if there are none- Overrides:
getGroundControlPointsin classAbstractGridCoverage2DReader
-
getFiles
Description copied from class:AbstractGridCoverage2DReaderReturns 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:
getFilesin classAbstractGridCoverage2DReader
-
getMaskOverviewProvider
Returns theMaskOverviewProviderused by this reader. For testing purposes.
-