|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jwo.landserf.process.io.FileIO jwo.landserf.process.io.BinRasterIO
public class BinRasterIO
Contains a collection of static methods for reading and writing binary raster files.
Field Summary |
---|
Fields inherited from class jwo.landserf.process.io.FileIO |
---|
BIG_ENDIAN, bitsPerValue, byteOrder, DEBUG, 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 a world file containing the affine transformation that adds georeferencing to a raster file. |
static Projection |
readProjection(String fileName)
Creates a projection object based on a 'prj' file. |
static RasterMap |
readRaster(String fileName,
int fileFormat,
GISFrame gisFrame,
LSThread lsThread)
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 image file. |
static boolean |
writeRaster(RasterMap raster,
String fileName,
int fileFormat,
GISFrame gisFrame,
LSThread lsThread)
Writes a binary file in the given format based on the given raster map. |
static boolean |
writeRaster(RasterMap raster,
String fileName,
int fileFormat,
int byteOrder,
int wordSize,
GISFrame gisFrame,
LSThread lsThread)
Writes a binary file in the given format based on the given raster map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinRasterIO()
Method Detail |
---|
public static RasterMap readRaster(String fileName, int fileFormat, GISFrame gisFrame, LSThread lsThread)
fileName
- Name of file to read.fileFormat
- Type of binary file to read (see FileHandler
).gisFrame
- GUI in which to report results.lsThread
- Thread that called this method (allows this to be interrupted).
FileHandler
public static boolean writeRaster(RasterMap raster, String fileName, int fileFormat, GISFrame gisFrame, LSThread lsThread)
FileHandler.BIN_R
.
To avoid the GUI query window call this method with the byte order and word size as 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.lsThread
- Thread that called this method (allows this to be interrupted).
Can be null, in which case, method cannot be interrupted.
FileHandler
public static boolean writeRaster(RasterMap raster, String fileName, int fileFormat, int byteOrder, int wordSize, GISFrame gisFrame, LSThread lsThread)
raster
- Raster map to write out as file.fileName
- Name of file to write.fileFormat
- Type of binary file to write (see FileHandler
).byteOrder
- If fileFormat
is FileHandler.BIN_R
, this should
be either BIG_ENDIAN
or LITTLE_ENDIAN
.wordSize
- If fileFormat
is FileHandler.BIN_R
, this indicates
the number of bytes per cell. If zero, a GUI query window will request byte order
and word size from user.gisFrame
- GUI in which to report results.lsThread
- Thread that called this method (allows this to be interrupted).
Can be null, in which case, method cannot be interrupted.
FileHandler
public static Footprint readGeoW(String rasterFileName, int rasterHeight)
.bil
or .tif
files.
It has also become a de facto standard for attaching geographic metadata to
arbitrary raster files. The file name should be the same as the 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
.
rasterFileName
- Name of raster to georeference.rasterHeight
- Height of raster (needed to transform top-left to bottom left origin).
public static boolean writeGeoW(String rasterFileName, Footprint bounds, float xRes, float yRes)
.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
,
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.
public static Projection readProjection(String fileName)
.prj
extension, but this routine
will look for a file with the same base and >code>.prj extension. Presently only
supports a limited set of projection types. If the projection
information is not supported, null is returned.
fileName
- Name of file associated with projection (the name without
extension is used to find .prj
file name).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |