public class GrassBinaryRasterReadHandler extends Object
Reading and writing is supported.
GrassBinaryImageReader
,
GrassBinaryImageReadParam
,
GrassBinaryImageMetadata
Constructor and Description |
---|
GrassBinaryRasterReadHandler(File cellFile)
the constructor to build a
GrassBinaryRasterReadHandler usable for reading grass
rasters. |
Modifier and Type | Method and Description |
---|---|
void |
abort()
sets the abortrequired flag to true.
|
void |
close()
closes the I/O streams.
|
List<String> |
getCategories()
Getter for the categories.
|
List<String> |
getColorRules(double[] range)
Getter for the colorrules.
|
CoordinateReferenceSystem |
getCrs()
Reads the crs definition for the map.
|
JGrassRegion |
getNativeRasterRegion()
Getter for nativeRasterRegion.
|
double |
getNoData()
Getter for the noData value.
|
double[] |
getRange() |
int |
getRasterMapHeight() |
int |
getRasterMapWidth() |
SampleModel |
getSampleModel()
returns the
SampleModel compatible with the WritableRaster . |
boolean |
isAborting()
Getter for the abortrequired flag.
|
void |
parseHeaderAndAccessoryFiles()
Determines the metadata of the raster map.
|
WritableRaster |
readRaster(ImageReadParam param)
reads a grass raster, given the read parameters.
|
WritableRaster |
readRaster(ImageReadParam param,
boolean useSubSamplingAsRequestedRowcols,
boolean castDoubleToFloating,
ProgressListener monitor)
Reads a grass raster, adding the possibility to override subsampling.
|
void |
setNoData(double noData)
Setter for the noData value.
|
public GrassBinaryRasterReadHandler(File cellFile)
GrassBinaryRasterReadHandler
usable for reading grass
rasters.cellFile
- the file of the raw raster data.public WritableRaster readRaster(ImageReadParam param, boolean useSubSamplingAsRequestedRowcols, boolean castDoubleToFloating, ProgressListener monitor) throws IOException, DataFormatException
param
- the read parameters.useSubSamplingAsRequestedRowcols
- a flag that gives the possibility to bypass the
imageio subsampling mechanism. With GRASS maps this is often more performing 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=180monitor
- raster
IOException
DataFormatException
public WritableRaster readRaster(ImageReadParam param) throws IOException, DataFormatException
The data are read into a single banded, floating point WritableRaster
. A RectIter
can be used to access the data afterwards.
param
- the read parameters.IOException
DataFormatException
public void parseHeaderAndAccessoryFiles() throws IOException
Reads the map type given a file and its mapset, the information from the header file in the cellhd directory and determines the geographic limits, format of the data, etc from the file. NOTE: for further informations about cell header files, read the package description.
INFO: this is a reader method.
IOException
public JGrassRegion getNativeRasterRegion()
INFO: this is a reader method.
public List<String> getColorRules(double[] range) throws IOException
INFO: this is a reader method.
IOException
public List<String> getCategories() throws IOException
INFO: this is a reader method.
IOException
public void close() throws IOException
IOException
public void abort()
As soon as possible that should abort the reader.
public boolean isAborting()
public void setNoData(double noData)
noData
- the nodata value to set.public double getNoData()
public CoordinateReferenceSystem getCrs() throws IOException
The definition for grass maps is held in the location. Grass projection definitions are usually in a non parsable internal format. In JGrass we ask the user to choose the CRS. If the user doesn't do so, the CRS will result to be undefined.
CoordinateReferenceSystem
for the map. Null if it is not defined.IOException
- if there were problems in parsing the CRS file.public SampleModel getSampleModel()
SampleModel
compatible with the WritableRaster
.public int getRasterMapWidth()
public int getRasterMapHeight()
public double[] getRange()
Copyright © 1996–2019 Geotools. All rights reserved.