Package org.geotools.coverageio.jp2k
Class JP2KReader
Object
AbstractGridCoverage2DReader
JP2KReader
- All Implemented Interfaces:
GridCoverageReader
,GridCoverage2DReader
This class can read a JP2K data source and create a
GridCoverage2D
from the data.- Author:
- Daniele Romagnoli, GeoSolutions., Simone Giannecchini (simboss), GeoSolutions
-
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
ConstructorsConstructorDescriptionJP2KReader
(Object input) Creates a new instance of aJP2KReader
.JP2KReader
(Object source, Hints uHints) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Releases resources held by this reader.protected GeneralBounds
protected GridEnvelope2D
Returns the format handled by thisGridCoverageReader
.int
Number of coverages for this reader is 1protected double[]
Package private accessor for the highest resolution values.protected void
Gets the coordinate reference system that will be associated to theGridCoverage
by looking for a related PRJ.protected void
Checks whether a world file is associated with the data source.read
(GeneralParameterValue... params) Read the current grid coverage from the stream.protected void
setCoverageEnvelope
(GeneralBounds coverageEnvelope) protected void
setCoverageGridRange
(GridEnvelope2D coverageGridRange) protected void
setCoverageProperties
(ImageReader reader) Setting Envelope, GridRange and CRS from the givenImageReader
Methods inherited from class AbstractGridCoverage2DReader
addAllSiblings, addSiblings, checkName, collectScaleOffset, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getFiles, getGridCoverageNames, getGroundControlPoints, getGroundControlPoints, 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
getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource
-
Constructor Details
-
JP2KReader
Creates a new instance of aJP2KReader
. I assume nothing about file extension.- Parameters:
input
- Source object for which we want to build an JP2KReader.- Throws:
IOException
-
JP2KReader
Constructor.- Parameters:
source
- The source object.- Throws:
IOException
-
-
Method Details
-
setCoverageProperties
Setting Envelope, GridRange and CRS from the givenImageReader
- Parameters:
reader
- theImageReader
from which to retrieve metadata (if available) for setting properties- Throws:
IOException
-
setCoverageEnvelope
- Parameters:
coverageEnvelope
- the envelope to set
-
getCoverageEnvelope
- Returns:
- the nativeEnvelope
-
setCoverageGridRange
- Parameters:
coverageGridRange
- the coverage grid range to set
-
getCoverageGridRange
- Returns:
- the nativeGridRange
-
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:
-
dispose
public void dispose()Releases resources held by this reader.- Specified by:
dispose
in interfaceGridCoverageReader
- Overrides:
dispose
in classAbstractGridCoverage2DReader
-
getFormat
Description copied from interface:GridCoverageReader
Returns the format handled by thisGridCoverageReader
.- Specified by:
getFormat
in interfaceGridCoverageReader
- See Also:
-
read
Description copied from class:AbstractGridCoverage2DReader
Read the current grid coverage from the stream.Example:
- Specified by:
read
in interfaceGridCoverage2DReader
- Specified by:
read
in interfaceGridCoverageReader
- Specified by:
read
in classAbstractGridCoverage2DReader
- Parameters:
params
- Optional parameters matchingFormat.getReadParameters()
.- Returns:
- a grid coverage from the input source.
- Throws:
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.- See Also:
-
getHighestRes
protected double[] getHighestRes()Package private accessor for the highest resolution values.- Overrides:
getHighestRes
in classAbstractGridCoverage2DReader
- Returns:
- the highest resolution values.
-
parsePRJFile
Gets the coordinate reference system that will be associated to theGridCoverage
by looking for a related PRJ.- Throws:
UnsupportedEncodingException
-
parseWorldFile
Checks whether a world file is associated with the data source. If found, set a proper envelope.- Throws:
IOException
-