public final class ImagePyramidReader extends AbstractGridCoverage2DReader implements GridCoverageReader
Specifically this plugin relies on the image mosaic plugin to handle each single level of resolutions available, hence all the magic is done inside the mosaic plugin.
For information on how to build a mosaic, please refer to the ImageMosaicReader
documentation.
If you are looking for information on how to create a pyramid, here you go.
The pyramid itself does no magic. All the magic is performed by the single mosaic readers that are polled depending on the requeste resolution levels. Therefore the first step is having a mosaic of images like geotiff, tiff, jpeg, or png which is going to be the base for the pyramid.
The second step is to build the next (lower resolution) levels for the pyramid.
If you look inside the spike dire of the geotools project you will find a (growing) set of tools
that can be used for doing processing on coverages.
Specifically there is one tool called PyramidBuilder that can be used to build the pyramid level
by level.
Last step is providing a prj file with the projection of the pyramid (btw all the levels has to be in the same projection) as well as a properties file with this structure:
#
#Mon Aug 21 22:23:27 CEST 2006
#name of the coverage
Name=ikonos
#different resolution levels available
Levels=1.2218682749859724E-5,9.220132503102996E-6 2.4428817977683634E-5,1.844026500620314E-5 4.8840552865873626E-5,3.686350299024973E-5 9.781791400307775E-5,7.372700598049946E-5 1.956358280061555E-4,1.4786360643866836E-4 3.901787184256844E-4,2.9572721287731037E-4
#where all the levels reside
LevelsDirs=0 2 4 8 16 32
#number of levels available
LevelsNum=6
#envelope for this pyramid
Envelope2D=13.398228477973406,43.591366397808976 13.537912459169803,43.67121274528585
Starting with 16.x ImagePyramid can now support ImageMosaics with inner overviews. See ImageLevelsMapper for additional details of the Levels entry of a pyramid of mosaics with inner
overviews.
closeMe, coverageFactory, coverageName, crs, dtLayout, EPS, gzipped, highestRes, hints, inStream, inStreamSPI, numOverviews, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, sourceELEVATION_DOMAIN, ELEVATION_DOMAIN_MAXIMUM, ELEVATION_DOMAIN_MINIMUM, ELEVATION_DOMAIN_RESOLUTION, FILE_SOURCE_PROPERTY, HAS_ELEVATION_DOMAIN, HAS_TIME_DOMAIN, MULTICRS_READER, REPROJECTING_READER, SOURCE_URL_PROPERTY, TIME_DOMAIN, TIME_DOMAIN_MAXIMUM, TIME_DOMAIN_MINIMUM, TIME_DOMAIN_RESOLUTION| Constructor and Description |
|---|
ImagePyramidReader(Object source)
Constructor for an
ImagePyramidReader. |
ImagePyramidReader(Object source,
Hints uHints)
Constructor for an
ImagePyramidReader. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes this reader.
|
CoordinateReferenceSystem |
getCoordinateReferenceSystem(String coverageName)
Retrieves the
GeneralEnvelope for this AbstractGridCoverage2DReader. |
DatasetLayout |
getDatasetLayout(String coverageName)
Returns the
DatasetLayout for the specified coverage. |
Set<ParameterDescriptor<List>> |
getDynamicParameters(String coverageName)
Return the set of dynamic parameterDescriptors (the ones related to domains) for this reader.
|
Format |
getFormat()
Returns the format handled by this
GridCoverageReader. |
int |
getGridCoverageCount()
Retrieve the number of coverages contained within the input source.
|
String[] |
getGridCoverageNames()
Retrieve the list of coverages contained within the input source.
|
ImageLayout |
getImageLayout(String coverageName)
Retrieve the
ImageLayout for the specified coverage. |
ImageMosaicReader |
getImageMosaicReaderForLevel(Integer imageChoice)
Retrieve the ImageMosaicReader for the requested Level and load if necessary
|
ImageMosaicReader |
getImageMosaicReaderForLevel(String coverageName,
Integer imageChoice)
Retrieve the ImageMosaicReader for the requested Level and load if necessary
|
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 data value for requested metadata
|
String |
getMetadataValue(String coverageName,
String name)
Retrieve meta data value from requested coverage and for requested metadata
|
int |
getNumOverviews(String coverageName)
Number of predetermined overviews for the specified coverage.
|
GeneralEnvelope |
getOriginalEnvelope(String coverageName)
Retrieves the
GeneralEnvelope for this AbstractGridCoverage2DReader. |
GridEnvelope |
getOriginalGridRange(String coverageName)
Retrieves the
GeneralGridEnvelope that represents the raster grid dimensions of the
highest resolution level in this dataset. |
MathTransform |
getOriginalGridToWorld(String coverageName,
PixelInCell pixInCell)
Retrieves the original grid to world transformation for this
AbstractGridCoverage2DReader. |
double[][] |
getResolutionLevels(String coverageName)
Retrieve the resolution levels for the specified coverage.
|
GridCoverage2D |
read(GeneralParameterValue[] params)
Read the current grid coverage from the stream.
|
GridCoverage2D |
read(String coverageName,
GeneralParameterValue[] params)
Retrieves the
GridEnvelope associated to the specified coverageName for this GridCoverage2DReader. |
addAllSiblings, addSiblings, checkName, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, finalize, getCoordinateReferenceSystem, getCrs, getCurrentSubname, getDatasetLayout, getDynamicParameters, getFiles, getGroundControlPoints, getGroundControlPoints, getHighestRes, getImageLayout, getInfo, getInfo, getMultiLevelROIProvider, getNumOverviews, getOriginalEnvelope, getOriginalGridRange, getOriginalGridToWorld, getOverviewGridEnvelope, getOverviewGridEnvelope, getReadingResolutions, getReadingResolutions, getRescaledRasterToModel, getResolution, getResolutionLevels, getSibling, getSource, getSourceAsFile, hasMoreGridCoverages, listSubNames, setlayout, setLayout, setReadParams, setReadParams, skipclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCurrentSubname, getSource, hasMoreGridCoverages, listSubNames, skippublic ImagePyramidReader(Object source, Hints uHints) throws IOException
ImagePyramidReader.source - The source object.uHints - Hints to control the behaviour of this reader.IOExceptionUnsupportedEncodingExceptionpublic ImagePyramidReader(Object source) throws IOException
ImagePyramidReader.source - The source object.IOExceptionUnsupportedEncodingExceptionpublic Format getFormat()
GridCoverageReaderGridCoverageReader.getFormat in interface GridCoverageReaderGridCoverageReader.getFormat()public GridCoverage2D read(GeneralParameterValue[] params) throws IOException
AbstractGridCoverage2DReaderExample:
The method AbstractGridCoverage2DReader.hasMoreGridCoverages() should be invoked first in order to verify that a
coverage is available.read in interface GridCoverage2DReaderread in interface GridCoverageReaderread in class AbstractGridCoverage2DReaderparams - Optional parameters matching Format.getReadParameters().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.public GridEnvelope getOriginalGridRange(String coverageName)
AbstractGridCoverage2DReaderGeneralGridEnvelope that represents the raster grid dimensions of the
highest resolution level in this dataset.getOriginalGridRange in interface GridCoverage2DReadergetOriginalGridRange in class AbstractGridCoverage2DReadercoverageName - the name of the coverage to work withGeneralGridEnvelope that represents the raster grid dimensions of the
highest resolution level in this dataset.public CoordinateReferenceSystem getCoordinateReferenceSystem(String coverageName)
AbstractGridCoverage2DReaderGeneralEnvelope for this AbstractGridCoverage2DReader.getCoordinateReferenceSystem in interface GridCoverage2DReadergetCoordinateReferenceSystem in class AbstractGridCoverage2DReaderGeneralEnvelope for this AbstractGridCoverage2DReader.public GeneralEnvelope getOriginalEnvelope(String coverageName)
AbstractGridCoverage2DReaderGeneralEnvelope for this AbstractGridCoverage2DReader.getOriginalEnvelope in interface GridCoverage2DReadergetOriginalEnvelope in class AbstractGridCoverage2DReadercoverageName - the name of the coverage to work on.GeneralEnvelope for this AbstractGridCoverage2DReader.public MathTransform getOriginalGridToWorld(String coverageName, PixelInCell pixInCell)
AbstractGridCoverage2DReaderAbstractGridCoverage2DReader.getOriginalGridToWorld in interface GridCoverage2DReadergetOriginalGridToWorld in class AbstractGridCoverage2DReadercoverageName - the name of the coverage to work withpixInCell - specifies the datum of the transformation we want.AbstractGridCoverage2DReader.public Set<ParameterDescriptor<List>> getDynamicParameters(String coverageName)
AbstractGridCoverage2DReadergetDynamicParameters in interface GridCoverage2DReadergetDynamicParameters in class AbstractGridCoverage2DReadercoverageName - the name of the coverage to work withSet of dynamic read parameters supported by this GridCoverage2DReader.public int getNumOverviews(String coverageName)
GridCoverage2DReadergetNumOverviews in interface GridCoverage2DReadergetNumOverviews in class AbstractGridCoverage2DReadercoverageName - the name of the coverage for which we do want to get the number of
overviews.public DatasetLayout getDatasetLayout(String coverageName)
GridCoverage2DReaderDatasetLayout for the specified coverage.getDatasetLayout in interface GridCoverage2DReadergetDatasetLayout in class AbstractGridCoverage2DReadercoverageName - the name of the coverage for which we do want to get the DatasetLayoutDatasetLayout object containing info about Overview number and Image masks.public ImageLayout getImageLayout(String coverageName) throws IOException
GridCoverage2DReaderImageLayout for the specified coverage.
Throw an IllegalArgumentException in case the name is wrong and/or no such a
coverage exists.
getImageLayout in interface GridCoverage2DReadergetImageLayout in class AbstractGridCoverage2DReadercoverageName - the name of the coverage for which we want to know the GridEnvelope.ImageLayout that is useful for actually knowing the ColorModel,
the SampleModel as well as the tile grid for a certain coverage.IOExceptionpublic double[][] getResolutionLevels(String coverageName) throws IOException
GridCoverage2DReaderThrow an IllegalArgumentException in case the name is wrong and/or no such a
coverage exists.
getResolutionLevels in interface GridCoverage2DReadergetResolutionLevels in class AbstractGridCoverage2DReadercoverageName - the name of the coverage for which we want to know the resolution levels.IOExceptionpublic GridCoverage2D read(String coverageName, GeneralParameterValue[] params) throws IOException
GridCoverage2DReaderGridEnvelope associated to the specified coverageName for this GridCoverage2DReader.read in interface GridCoverage2DReaderread in interface GridCoverageReaderread in class AbstractGridCoverage2DReadercoverageName - the name of the coverage to work withparams - an array of GeneralParameterValue that uses a subset of the
available read params for this GridCoverage2DReader as specified by the FormatGridCoverage2D for the underlying default coverage for this GridCoverage2DReader or null in case no GridCoverage2D can be read
for the provided parameters.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.public void dispose()
AbstractGridCoverage2DReaderThis method just tries to close the underlying ImageInputStream.
dispose in interface GridCoverageReaderdispose in class AbstractGridCoverage2DReaderGridCoverageReader.dispose()public String[] getGridCoverageNames()
GridCoverageReadergetGridCoverageNames in interface GridCoverageReadergetGridCoverageNames in class AbstractGridCoverage2DReaderpublic int getGridCoverageCount()
GridCoverageReadergetGridCoverageCount in interface GridCoverageReadergetGridCoverageCount in class AbstractGridCoverage2DReaderGridCoverageReader.getGridCoverageCount()public String getMetadataValue(String coverageName, String name)
getMetadataValue in interface GridCoverageReadergetMetadataValue in class AbstractGridCoverage2DReadercoverageName - name - public String getMetadataValue(String name)
getMetadataValue in interface GridCoverageReadergetMetadataValue in class AbstractGridCoverage2DReadername - Metadata keyword for which to retrieve metadata.GridCoverageReader.getMetadataNames().GridCoverageReader.getMetadataValue(java.lang.String)public String[] getMetadataNames(String coverageName)
GridCoverageReadergetMetadataNames in interface GridCoverageReadergetMetadataNames in class AbstractGridCoverage2DReaderpublic String[] getMetadataNames()
GridCoverageReadergetMetadataNames in interface GridCoverageReadergetMetadataNames in class AbstractGridCoverage2DReaderGridCoverageReader.getMetadataNames()public ImageMosaicReader getImageMosaicReaderForLevel(Integer imageChoice) throws IOException
IOExceptionpublic ImageMosaicReader getImageMosaicReaderForLevel(String coverageName, Integer imageChoice) throws IOException
IOExceptionCopyright © 1996–2019 Geotools. All rights reserved.