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 MultiLevelROI
multiLevelRoi
This reader is made of a single file so the MultiLevelROI is uniqueprotected Double
nodata
protected ResourceInfo
resourceInfo
-
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 protected
BaseGridCoverage2DReader(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 String
getCoverageName()
int
getGridCoverageCount()
Retrieve the number of coverages contained within the input source.protected double[]
getHighestRes()
Package scope highest resolution serviceInfo accessorServiceInfo
getInfo()
Information about this source.ResourceInfo
getInfo(String subname)
Information about the named gridcoverage.protected File
getInputFile()
protected MultiLevelROI
getMultiLevelRoi()
protected MultiLevelROIProvider
getMultiLevelROIProvider(String coverageName)
Double
getNodata()
protected void
parsePRJFile()
Gets the coordinate reference system that will be associated to theGridCoverage
by looking for a related PRJ.protected void
parseWorldFile()
Checks whether a world file is associated with the data source.GridCoverage2D
read(GeneralParameterValue[] params)
Returns aGridCoverage
from this reader in compliance with the specified parameters.protected abstract void
setCoverageProperties(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:
getMultiLevelROIProvider
in classAbstractGridCoverage2DReader
-
getHighestRes
protected double[] getHighestRes()
Package scope highest resolution serviceInfo accessor- Overrides:
getHighestRes
in classAbstractGridCoverage2DReader
-
read
public GridCoverage2D read(GeneralParameterValue[] params) throws IllegalArgumentException, IOException
Returns aGridCoverage
from this reader in compliance with the specified parameters.- Specified by:
read
in interfaceGridCoverage2DReader
- Specified by:
read
in interfaceGridCoverageReader
- Specified by:
read
in classAbstractGridCoverage2DReader
- Parameters:
params
- aGeneralParameterValue
array to customize the read operation.- Returns:
- a grid coverage from the input source.
- Throws:
InvalidParameterNameException
- if a parameter inparameters
doesn't have a recognized name.InvalidParameterValueException
- if a parameter inparameters
doesn't have a valid value.ParameterNotFoundException
- if a parameter was required for the operation but was not provided in theparameters
list.IOException
- if a read operation failed for some other input/output reason, includingFileNotFoundException
if no file with the givenname
can be found, orIIOException
if an error was thrown by the underlying image library.IllegalArgumentException
-
parsePRJFile
protected void parsePRJFile()
Gets the coordinate reference system that will be associated to theGridCoverage
by 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:
getInfo
in interfaceGridCoverage2DReader
- Overrides:
getInfo
in classAbstractGridCoverage2DReader
- Returns:
- ServiceInfo describing getSource().
-
getInfo
public ResourceInfo getInfo(String subname)
Information about the named gridcoverage.- Specified by:
getInfo
in interfaceGridCoverage2DReader
- Overrides:
getInfo
in 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:GridCoverageReader
Retrieve the number of coverages contained within the input source.- Specified by:
getGridCoverageCount
in interfaceGridCoverageReader
- Overrides:
getGridCoverageCount
in classAbstractGridCoverage2DReader
- Returns:
- the gridCoverage count
- See Also:
GridCoverageReader.getGridCoverageCount()
-
getMultiLevelRoi
protected MultiLevelROI getMultiLevelRoi()
-
getNodata
public Double getNodata()
-
-