Package org.geotools.gce.grassraster
Class GrassCoverageReader
Object
AbstractGridCoverage2DReader
GrassCoverageReader
- All Implemented Interfaces:
GridCoverageReader,GridCoverage2DReader
public class GrassCoverageReader
extends AbstractGridCoverage2DReader
implements GridCoverage2DReader
Coverage Reader class for reading GRASS raster maps.
The class reads a GRASS raster map from a GRASS workspace (see package documentation for further info). The reading is really done via Imageio extended classes.
- Since:
- 3.0
- Author:
- Andrea Antonello (www.hydrologis.com)
- See Also:
-
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, sourceFields 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
ConstructorsConstructorDescriptionGrassCoverageReader(Object input) Sets the input source to use to the givenfile object. -
Method Summary
Modifier and TypeMethodDescriptionGetter for the categories string.Returns the format handled by thisGridCoverageReader.Getter for the legend string.double[]getRange()Gets the range.read(GeneralParameterValue... params) Read the current grid coverage from the stream.readRaster(JGrassRegion region) Performs the reading of the coverage.voidsetParams(PixelInCell cellAnchor, Interpolation interpolation, boolean useSubSamplingAsColsRows, boolean castDoubleToFloating, ProgressListener monitor) Constructor for theGrassCoverageReader.Methods inherited from class AbstractGridCoverage2DReader
addAllSiblings, addSiblings, checkName, collectScaleOffset, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, dispose, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getFiles, getGridCoverageCount, 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, setReadParamsMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GridCoverage2DReader
getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getImageLayout, getImageLayout, getInfo, getInfo, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, readMethods inherited from interface GridCoverageReader
dispose, getGridCoverageCount, getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource
-
Constructor Details
-
GrassCoverageReader
Sets the input source to use to the givenfile object.The input source must be set before any of the query or read methods are used.
- Parameters:
input- theFileto use for future decoding.
-
-
Method Details
-
setParams
public void setParams(PixelInCell cellAnchor, Interpolation interpolation, boolean useSubSamplingAsColsRows, boolean castDoubleToFloating, ProgressListener monitor) Constructor for theGrassCoverageReader.- Parameters:
cellAnchor- the object defining whether to assume the pixel value to be read in the grid's cell corner or center.interpolation- the type of interpolation to be used in the case some scaling or padding has to be done.useSubSamplingAsColsRows- a flag that gives the possibility to bypass the imageio subsampling mechanism. With GRASS maps this is often more performant in some boundary situations. In the case this flag is set to true, the subsampling values will be handled as the requested columns and rows.castDoubleToFloating- a flag that gives the possibility to force the reading of a map as a floating point map. This is necessary right now because of a imageio bug: https://jai-imageio-core.dev.java.net /issues/show_bug.cgi?id=180.monitor- amonitorfor logging purposes. This can be null, in which case a dummy one will be used.
-
readRaster
Performs the reading of the coverage.This method read the grass file with a special image I/O class. If the image support the tiling read the data with a special operation which are written for this case. The step are:
- set the region in the world
- set the region to read in the ImageN coordinate
- read the data directly with driver or, if isTiling is true, with the operation.
- verify if the image cover whole the region, if not fill the rows and columns with padding (with the Border operation)
- scale the image to return an image with the number of columns and rows equal to the requestedRegion
- set the coverage (with the transformation from the ImageN coordinate to the real world coordinate.
- Parameters:
region- theregionto read. If null, the map is read in its original boundary and resolution.- Returns:
- the
read coverage. - Throws:
IOException
-
getLegendString
Getter for the legend string.- Returns:
- the legendstring.
-
getCategoriesString
Getter for the categories string.- Returns:
- the categories string.
-
getRange
public double[] getRange()Gets the range.Note that the range is available only if the raster was read once.
- Returns:
- the range non considering novalues.
-
read
public GridCoverage2D read(GeneralParameterValue... params) throws IllegalArgumentException, IOException Description copied from class:AbstractGridCoverage2DReaderRead the current grid coverage from the stream.Example:
- Specified by:
readin interfaceGridCoverage2DReader- Specified by:
readin interfaceGridCoverageReader- Specified by:
readin classAbstractGridCoverage2DReader- Parameters:
params- Optional parameters matchingFormat.getReadParameters().- Returns:
- a grid coverage from the input source.
- Throws:
InvalidParameterNameException- if a parameter inparametersdoesn't have a recognized name.InvalidParameterValueException- if a parameter inparametersdoesn't have a valid value.ParameterNotFoundException- if a parameter was required for the operation but was not provided in theparameterslist.IOException- if a read operation failed for some other input/output reason, includingFileNotFoundExceptionif no file with the givennamecan be found, orIIOExceptionif an error was thrown by the underlying image library.IllegalArgumentException
-
getFormat
Description copied from interface:GridCoverageReaderReturns the format handled by thisGridCoverageReader.- Specified by:
getFormatin interfaceGridCoverageReader
-