jwo.landserf.process.io
Class BinRasterIO

java.lang.Object
  extended byjwo.landserf.process.io.FileIO
      extended byjwo.landserf.process.io.BinRasterIO

public class BinRasterIO
extends FileIO

Contains a collection of static methods for reading and writing binary raster files.

Version:
2.1 25th August, 2004.
Author:
Jo Wood

Field Summary
 
Fields inherited from class jwo.landserf.process.io.FileIO
BIG_ENDIAN, bitsPerValue, byteOrder, errorMessage, filePointer, GATHER_INFO, lineNumber, LITTLE_ENDIAN, LOAD_ALL, LOAD_SELECTED, nullCode, substituteNull, useMultiplier, zMultiplier
 
Constructor Summary
BinRasterIO()
          There should be no need to call the constructor explicitly since all methods are static.
 
Method Summary
static Footprint readGeoW(String rasterFileName, int rasterHeight)
          Reads an 'Xlw' file containing the affine transformation that adds georeferencing to a binary raster file.
static RasterMap readRaster(String fileName, int fileFormat, GISFrame gisFrame)
          Reads a binary file in the given format and creates a raster map from it.
static boolean writeGeoW(String rasterFileName, Footprint bounds, float xRes, float yRes)
          Writes a 'world' file containing the affine transformation that adds georeferencing to a binary raster or imagefile.
static boolean writeRaster(RasterMap raster, String fileName, int fileFormat, GISFrame gisFrame)
          Writes a binary file in the given format based on the given raster map.
 
Methods inherited from class jwo.landserf.process.io.FileIO
getErrorMessage, readByte, readByte, readCharacters, readDouble, readDouble, readDoubleBigEndian, readDoubleBigEndian, readDoubleLittleEndian, readDoubleLittleEndian, readFloat, readFloat, readFloatBigEndian, readFloatBigEndian, readFloatLittleEndian, readFloatLittleEndian, readInt, readInt, readIntBigEndian, readIntBigEndian, readIntLittleEndian, readIntLittleEndian, readNextWord, readShort, readShort, readShortBigEndian, readShortBigEndian, readShortLittleEndian, readShortLittleEndian, reset, seek, skip, skip, writeByte, writeCharacters, writeDouble, writeDoubleBigEndian, writeDoubleLittleEndian, writeFloat, writeFloatBigEndian, writeFloatLittleEndian, writeInt, writeIntBigEndian, writeIntLittleEndian, writeLine, writeShort, writeShortBigEndian, writeShortLittleEndian
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinRasterIO

public BinRasterIO()
There should be no need to call the constructor explicitly since all methods are static.

Method Detail

readRaster

public static RasterMap readRaster(String fileName,
                                   int fileFormat,
                                   GISFrame gisFrame)
Reads a binary file in the given format and creates a raster map from it.

Parameters:
fileName - Name of file to read.
fileFormat - Type of binary file to read (see FileHandler).
gisFrame - GUI in which to report results.
Returns:
Raster map containing read data, or null if problems reading.
See Also:
FileHandler

writeRaster

public static boolean writeRaster(RasterMap raster,
                                  String fileName,
                                  int fileFormat,
                                  GISFrame gisFrame)
Writes a binary file in the given format based on the given raster map.

Parameters:
raster - Raster map to write out as file.
fileName - Name of file to write.
fileFormat - Type of binary file to write (see FileHandler)..
gisFrame - GUI in which to report results.
Returns:
True if file written successfully.
See Also:
FileHandler

readGeoW

public static Footprint readGeoW(String rasterFileName,
                                 int rasterHeight)
Reads an 'Xlw' file containing the affine transformation that adds georeferencing to a binary raster file. This is used by ArcGIS when generating binary rasters such as .bil or .tif files. The file name should be the same as the binary file to transform, with the same first and last letters as the extension, with 'w' appended to it. For example, image.tif would be associated with image.tfw, map.bil would be associated with map.blw.

Parameters:
rasterFileName - Name of raster to georeference.
rasterHeight - Height of raster (needed to transform top-left to bottom left origin).
Returns:
Location and size of origin pixel or null if problem reading file.

writeGeoW

public static boolean writeGeoW(String rasterFileName,
                                Footprint bounds,
                                float xRes,
                                float yRes)
Writes a 'world' file containing the affine transformation that adds georeferencing to a binary raster or imagefile. This is used by ArcGIS when generating binary rasters such as .bil or .tif files. The file name will be the same as the binary file to transform, with the same first and last letters as the extension, with 'w' appended to it. For example, image.tif would be associated with image.tfw, map.bil would be associated with map.blw.

Parameters:
rasterFileName - Name of raster to georeference.
bounds - Georeferenced bounds used to calculate transformation.
xRes - x Resolution of single raster cell.
yRes - y Resolution of single raster cell.
Returns:
True if written successfully.


Copyright Jo Wood, 1996-2004, last modified, 3rd September, 2004