Class AbstractGridFormat
- Object
-
- AbstractGridFormat
-
- All Implemented Interfaces:
Format
- Direct Known Subclasses:
ArcGridFormat,BaseGDALGridFormat,GeoPackageFormat,GeoTiffFormat,GrassCoverageFormat,ImageMosaicFormat,ImagePyramidFormat,JP2KFormat,MBTilesFormat,NetCDFFormat,PGRasterFormat,TPKFormat,UnknownFormat,WorldImageFormat
public abstract class AbstractGridFormat extends Object implements Format
AbstractGridFormat is a convenience class so subclasses only need to populate a Map class and set the read and write parameter fields.For example the ArcGridFormat has the following method which sets up all the required information:
private void setInfo(){ HashMap info=new HashMap(); info.put("name", "ArcGrid"); info.put("description", "Arc Grid Coverage Format"); info.put("vendor", "Geotools"); info.put("docURL", "http://gdal.velocet.ca/projects/aigrid/index.html"); info.put("version", "1.0"); mInfo=info; readParameters=new GeneralParameterDescriptor[2]; readParameters[0]=ArcGridOperationParameter.getGRASSReadParam(); readParameters[0]=ArcGridOperationParameter.getCompressReadParam(); writeParameters=new GeneralParameterDescriptor[2]; writeParameters[0]=ArcGridOperationParameter.getGRASSWriteParam(); writeParameters[0]=ArcGridOperationParameter.getCompressWriteParam(); }- Author:
- jeichar, Simone Giannecchini, GeoSolutions
-
-
Field Summary
Fields Modifier and Type Field Description static ParameterDescriptor<Color>BACKGROUND_COLORControl the background color to be used where the input was transparentstatic DefaultParameterDescriptor<int[]>BANDSThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method to specify the band indices of the input grid coverage that are going to be in the resulting coverage.static ParameterDescriptor<DecimationPolicy>DECIMATION_POLICYThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to specify the policy a reader should adopt when setting read parameters when evaluating a needed resolution.static ParameterDescriptor<List>ELEVATIONOptional Elevation value for this mosaic.static ParameterDescriptor<String>FOOTPRINT_BEHAVIORControl the footprint management.static DefaultParameterDescriptor<GeoToolsWriteParams>GEOTOOLS_WRITE_PARAMSThisGeneralParameterValuecan be provided to theGridCoverageWriters through theGridCoverageWriter#write(org.geotools.api.coverage.grid.GridCoverage, GeneralParameterValue[])method in order to control the writing process in terms of compression, tiling, etc.GridGeometry2Dstatic ParameterDescriptor<Color>INPUT_TRANSPARENT_COLORControl the transparency of the input coverages.static ParameterDescriptor<Interpolation>INTERPOLATIONControl the interpolation to be used in the eventual image processing done while reading dataprotected Map<String,String>mInfoThe Map object is used by the information methods(such as getName()) as a data source.static DefaultParameterDescriptor<OverviewPolicy>OVERVIEW_POLICYThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to specify the policy a reader should adopt when choosing the right overview during a read operation.static DefaultParameterDescriptor<ProgressListener>PROGRESS_LISTENERThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#write(GeneralParameterValue[])method in order to monitor a writing processstatic DefaultParameterDescriptor<GridGeometry2D>READ_GRIDGEOMETRY2DThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to pick up the best matching resolution level and (soon) the best matching area.protected ParameterValueGroupreadParametersParameterValueGroupthat controls the reading process for aGridCoverageReaderthrough theGridCoverageReader.read(org.geotools.api.parameter.GeneralParameterValue[])method.static DefaultParameterDescriptor<Boolean>RESCALE_PIXELSThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader.read(GeneralParameterValue[])method in order to specify the whether eventual value rescaling should be performed, or the original pixel value preservedstatic DefaultParameterDescriptor<String>SUGGESTED_TILE_SIZEThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to specify the suggested size of tiles to avoid long time reading occurring with JAI ImageRead on striped images.static StringTILE_SIZE_SEPARATORstatic ParameterDescriptor<List>TIMEOptional Time value for this mosaic.static DefaultParameterDescriptor<Boolean>USE_JAI_IMAGEREADThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader.read(GeneralParameterValue[])method in order to specify the type of image read operation requested: using a JAI ImageRead operation (leveraging on Deferred Execution Model, Tile Caching,...), or the directImageReader's read methods.protected ParameterValueGroupwriteParametersParameterValueGroupthat controls the writing process for aGridCoverageWriterthrough theGridCoverageWriter.write(org.geotools.api.coverage.grid.GridCoverage, org.geotools.api.parameter.GeneralParameterValue[])method.
-
Constructor Summary
Constructors Constructor Description AbstractGridFormat()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanaccepts(Object source)Tells me if thisFormatcan read the providedinput.abstract booleanaccepts(Object source, Hints hints)Tells me if thisFormatcan read the providedinput.booleanequals(Format f)static CoordinateReferenceSystemgetDefaultCRS()getDefaultCRSabstract GeoToolsWriteParamsgetDefaultImageIOWriteParameters()Returns an instance ofImageWriteParamthat can be used to control a subsequentGridCoverageWriter.write(org.geotools.api.coverage.grid.GridCoverage, org.geotools.api.parameter.GeneralParameterValue[]);StringgetDescription()Description of the file format.StringgetDocURL()Documentation URL for the format.StringgetName()Name of the file format.abstract AbstractGridCoverage2DReadergetReader(Object source)Gets aGridCoverageReaderfor this format able to create coverages out of thesourceobject.abstract AbstractGridCoverage2DReadergetReader(Object source, Hints hints)Gets aGridCoverageReaderfor this format able to create coverages out of thesourceobject using the providedhints.ParameterValueGroupgetReadParameters()Retrieve the parameter information for areadoperation.StringgetVendor()Vendor or agency for the format.StringgetVersion()Version number of the format.ParameterValueGroupgetWriteParameters()Retrieve the parameter information for awriteoperation.abstract GridCoverageWritergetWriter(Object destination)Retrieves aGridCoverageWritersuitable for writing to the provideddestinationwith this format.abstract GridCoverageWritergetWriter(Object destination, Hints hints)Call the accepts() method before asking for a writer to determine if the current object is supported.
-
-
-
Field Detail
-
mInfo
protected Map<String,String> mInfo
The Map object is used by the information methods(such as getName()) as a data source. The keys in the Map object (for the associated method) are as follows: getName() key = "name" value type=String getDescription() key = "description" value type=String getVendor() key = "vendor" value type=String getDocURL() key = "docURL" value type=String getVersion() key = "version" value type=String Naturally, any methods that are overridden need not have an entry in the Map
-
readParameters
protected ParameterValueGroup readParameters
ParameterValueGroupthat controls the reading process for aGridCoverageReaderthrough theGridCoverageReader.read(org.geotools.api.parameter.GeneralParameterValue[])method.
-
writeParameters
protected ParameterValueGroup writeParameters
ParameterValueGroupthat controls the writing process for aGridCoverageWriterthrough theGridCoverageWriter.write(org.geotools.api.coverage.grid.GridCoverage, org.geotools.api.parameter.GeneralParameterValue[])method.
-
READ_GRIDGEOMETRY2D
public static final DefaultParameterDescriptor<GridGeometry2D> READ_GRIDGEOMETRY2D
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to pick up the best matching resolution level and (soon) the best matching area.
-
PROGRESS_LISTENER
public static final DefaultParameterDescriptor<ProgressListener> PROGRESS_LISTENER
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#write(GeneralParameterValue[])method in order to monitor a writing process
-
GEOTOOLS_WRITE_PARAMS
public static final DefaultParameterDescriptor<GeoToolsWriteParams> GEOTOOLS_WRITE_PARAMS
ThisGeneralParameterValuecan be provided to theGridCoverageWriters through theGridCoverageWriter#write(org.geotools.api.coverage.grid.GridCoverage, GeneralParameterValue[])method in order to control the writing process in terms of compression, tiling, etc.GridGeometry2D
-
USE_JAI_IMAGEREAD
public static final DefaultParameterDescriptor<Boolean> USE_JAI_IMAGEREAD
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader.read(GeneralParameterValue[])method in order to specify the type of image read operation requested: using a JAI ImageRead operation (leveraging on Deferred Execution Model, Tile Caching,...), or the directImageReader's read methods.
-
OVERVIEW_POLICY
public static final DefaultParameterDescriptor<OverviewPolicy> OVERVIEW_POLICY
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to specify the policy a reader should adopt when choosing the right overview during a read operation.
-
DECIMATION_POLICY
public static final ParameterDescriptor<DecimationPolicy> DECIMATION_POLICY
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to specify the policy a reader should adopt when setting read parameters when evaluating a needed resolution.
-
SUGGESTED_TILE_SIZE
public static final DefaultParameterDescriptor<String> SUGGESTED_TILE_SIZE
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method in order to specify the suggested size of tiles to avoid long time reading occurring with JAI ImageRead on striped images. (Images with tiles Nx1) Value should be a String in the form of "W,H" (without quotes) where W is a number representing the suggested tileWidth and H is a number representing the suggested tileHeight.
-
BANDS
public static final DefaultParameterDescriptor<int[]> BANDS
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader#read(GeneralParameterValue[])method to specify the band indices of the input grid coverage that are going to be in the resulting coverage. The order of the bands on the output coverage is the order of the indices in the parameter. Value should be an integer array (int[]) containing the band indices in the desired order. Duplicate or multiple appearances of the same band index are allowed.
-
TILE_SIZE_SEPARATOR
public static final String TILE_SIZE_SEPARATOR
- See Also:
- Constant Field Values
-
INPUT_TRANSPARENT_COLOR
public static final ParameterDescriptor<Color> INPUT_TRANSPARENT_COLOR
Control the transparency of the input coverages.
-
BACKGROUND_COLOR
public static final ParameterDescriptor<Color> BACKGROUND_COLOR
Control the background color to be used where the input was transparent
-
TIME
public static final ParameterDescriptor<List> TIME
Optional Time value for this mosaic.
-
ELEVATION
public static final ParameterDescriptor<List> ELEVATION
Optional Elevation value for this mosaic.
-
INTERPOLATION
public static final ParameterDescriptor<Interpolation> INTERPOLATION
Control the interpolation to be used in the eventual image processing done while reading data
-
FOOTPRINT_BEHAVIOR
public static final ParameterDescriptor<String> FOOTPRINT_BEHAVIOR
Control the footprint management.
-
RESCALE_PIXELS
public static final DefaultParameterDescriptor<Boolean> RESCALE_PIXELS
ThisGeneralParameterValuecan be provided to theGridCoverageReaders through theGridCoverageReader.read(GeneralParameterValue[])method in order to specify the whether eventual value rescaling should be performed, or the original pixel value preserved
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:FormatName of the file format.- Specified by:
getNamein interfaceFormat- See Also:
Format.getName()
-
getDescription
public String getDescription()
Description copied from interface:FormatDescription of the file format. If no description, the value will benull.- Specified by:
getDescriptionin interfaceFormat- See Also:
Format.getDescription()
-
getVendor
public String getVendor()
Description copied from interface:FormatVendor or agency for the format.- Specified by:
getVendorin interfaceFormat- See Also:
Format.getVendor()
-
getDocURL
public String getDocURL()
Description copied from interface:FormatDocumentation URL for the format.- Specified by:
getDocURLin interfaceFormat- See Also:
Format.getDocURL()
-
getVersion
public String getVersion()
Description copied from interface:FormatVersion number of the format.- Specified by:
getVersionin interfaceFormat- See Also:
Format.getVersion()
-
getReader
public abstract AbstractGridCoverage2DReader getReader(Object source)
Gets aGridCoverageReaderfor this format able to create coverages out of thesourceobject.In case this
Formatcannot reader the providedsourceobjectnullis returned.- Parameters:
source- The source object to parse.- Returns:
- A reader for this
Formator null.
-
getReader
public abstract AbstractGridCoverage2DReader getReader(Object source, Hints hints)
Gets aGridCoverageReaderfor this format able to create coverages out of thesourceobject using the providedhints.In case this
Formatcannot reader the providedsourceobjectnullis returned.
-
getWriter
public abstract GridCoverageWriter getWriter(Object destination)
Retrieves aGridCoverageWritersuitable for writing to the provideddestinationwith this format.In case no writers are available
nullis returned.- Parameters:
destination- The destinatin where to write.- Returns:
- A
GridCoverageWritersuitable for writing to the provideddestinationwith this format.
-
accepts
public boolean accepts(Object source)
Tells me if thisFormatcan read the providedinput.- Parameters:
source- The input object to test for suitability.- Returns:
- True if this format can read this object, False otherwise.
-
accepts
public abstract boolean accepts(Object source, Hints hints)
Tells me if thisFormatcan read the providedinput.- Parameters:
source- The input object to test for suitability.hints-Hintsto control the accepts internal machinery.- Returns:
- True if this format can read this object, False otherwise.
-
equals
public boolean equals(Format f)
- See Also:
org.geotools.data.coverage.grid.Format#equals(org.geotools.data.coverage.grid.Format)
-
getReadParameters
public ParameterValueGroup getReadParameters()
Description copied from interface:FormatRetrieve the parameter information for areadoperation.- Specified by:
getReadParametersin interfaceFormat
-
getWriteParameters
public ParameterValueGroup getWriteParameters()
Description copied from interface:FormatRetrieve the parameter information for awriteoperation.- Specified by:
getWriteParametersin interfaceFormat
-
getDefaultCRS
public static CoordinateReferenceSystem getDefaultCRS()
getDefaultCRSThis method provides the user with a default crs WGS84
-
getDefaultImageIOWriteParameters
public abstract GeoToolsWriteParams getDefaultImageIOWriteParameters()
Returns an instance ofImageWriteParamthat can be used to control a subsequentGridCoverageWriter.write(org.geotools.api.coverage.grid.GridCoverage, org.geotools.api.parameter.GeneralParameterValue[]);Be careful with using the
ImageWriteParamsince their usage is still experimental.- Returns:
- an instance of
ImageWriteParam.
-
getWriter
public abstract GridCoverageWriter getWriter(Object destination, Hints hints)
Call the accepts() method before asking for a writer to determine if the current object is supported.- Parameters:
destination- the destination object to write a WorldImage tohints-Hintsto control the internal machinery.- Returns:
- a new WorldImageWriter for the destination
-
-