Package org.geotools.coverageio
Class BaseGridCoverage2DReader
- Object
-
- AbstractGridCoverage2DReader
-
- BaseGridCoverage2DReader
-
- All Implemented Interfaces:
GridCoverageReader,GridCoverage2DReader
- Direct Known Subclasses:
BaseGDALGridCoverage2DReader
public abstract class BaseGridCoverage2DReader extends AbstractGridCoverage2DReader implements GridCoverage2DReader
Base class for GridCoverage data access- Author:
- Daniele Romagnoli, GeoSolutions, Simone Giannecchini, GeoSolutions
-
-
Field Summary
Fields Modifier and Type Field Description protected MultiLevelROImultiLevelRoiThis reader is made of a single file so the MultiLevelROI is uniqueprotected Doublenodataprotected ResourceInforesourceInfo-
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 Modifier Constructor Description protectedBaseGridCoverage2DReader(Object input, Hints hints, String worldFileExtension, ImageReaderSpi formatSpecificSpi)Creates a new instance of aBaseGridCoverage2DReader.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetCoverageName()intgetGridCoverageCount()Retrieve the number of coverages contained within the input source.protected double[]getHighestRes()Package scope highest resolution serviceInfo accessorServiceInfogetInfo()Information about this source.ResourceInfogetInfo(String subname)Information about the named gridcoverage.protected FilegetInputFile()protected MultiLevelROIgetMultiLevelRoi()protected MultiLevelROIProvidergetMultiLevelROIProvider(String coverageName)DoublegetNodata()protected voidparsePRJFile()Gets the coordinate reference system that will be associated to theGridCoverageby looking for a related PRJ.protected voidparseWorldFile()Checks whether a world file is associated with the data source.GridCoverage2Dread(GeneralParameterValue[] params)Returns aGridCoveragefrom this reader in compliance with the specified parameters.protected abstract voidsetCoverageProperties(ImageReader reader)Implement this method to setup the coverage properties (Envelope, CRS, GridRange) using the providedImageReader-
Methods inherited from class AbstractGridCoverage2DReader
addAllSiblings, addSiblings, checkName, collectScaleOffset, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, dispose, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getFiles, getGridCoverageNames, getGroundControlPoints, getGroundControlPoints, getHighestRes, getImageLayout, getImageLayout, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, 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, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, read
-
Methods inherited from interface GridCoverageReader
dispose, getFormat, getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource
-
-
-
-
Field Detail
-
multiLevelRoi
protected MultiLevelROI multiLevelRoi
This reader is made of a single file so the MultiLevelROI is unique
-
resourceInfo
protected ResourceInfo resourceInfo
-
nodata
protected Double nodata
-
-
Constructor Detail
-
BaseGridCoverage2DReader
protected BaseGridCoverage2DReader(Object input, Hints hints, String worldFileExtension, ImageReaderSpi formatSpecificSpi) throws DataSourceException
Creates a new instance of aBaseGridCoverage2DReader. I assume nothing about file extension.- Parameters:
input- Source object for which we want to build aBaseGridCoverage2DReader.hints- Hints to be used by this reader throughout his life.worldFileExtension- the specific world file extension of the underlying formatformatSpecificSpi- an instance of a properImageReaderSpi.- Throws:
DataSourceException
-
-
Method Detail
-
setCoverageProperties
protected abstract void setCoverageProperties(ImageReader reader) throws IOException
Implement this method to setup the coverage properties (Envelope, CRS, GridRange) using the providedImageReader- Throws:
IOException
-
getMultiLevelROIProvider
protected MultiLevelROIProvider getMultiLevelROIProvider(String coverageName)
- Overrides:
getMultiLevelROIProviderin classAbstractGridCoverage2DReader
-
getHighestRes
protected double[] getHighestRes()
Package scope highest resolution serviceInfo accessor- Overrides:
getHighestResin classAbstractGridCoverage2DReader
-
read
public GridCoverage2D read(GeneralParameterValue[] params) throws IllegalArgumentException, IOException
Returns aGridCoveragefrom this reader in compliance with the specified parameters.- Specified by:
readin interfaceGridCoverage2DReader- Specified by:
readin interfaceGridCoverageReader- Specified by:
readin classAbstractGridCoverage2DReader- Parameters:
params- aGeneralParameterValuearray to customize the read operation.- Returns:
- a grid coverage from the input source.
- Throws:
InvalidParameterNameException- if a parameter inparametersdoesn't have a recognized name.InvalidParameterValueException- if a parameter inparametersdoesn't have a valid value.ParameterNotFoundException- if a parameter was required for the operation but was not provided in theparameterslist.IOException- if a read operation failed for some other input/output reason, includingFileNotFoundExceptionif no file with the givennamecan be found, orIIOExceptionif an error was thrown by the underlying image library.IllegalArgumentException
-
parsePRJFile
protected void parsePRJFile()
Gets the coordinate reference system that will be associated to theGridCoverageby looking for a related PRJ.
-
parseWorldFile
protected void parseWorldFile()
Checks whether a world file is associated with the data source. If found, set a proper envelope.
-
getInfo
public ServiceInfo getInfo()
Information about this source. Subclasses should provide additional format specific information.- Specified by:
getInfoin interfaceGridCoverage2DReader- Overrides:
getInfoin classAbstractGridCoverage2DReader- Returns:
- ServiceInfo describing getSource().
-
getInfo
public ResourceInfo getInfo(String subname)
Information about the named gridcoverage.- Specified by:
getInfoin interfaceGridCoverage2DReader- Overrides:
getInfoin classAbstractGridCoverage2DReader- Parameters:
subname- Name indicing grid coverage to describe- Returns:
- ResourceInfo describing grid coverage indicated
-
getInputFile
protected File getInputFile()
- Returns:
- the input file
-
getCoverageName
public String getCoverageName()
- Returns:
- the coverage name
-
getGridCoverageCount
public int getGridCoverageCount()
Description copied from interface:GridCoverageReaderRetrieve the number of coverages contained within the input source.- Specified by:
getGridCoverageCountin interfaceGridCoverageReader- Overrides:
getGridCoverageCountin classAbstractGridCoverage2DReader- Returns:
- the gridCoverage count
- See Also:
GridCoverageReader.getGridCoverageCount()
-
getMultiLevelRoi
protected MultiLevelROI getMultiLevelRoi()
-
getNodata
public Double getNodata()
-
-