org.geotools.coverage.grid.io
Class AbstractGridCoverage2DReader

Object
  extended by AbstractGridCoverage2DReader
All Implemented Interfaces:
GridCoverage2DReader, GridCoverageReader
Direct Known Subclasses:
ArcGridReader, ArcSDEGridCoverage2DReaderJAI, BaseGridCoverage2DReader, GeoPackageReader, GeoTiffReader, GrassCoverageReader, GTopo30Reader, ImageMosaicJDBCReader, ImageMosaicReader, ImagePyramidReader, JP2KReader, WorldImageReader

public abstract class AbstractGridCoverage2DReader
extends Object
implements GridCoverage2DReader

This class is a first attempt for providing a way to get more informations out of a single 2D raster datasets (x,y). It is worth to remark that for the moment this is thought for 2D rasters not for 3D or 4D rasters (x,y,z,t).

The main drawback I see with the current GeoApi GridCoverageReader interface is that there is no way to get real information about a raster source unless you instantiate a GridCoverage. As an instance it is impossible to know the envelope, the number of overviews, the tile size. This information is needed in order to perform decimation on reading or to use built-in overviews
This really impacts the ability to exploit raster datasets in a desktop environment where caching is crucial.

Since:
2.3
Author:
Simone Giannecchini, GeoSolutions

Field Summary
protected  boolean closeMe
          Temp variable used in many readers.
protected  GridCoverageFactory coverageFactory
          GridCoverageFactory instance.
protected  String coverageName
          Coverage name
protected  CoordinateReferenceSystem crs
          crs for this coverage
protected  boolean gzipped
          In case we are trying to read from a GZipped file this will be set to true.
protected  double[] highestRes
          Highest resolution availaible for this reader.
protected  Hints hints
          Hints used by the AbstractGridCoverage2DReader subclasses.
protected  ImageInputStream inStream
          Input stream that can be used to initialize subclasses of AbstractGridCoverage2DReader.
protected  ImageInputStreamSpi inStreamSPI
           
protected  int numOverviews
          This contains the number of overviews.aaa
protected  GeneralEnvelope originalEnvelope
          Envelope read from file
protected  GridEnvelope originalGridRange
          The original GridRange for the GridCoverage2D of this reader.
protected  double[][] overViewResolutions
          Resolutions avialaible through an overviews based mechanism.
protected  MathTransform raster2Model
          2DGridToWorld math transform.
protected  Object source
          Source to read from
 
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, TIME_DOMAIN, TIME_DOMAIN_MAXIMUM, TIME_DOMAIN_MINIMUM, TIME_DOMAIN_RESOLUTION
 
Constructor Summary
protected AbstractGridCoverage2DReader()
          Default protected constructor.
  AbstractGridCoverage2DReader(Object input)
          Creates a new instance of a AIGReader.
  AbstractGridCoverage2DReader(Object input, Hints hints)
          Creates a new instance of a AIGReader.
 
Method Summary
protected  boolean checkName(String coverageName)
          This method is responsible for checking the provided coverage name against the coverage name for this GridCoverage2DReader.
protected  GridCoverage createImageCoverage(PlanarImage image)
          Creates a GridCoverage for the provided PlanarImage using the originalEnvelope that was provided for this coverage.
protected  GridCoverage2D createImageCoverage(PlanarImage image, MathTransform raster2Model)
          Creates a GridCoverage for the provided PlanarImage using the raster2Model that was provided for this coverage.
protected  GridCoverage createImageCoverage(String coverageName, PlanarImage image)
          Creates a GridCoverage for the provided PlanarImage using the originalEnvelope that was provided for this coverage.
protected  GridCoverage2D createImageCoverage(String coverageName, PlanarImage image, MathTransform raster2Model)
          Creates a GridCoverage for the provided PlanarImage using the raster2Model that was provided for this coverage.
protected  void decimationOnReadingControl(Integer imageChoice, ImageReadParam readP, double[] requestedRes)
           
protected  void decimationOnReadingControl(String coverageName, Integer imageChoice, ImageReadParam readP, double[] requestedRes)
          This method is responsible for evaluating possible subsampling factors once the best resolution level has been found, in case we have support for overviews, or starting from the original coverage in case there are no overviews available.
 void dispose()
          Disposes this reader.
protected  void finalize()
          Forcing disposal of this AbstractGridCoverage2DReader which may keep an ImageInputStream open.
 CoordinateReferenceSystem getCoordinateReferenceSystem()
          Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.
 CoordinateReferenceSystem getCoordinateReferenceSystem(String coverageName)
          Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.
 CoordinateReferenceSystem getCrs()
          Deprecated. use getCoordinateReferenceSystem()
 String getCurrentSubname()
          Deprecated. no replacement for that method
 Set<ParameterDescriptor<List>> getDynamicParameters()
          Return the set of dynamic parameterDescriptors (the ones related to domains) for this reader.
 Set<ParameterDescriptor<List>> getDynamicParameters(String coverageName)
          Return the set of dynamic parameterDescriptors (the ones related to domains) for this reader.
 int getGridCoverageCount()
          Retrieve the number of coverages contained within the input source.
 String[] getGridCoverageNames()
          Retrieve the list of coverages contained within the input source.
protected  double[] getHighestRes(String coverageName)
           
 ImageLayout getImageLayout()
          Retrieve the ImageLayout for the default coverage.
 ImageLayout getImageLayout(String coverageName)
          Retrieve the ImageLayout for the specified coverage.
 ServiceInfo getInfo()
          Information about this source.
 String[] getMetadataNames()
          Returns the list of metadata keywords associated with the input source as a whole (not associated with any particular grid coverage).
 String[] getMetadataNames(String coverageName)
          Returns the list of metadata keywords associated with a specific gridCoverage referred by name.
 String getMetadataValue(String name)
          Retrieve the metadata value for a given metadata name.
 String getMetadataValue(String coverageName, String name)
          Retrieve the metadata value for a given metadata name for a specified coverage.
 int getNumOverviews()
          Number of predetermined overviews for the default coverage.
 int getNumOverviews(String coverageName)
          Number of predetermined overviews for the specified coverage.
 GeneralEnvelope getOriginalEnvelope()
          Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.
 GeneralEnvelope getOriginalEnvelope(String coverageName)
          Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.
 GridEnvelope getOriginalGridRange()
          Retrieves the GeneralGridEnvelope that represents the raster grid dimensions of the highest resolution level in this dataset.
 GridEnvelope getOriginalGridRange(String coverageName)
          Retrieves the GeneralGridEnvelope that represents the raster grid dimensions of the highest resolution level in this dataset.
 MathTransform getOriginalGridToWorld(PixelInCell pixInCell)
          Retrieves the original grid to world transformation for this AbstractGridCoverage2DReader.
 MathTransform getOriginalGridToWorld(String coverageName, PixelInCell pixInCell)
          Retrieves the original grid to world transformation for this AbstractGridCoverage2DReader.
 GridEnvelope getOverviewGridEnvelope(int overviewIndex)
           
 GridEnvelope getOverviewGridEnvelope(String coverageName, int overviewIndex)
           
 double[] getReadingResolutions(OverviewPolicy policy, double[] requestedResolution)
          Returns the actual resolution used to read the data given the specified target resolution and the specified overview policy
 double[] getReadingResolutions(String coverageName, OverviewPolicy policy, double[] requestedResolution)
          Returns the actual resolution used to read the data given the specified target resolution and the specified overview policy
protected static double[] getResolution(GeneralEnvelope envelope, Rectangle2D dim, CoordinateReferenceSystem crs)
          This method is responsible for computing the resolutions in for the provided grid geometry in the provided crs.
 double[][] getResolutionLevels()
          Retrieve the resolution levels for the default coverage.
 double[][] getResolutionLevels(String coverageName)
          Retrieve the resolution levels for the specified coverage.
 Object getSource()
          Retrieves the source for this AbstractGridCoverage2DReader.
 boolean hasMoreGridCoverages()
          Deprecated. no replacement for that method
 String[] listSubNames()
          Deprecated. use getGridCoverageNames()
abstract  GridCoverage2D read(GeneralParameterValue[] parameters)
          Read the current grid coverage from the stream.
 GridCoverage2D read(String coverageName, GeneralParameterValue[] parameters)
          Retrieves the GridEnvelope associated to the specified coverageName for this GridCoverage2DReader.
protected  void setlayout(ImageLayout layout)
          Set the provided layout for this GridCoverage2DReader-
protected  void setLayout(ImageReader reader)
          Extract the ImageLayout from the provided reader for the first available image.
protected  Integer setReadParams(OverviewPolicy overviewPolicy, ImageReadParam readP, GeneralEnvelope requestedEnvelope, Rectangle requestedDim)
          This method is responsible for preparing the read param for doing an ImageReader.read(int, ImageReadParam).
protected  Integer setReadParams(String coverageName, OverviewPolicy overviewPolicy, ImageReadParam readP, GeneralEnvelope requestedEnvelope, Rectangle requestedDim)
          This method is responsible for preparing the read param for doing an ImageReader.read(int, ImageReadParam).
 void skip()
          Deprecated. no replacement for that method
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface GridCoverageReader
getFormat
 

Field Detail

numOverviews

protected int numOverviews
This contains the number of overviews.aaa


raster2Model

protected MathTransform raster2Model
2DGridToWorld math transform.


crs

protected CoordinateReferenceSystem crs
crs for this coverage


originalEnvelope

protected GeneralEnvelope originalEnvelope
Envelope read from file


coverageName

protected String coverageName
Coverage name


source

protected Object source
Source to read from


hints

protected Hints hints
Hints used by the AbstractGridCoverage2DReader subclasses.


highestRes

protected double[] highestRes
Highest resolution availaible for this reader.


closeMe

protected boolean closeMe
Temp variable used in many readers.


gzipped

protected boolean gzipped
In case we are trying to read from a GZipped file this will be set to true.


originalGridRange

protected GridEnvelope originalGridRange
The original GridRange for the GridCoverage2D of this reader.


inStream

protected ImageInputStream inStream
Input stream that can be used to initialize subclasses of AbstractGridCoverage2DReader.


overViewResolutions

protected double[][] overViewResolutions
Resolutions avialaible through an overviews based mechanism.


coverageFactory

protected GridCoverageFactory coverageFactory
GridCoverageFactory instance.


inStreamSPI

protected ImageInputStreamSpi inStreamSPI
Constructor Detail

AbstractGridCoverage2DReader

protected AbstractGridCoverage2DReader()
Default protected constructor. Useful for wrappers.


AbstractGridCoverage2DReader

public AbstractGridCoverage2DReader(Object input)
                             throws DataSourceException
Creates a new instance of a AIGReader. I assume nothing about file extension.

Parameters:
input - Source object for which we want to build an AIGReader.
Throws:
DataSourceException

AbstractGridCoverage2DReader

public AbstractGridCoverage2DReader(Object input,
                                    Hints hints)
                             throws DataSourceException
Creates a new instance of a AIGReader. I assume nothing about file extension.

Parameters:
input - Source object for which we want to build an AIGReader.
hints - Hints to be used by this reader throughout his life.
Throws:
DataSourceException
Method Detail

checkName

protected boolean checkName(String coverageName)
This method is responsible for checking the provided coverage name against the coverage name for this GridCoverage2DReader.

Parameters:
coverageName - the coverage name to check.
Returns:
true if this GridCoverage2DReader contains the provided coverage name, false otherwise.

read

public GridCoverage2D read(String coverageName,
                           GeneralParameterValue[] parameters)
                    throws IllegalArgumentException,
                           IOException
Description copied from interface: GridCoverage2DReader
Retrieves the GridEnvelope associated to the specified coverageName for this GridCoverage2DReader.

Specified by:
read in interface GridCoverage2DReader
Specified by:
read in interface GridCoverageReader
Parameters:
coverageName - the name of the coverage to work with
parameters - an array of GeneralParameterValue that uses a subset of the available read params for this GridCoverage2DReader as specified by the Format
Returns:
a GridCoverage2D for the underlying default coverage for this GridCoverage2DReader or null in case no GridCoverage2D can be read for the provided parameters.
Throws:
IllegalArgumentException - if the specified coverageName does not exist
IOException - if a read operation failed for some other input/output reason, including FileNotFoundException if no file with the given name can be found, or IIOException if an error was thrown by the underlying image library.

read

public abstract GridCoverage2D read(GeneralParameterValue[] parameters)
                             throws IllegalArgumentException,
                                    IOException
Read the current grid coverage from the stream.

Example:

 
 
 
The method hasMoreGridCoverages() should be invoked first in order to verify that a coverage is available.

Specified by:
read in interface GridCoverage2DReader
Specified by:
read in interface GridCoverageReader
Parameters:
parameters - Optional parameters matching Format.getReadParameters().
Returns:
a grid coverage from the input source.
Throws:
InvalidParameterNameException - if a parameter in parameters doesn't have a recognized name.
InvalidParameterValueException - if a parameter in parameters doesn't have a valid value.
ParameterNotFoundException - if a parameter was required for the operation but was not provided in the parameters list.
CannotCreateGridCoverageException - if the coverage can't be created for a logical reason (for example an unsupported format, or an inconsistency found in the data).
IOException - if a read operation failed for some other input/output reason, including FileNotFoundException if no file with the given name can be found, or IIOException if an error was thrown by the underlying image library.
IllegalArgumentException

setReadParams

protected Integer setReadParams(OverviewPolicy overviewPolicy,
                                ImageReadParam readP,
                                GeneralEnvelope requestedEnvelope,
                                Rectangle requestedDim)
                         throws IOException,
                                TransformException
This method is responsible for preparing the read param for doing an ImageReader.read(int, ImageReadParam).

This method is responsible for preparing the read param for doing an ImageReader.read(int, ImageReadParam). It sets the passed ImageReadParam in terms of decimation on reading using the provided requestedEnvelope and requestedDim to evaluate the needed resolution. It also returns and Integer representing the index of the raster to be read when dealing with multipage raster.

Parameters:
overviewPolicy - it can be one of Hints#VALUE_OVERVIEW_POLICY_IGNORE, Hints#VALUE_OVERVIEW_POLICY_NEAREST, Hints#VALUE_OVERVIEW_POLICY_QUALITY or Hints#VALUE_OVERVIEW_POLICY_SPEED. It specifies the policy to compute the overviews level upon request.
readP - an instance of ImageReadParam for setting the subsampling factors.
requestedEnvelope - the GeneralEnvelope we are requesting.
requestedDim - the requested dimensions.
Returns:
the index of the raster to read in the underlying data source.
Throws:
IOException
TransformException

setReadParams

protected Integer setReadParams(String coverageName,
                                OverviewPolicy overviewPolicy,
                                ImageReadParam readP,
                                GeneralEnvelope requestedEnvelope,
                                Rectangle requestedDim)
                         throws IOException,
                                TransformException
This method is responsible for preparing the read param for doing an ImageReader.read(int, ImageReadParam).

This method is responsible for preparing the read param for doing an ImageReader.read(int, ImageReadParam). It sets the passed ImageReadParam in terms of decimation on reading using the provided requestedEnvelope and requestedDim to evaluate the needed resolution. It also returns and Integer representing the index of the raster to be read when dealing with multipage raster.

Parameters:
overviewPolicy - it can be one of Hints#VALUE_OVERVIEW_POLICY_IGNORE, Hints#VALUE_OVERVIEW_POLICY_NEAREST, Hints#VALUE_OVERVIEW_POLICY_QUALITY or Hints#VALUE_OVERVIEW_POLICY_SPEED. It specifies the policy to compute the overviews level upon request.
readP - an instance of ImageReadParam for setting the subsampling factors.
requestedEnvelope - the GeneralEnvelope we are requesting.
requestedDim - the requested dimensions.
Returns:
the index of the raster to read in the underlying data source.
Throws:
IOException
TransformException

getReadingResolutions

public double[] getReadingResolutions(OverviewPolicy policy,
                                      double[] requestedResolution)
                               throws IOException
Returns the actual resolution used to read the data given the specified target resolution and the specified overview policy

Specified by:
getReadingResolutions in interface GridCoverage2DReader
Parameters:
policy -
resolutions -
Returns:
Throws:
IOException

getReadingResolutions

public double[] getReadingResolutions(String coverageName,
                                      OverviewPolicy policy,
                                      double[] requestedResolution)
                               throws IOException
Returns the actual resolution used to read the data given the specified target resolution and the specified overview policy

Specified by:
getReadingResolutions in interface GridCoverage2DReader
Parameters:
policy -
resolutions -
Returns:
Throws:
IOException - in case an error occurs.

decimationOnReadingControl

protected final void decimationOnReadingControl(Integer imageChoice,
                                                ImageReadParam readP,
                                                double[] requestedRes)

decimationOnReadingControl

protected final void decimationOnReadingControl(String coverageName,
                                                Integer imageChoice,
                                                ImageReadParam readP,
                                                double[] requestedRes)
This method is responsible for evaluating possible subsampling factors once the best resolution level has been found, in case we have support for overviews, or starting from the original coverage in case there are no overviews available. Anyhow this method should not be called directly but subclasses should make use of the setReadParams method instead in order to transparently look for overviews.

Parameters:
imageChoice -
readP -
requestedRes -

createImageCoverage

protected final GridCoverage createImageCoverage(PlanarImage image)
                                          throws IOException
Creates a GridCoverage for the provided PlanarImage using the originalEnvelope that was provided for this coverage.

Parameters:
image - contains the data for the coverage to create.
Returns:
a GridCoverage
Throws:
IOException

createImageCoverage

protected final GridCoverage createImageCoverage(String coverageName,
                                                 PlanarImage image)
                                          throws IOException
Creates a GridCoverage for the provided PlanarImage using the originalEnvelope that was provided for this coverage.

Parameters:
coverageName -
image - contains the data for the coverage to create.
Returns:
a GridCoverage
Throws:
IOException

createImageCoverage

protected final GridCoverage2D createImageCoverage(PlanarImage image,
                                                   MathTransform raster2Model)
                                            throws IOException
Creates a GridCoverage for the provided PlanarImage using the 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 the MathTransform that maps from the raster space to the model space.
Returns:
a GridCoverage
Throws:
IOException

createImageCoverage

protected final GridCoverage2D createImageCoverage(String coverageName,
                                                   PlanarImage image,
                                                   MathTransform raster2Model)
                                            throws IOException
Creates a GridCoverage for the provided PlanarImage using the 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:
coverageName -
image - contains the data for the coverage to create.
raster2Model - is the MathTransform that maps from the raster space to the model space.
Returns:
a GridCoverage
Throws:
IOException

getResolution

protected static final double[] getResolution(GeneralEnvelope envelope,
                                              Rectangle2D dim,
                                              CoordinateReferenceSystem crs)
                                       throws DataSourceException
This method is responsible for computing the resolutions in for the provided grid geometry in the provided crs.

It is worth to note that the returned resolution array is of length of 2 and it always is lon, lat for the moment.
It might be worth to remove the axes reordering code when we are confident enough with the code to handle the north-up crs.

TODO use orthodromic distance?

Parameters:
envelope - the GeneralEnvelope
dim -
crs -
Throws:
DataSourceException

getCrs

public final CoordinateReferenceSystem getCrs()
Deprecated. use getCoordinateReferenceSystem()

Retrieves the CoordinateReferenceSystem for dataset pointed by this AbstractGridCoverage2DReader.

Returns:
the CoordinateReferenceSystem for dataset pointed by this AbstractGridCoverage2DReader.

getOriginalGridRange

public GridEnvelope getOriginalGridRange()
Retrieves the GeneralGridEnvelope that represents the raster grid dimensions of the highest resolution level in this dataset.

Specified by:
getOriginalGridRange in interface GridCoverage2DReader
Returns:
the GeneralGridEnvelope that represents the raster grid dimensions of the highest resolution level in this dataset.

getOriginalGridRange

public GridEnvelope getOriginalGridRange(String coverageName)
Retrieves the GeneralGridEnvelope that represents the raster grid dimensions of the highest resolution level in this dataset.

Specified by:
getOriginalGridRange in interface GridCoverage2DReader
Parameters:
coverageName - the name of the coverage to work with
Returns:
the GeneralGridEnvelope that represents the raster grid dimensions of the highest resolution level in this dataset.

getCoordinateReferenceSystem

public CoordinateReferenceSystem getCoordinateReferenceSystem()
Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.

Specified by:
getCoordinateReferenceSystem in interface GridCoverage2DReader
Returns:
the GeneralEnvelope for this AbstractGridCoverage2DReader.

getCoordinateReferenceSystem

public CoordinateReferenceSystem getCoordinateReferenceSystem(String coverageName)
Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.

Specified by:
getCoordinateReferenceSystem in interface GridCoverage2DReader
Returns:
the GeneralEnvelope for this AbstractGridCoverage2DReader.

getOriginalEnvelope

public GeneralEnvelope getOriginalEnvelope()
Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.

Specified by:
getOriginalEnvelope in interface GridCoverage2DReader
Returns:
the GeneralEnvelope for this AbstractGridCoverage2DReader.

getOriginalEnvelope

public GeneralEnvelope getOriginalEnvelope(String coverageName)
Retrieves the GeneralEnvelope for this AbstractGridCoverage2DReader.

Specified by:
getOriginalEnvelope in interface GridCoverage2DReader
Parameters:
coverageName - the name of the coverage to work on.
Returns:
the GeneralEnvelope for this AbstractGridCoverage2DReader.

getOriginalGridToWorld

public MathTransform getOriginalGridToWorld(PixelInCell pixInCell)
Retrieves the original grid to world transformation for this AbstractGridCoverage2DReader.

Specified by:
getOriginalGridToWorld in interface GridCoverage2DReader
Parameters:
pixInCell - specifies the datum of the transformation we want.
Returns:
the original grid to world transformation for this AbstractGridCoverage2DReader.

getOriginalGridToWorld

public MathTransform getOriginalGridToWorld(String coverageName,
                                            PixelInCell pixInCell)
Retrieves the original grid to world transformation for this AbstractGridCoverage2DReader.

Specified by:
getOriginalGridToWorld in interface GridCoverage2DReader
Parameters:
pixInCell - specifies the datum of the transformation we want.
coverageName - the name of the coverage to work with
Returns:
the original grid to world transformation for this AbstractGridCoverage2DReader.

getSource

public final Object getSource()
Retrieves the source for this AbstractGridCoverage2DReader.

Specified by:
getSource in interface GridCoverageReader
Returns:
the source for this AbstractGridCoverage2DReader.

dispose

public void dispose()
Disposes this reader.

This method just tries to close the underlying ImageInputStream.

Specified by:
dispose in interface GridCoverageReader

skip

public void skip()
Deprecated. no replacement for that method

Description copied from interface: GridCoverageReader
Skip the current grid coverage without reading it, and move the stream position to the next grid coverage.

Specified by:
skip in interface GridCoverageReader
See Also:
GridCoverageReader.skip()

hasMoreGridCoverages

public boolean hasMoreGridCoverages()
Deprecated. no replacement for that method

Description copied from interface: GridCoverageReader
Returns true if there is at least one more grid coverage available on the stream.

Specified by:
hasMoreGridCoverages in interface GridCoverageReader
See Also:
GridCoverageReader.hasMoreGridCoverages()

listSubNames

public String[] listSubNames()
Deprecated. use getGridCoverageNames()

Description copied from interface: GridCoverageReader
Retrieve the list of grid coverages contained within the input source. Each grid can have a different coordinate system, number of dimensions and grid geometry. For example, a HDF-EOS file (GRID.HDF) contains 6 grid coverages each having a different projection. An empty array will be returned if no sub names exist.

Specified by:
listSubNames in interface GridCoverageReader
Returns:
The list of grid coverages contained within the input source.

getGridCoverageNames

public String[] getGridCoverageNames()
Description copied from interface: GridCoverageReader
Retrieve the list of coverages contained within the input source. Each grid can have a different coordinate system, number of dimensions and grid geometry. For example, a HDF-EOS file (GRID.HDF) contains 6 grid coverages each having a different projection. An empty array will be returned if no sub names exist.

Specified by:
getGridCoverageNames in interface GridCoverageReader
Returns:
The list of grid coverages contained within the input source.

getCurrentSubname

public String getCurrentSubname()
Deprecated. no replacement for that method

Description copied from interface: GridCoverageReader
Returns the name for the next grid coverage to be read from the input source.

Specified by:
getCurrentSubname in interface GridCoverageReader
See Also:
GridCoverageReader.getCurrentSubname()

getMetadataNames

public String[] getMetadataNames(String coverageName)
Description copied from interface: GridCoverageReader
Returns the list of metadata keywords associated with a specific gridCoverage referred by name. If no metadata is available, the array will be empty.

Specified by:
getMetadataNames in interface GridCoverageReader
Returns:
The list of metadata keywords for the input source.

getMetadataNames

public String[] getMetadataNames()
Description copied from interface: GridCoverageReader
Returns the list of metadata keywords associated with the input source as a whole (not associated with any particular grid coverage). If no metadata is available, the array will be empty.

Specified by:
getMetadataNames in interface GridCoverageReader
Returns:
The list of metadata keywords for the input source.
See Also:
GridCoverageReader.getMetadataNames()

getMetadataValue

public String getMetadataValue(String name)
Description copied from interface: GridCoverageReader
Retrieve the metadata value for a given metadata name.

Specified by:
getMetadataValue in interface GridCoverageReader
Parameters:
name - Metadata keyword for which to retrieve metadata.
Returns:
The metadata value for the given metadata name. Should be one of the name returned by GridCoverageReader.getMetadataNames().
See Also:
GridCoverageReader.getMetadataValue(java.lang.String)

getMetadataValue

public String getMetadataValue(String coverageName,
                               String name)
Description copied from interface: GridCoverageReader
Retrieve the metadata value for a given metadata name for a specified coverage.

Specified by:
getMetadataValue in interface GridCoverageReader
name - Metadata keyword for which to retrieve metadata.
Returns:
The metadata value for the given metadata name. Should be one of the name returned by GridCoverageReader.getMetadataNames().

getGridCoverageCount

public int getGridCoverageCount()
Description copied from interface: GridCoverageReader
Retrieve the number of coverages contained within the input source.

Specified by:
getGridCoverageCount in interface GridCoverageReader
Returns:
The number of coverages contained within the input source.
See Also:
GridCoverageReader.getGridCoverageCount()

getInfo

public ServiceInfo getInfo()
Information about this source.

Subclasses should provide additional format specific information.

Returns:
ServiceInfo describing getSource().

finalize

protected void finalize()
                 throws Throwable
Forcing disposal of this AbstractGridCoverage2DReader which may keep an ImageInputStream open.

Overrides:
finalize in class Object
Throws:
Throwable

getDynamicParameters

public Set<ParameterDescriptor<List>> getDynamicParameters()
                                                    throws IOException
Return the set of dynamic parameterDescriptors (the ones related to domains) for this reader. Default implementation returns an empty set of parameters

Specified by:
getDynamicParameters in interface GridCoverage2DReader
Returns:
Throws:
IOException - in case an error occurs while creating the Set of dynamic parameters.

getDynamicParameters

public Set<ParameterDescriptor<List>> getDynamicParameters(String coverageName)
                                                    throws IOException
Return the set of dynamic parameterDescriptors (the ones related to domains) for this reader. Default implementation returns an empty set of parameters

Specified by:
getDynamicParameters in interface GridCoverage2DReader
Parameters:
coverageName - the name of the coverage to work with
Returns:
Throws:
IOException - in case an error occurs while creating the Set of dynamic parameters.

getNumOverviews

public int getNumOverviews(String coverageName)
Description copied from interface: GridCoverage2DReader
Number of predetermined overviews for the specified coverage.

Specified by:
getNumOverviews in interface GridCoverage2DReader
Parameters:
coverageName - the name of the coverage for which we do want to get the number of overviews.
Returns:
The number of predetermined overviews for the specified coverage. 0 if none are available, -1 if infinite are available, otherwise a positive number.

getNumOverviews

public int getNumOverviews()
Description copied from interface: GridCoverage2DReader
Number of predetermined overviews for the default coverage.

Specified by:
getNumOverviews in interface GridCoverage2DReader
Returns:
The number of predetermined overviews for the default coverage. Zero if none are available, -1 if infinite are available, otherwise a positive number.

getOverviewGridEnvelope

public GridEnvelope getOverviewGridEnvelope(int overviewIndex)
                                     throws IOException
Throws:
IOException

getOverviewGridEnvelope

public GridEnvelope getOverviewGridEnvelope(String coverageName,
                                            int overviewIndex)
                                     throws IOException
Throws:
IOException

getImageLayout

public ImageLayout getImageLayout(String coverageName)
                           throws IOException
Description copied from interface: GridCoverage2DReader
Retrieve the ImageLayout for the specified coverage.

Throw an IllegalArgumentException in case the name is wrong and/or no such a coverage exists.

Specified by:
getImageLayout in interface GridCoverage2DReader
Parameters:
coverageName - the name of the coverage for which we want to know the GridEnvelope.
Returns:
an ImageLayout that is useful for actually knowing the ColorModel, the SampleModel as well as the tile grid for a certain coverage.
Throws:
IOException

getImageLayout

public ImageLayout getImageLayout()
                           throws IOException
Description copied from interface: GridCoverage2DReader
Retrieve the ImageLayout for the default coverage.

Throw an IllegalArgumentException in case the name is wrong and/or no such a coverage exists.

Specified by:
getImageLayout in interface GridCoverage2DReader
Returns:
an ImageLayout that is useful for actually knowing the ColorModel, the SampleModel as well as the tile grid for the default coverage.
Throws:
IOException

setLayout

protected void setLayout(ImageReader reader)
                  throws IOException
Extract the ImageLayout from the provided reader for the first available image.

Parameters:
reader - an istance of ImageReader
Throws:
IOException - in case an error occurs

setlayout

protected void setlayout(ImageLayout layout)
Set the provided layout for this GridCoverage2DReader-

Parameters:
layout - the ImageLayout to set. It must be nont null

getResolutionLevels

public double[][] getResolutionLevels()
                               throws IOException
Description copied from interface: GridCoverage2DReader
Retrieve the resolution levels for the default coverage.

Throw an IllegalArgumentException in case the name is wrong and/or no such a coverage exists.

Specified by:
getResolutionLevels in interface GridCoverage2DReader
Returns:
the resolution levels for the default coverage.
Throws:
IOException

getResolutionLevels

public double[][] getResolutionLevels(String coverageName)
                               throws IOException
Description copied from interface: GridCoverage2DReader
Retrieve the resolution levels for the specified coverage.

Throw an IllegalArgumentException in case the name is wrong and/or no such a coverage exists.

Specified by:
getResolutionLevels in interface GridCoverage2DReader
Parameters:
coverageName - the name of the coverage for which we want to know the resolution levels.
Returns:
the resolution levels for the specified coverage.
Throws:
IOException

getHighestRes

protected double[] getHighestRes(String coverageName)


Copyright © 1996-2014 Geotools. All Rights Reserved.