Class GrassBinaryRasterWriteHandler
Object
GrassBinaryRasterWriteHandler
- All Implemented Interfaces:
Closeable
,AutoCloseable
Grass binary data input/ouput handler.
Reading and writing is supported.
- Since:
- 3.0
- Author:
- Andrea Antonello (www.hydrologis.com)
- See Also:
-
GrassBinaryImageReader
GrassBinaryImageReadParam
GrassBinaryImageMetadata
-
Constructor Summary
ConstructorsConstructorDescriptionGrassBinaryRasterWriteHandler
(File destMapset, String newMapName, ProgressListener monitor) A constructor to build aGrassBinaryRasterWriteHandler
usable for writing grass rasters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
sets the abortrequired flag to true.void
close()
Closes the I/O streams.getCrs()
Reads the crs definition for the map.double
Getter for the noData value.Calculates the region that is going to be written.boolean
Getter for the abortrequired flag.void
setNoData
(double noData) Setter for the noData value.void
setWriteRegion
(JGrassRegion writeRegion) void
writeRaster
(RenderedImage renderedImage, int columns, int rows, double west, double south, double xRes, double yRes, double noDataValue) Writes the raster, given an raster iterator and region metadata.
-
Constructor Details
-
GrassBinaryRasterWriteHandler
A constructor to build aGrassBinaryRasterWriteHandler
usable for writing grass rasters.- Parameters:
destMapset
- the mapset file into which the map has to be written.newMapName
- the name for the written map.
-
-
Method Details
-
writeRaster
public void writeRaster(RenderedImage renderedImage, int columns, int rows, double west, double south, double xRes, double yRes, double noDataValue) throws IOException Writes the raster, given an raster iterator and region metadata.- Parameters:
renderedImage
- theRenderedImage
to write.columns
- the columns of the raster to write.rows
- the rows of the raster to write.west
- the western bound of the raster to write.south
- the southern bound of the raster to write.xRes
- the east-west resolution of the raster to write.yRes
- the north-south resolution of the raster to write.noDataValue
- the value representing noData.- Throws:
IOException
-
getWriteRegion
Calculates the region that is going to be written.- Returns:
- the region that will be written by this Writer.
- Throws:
IOException
-
setWriteRegion
-
close
Closes the I/O streams.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
setNoData
public void setNoData(double noData) Setter for the noData value.- Parameters:
noData
- the nodata value to set.
-
getNoData
public double getNoData()Getter for the noData value.- Returns:
- the nodata value.
-
getCrs
Reads the crs definition for the map.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.
- Returns:
- the
CoordinateReferenceSystem
for the map. Null if it is not defined. - Throws:
IOException
- if there were problems in parsing the CRS file.
-
abort
public void abort()sets the abortrequired flag to true.As soon as possible that should abort the reader.
-
isAborting
public boolean isAborting()Getter for the abortrequired flag.- Returns:
- the abortRequired flag.
-