Package org.geotools.gce.image
Class WorldImageReader
- Object
-
- AbstractGridCoverage2DReader
-
- WorldImageReader
-
- All Implemented Interfaces:
GridCoverageReader
,GridCoverage2DReader
public final class WorldImageReader extends AbstractGridCoverage2DReader implements GridCoverage2DReader
Reads a GridCoverage from a given source. WorldImage sources only support one GridCoverage so hasMoreGridCoverages() will return true until the only GridCoverage is read. No metadata is currently supported, so all related methods return null. In the early future we will start (hopefully supporting them).- Author:
- simone giannecchini, alessio fabiani, rgould
-
-
Field Summary
-
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 Constructor Description WorldImageReader(Object input)
Class constructor.WorldImageReader(Object input, Hints hints)
Class constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getExtension()
Returns the file extension of the image.protected List<FileGroupProvider.FileGroup>
getFiles()
Returns a list of files making up the source data for this reader (as a whole).Format
getFormat()
Returns the format that this Reader accepts.int
getGridCoverageCount()
Number of coverages for this reader is 1GridCoverage2D
read(GeneralParameterValue[] params)
Reads an image from a source stream.-
Methods inherited from class AbstractGridCoverage2DReader
addAllSiblings, addSiblings, checkName, collectScaleOffset, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, dispose, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getGridCoverageNames, getGroundControlPoints, getGroundControlPoints, getHighestRes, getHighestRes, getImageLayout, getImageLayout, getInfo, 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, 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, getInfo, getInfo, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, read
-
Methods inherited from interface GridCoverageReader
dispose, getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource
-
-
-
-
Constructor Detail
-
WorldImageReader
public WorldImageReader(Object input) throws DataSourceException
Class constructor. Construct a new ImageWorldReader to read a GridCoverage from the source object. The source must point to the raster file itself, not the world file. If the source is a Java URL it checks if it is ponting to a file and if so it converts the url into a file.- Parameters:
input
- The source of a GridCoverage, can be a File, a URL or an input stream.- Throws:
DataSourceException
-
WorldImageReader
public WorldImageReader(Object input, Hints hints) throws DataSourceException
Class constructor. Construct a new ImageWorldReader to read a GridCoverage from the source object. The source must point to the raster file itself, not the world file. If the source is a Java URL it checks if it is ponting to a file and if so it converts the url into a file.- Parameters:
input
- The source of a GridCoverage, can be a File, a URL or an input stream.- Throws:
DataSourceException
-
-
Method Detail
-
getFormat
public Format getFormat()
Returns the format that this Reader accepts.- Specified by:
getFormat
in interfaceGridCoverageReader
- Returns:
- a new WorldImageFormat class
-
read
public GridCoverage2D read(GeneralParameterValue[] params) throws IllegalArgumentException, IOException
Reads an image from a source stream. Loads an image from a source stream, then loads the values from the world file and constructs a new GridCoverage from this information. When reading from a remote stream we do not look for a world fiel but we suppose those information comes from a different way (xml, gml, pigeon?)- Specified by:
read
in interfaceGridCoverage2DReader
- Specified by:
read
in interfaceGridCoverageReader
- Specified by:
read
in classAbstractGridCoverage2DReader
- Parameters:
params
- WorldImageReader supports no parameters, it just ignores them.- Returns:
- a new GridCoverage read from the 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
-
getGridCoverageCount
public int getGridCoverageCount()
Number of coverages for this reader is 1- Specified by:
getGridCoverageCount
in interfaceGridCoverageReader
- Overrides:
getGridCoverageCount
in classAbstractGridCoverage2DReader
- Returns:
- the number of coverages for this reader.
- See Also:
GridCoverageReader.getGridCoverageCount()
-
getExtension
public String getExtension()
Returns the file extension of the image.- Since:
- 2.7
-
getFiles
protected List<FileGroupProvider.FileGroup> getFiles()
Description copied from class:AbstractGridCoverage2DReader
Returns 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:
getFiles
in classAbstractGridCoverage2DReader
-
-