jwo.landserf.process.io
Class ShapefileIO

java.lang.Object
  extended by jwo.landserf.process.io.FileIO
      extended by jwo.landserf.process.io.ShapefileIO

public class ShapefileIO
extends FileIO

Collection of methods for reading and writing ESRI shapefiles. The shapefile consists of 3 separate files - name.shp containing the geometry; name.shx containing the file offsets for the components that make up the geometry; and name.dbf containing the attributes. When reading, the index (.shx) file is ignored and the database (.dbf) file is optional.

Version:
2.3, 26th August, 2008.
Author:
Jo Wood

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
ShapefileIO()
          There should be no need to call the constructor explicitly since all methods are static.
 
Method Summary
static VectorMap readVector(String fileName, GISFrame gisFrame, LSThread lsThread)
          Reads the given shapefile (assumes file is called something.shp and that there are also files called something.shx and something.dbf in the same directory.
static boolean writeVector(VectorMap vectorMap, String fileName, GISFrame gisFrame, LSThread lsThread)
          Writes a shapefile based on the supplied vector map.
 
Methods inherited from class jwo.landserf.process.io.FileIO
debug, getErrorMessage, readByte, readByte, readCharacters, readCharacters, readCharactersInLine, readDouble, readDouble, readDoubleBigEndian, readDoubleBigEndian, readDoubleLittleEndian, readDoubleLittleEndian, readFloat, readFloat, readFloatBigEndian, readFloatBigEndian, readFloatLittleEndian, readFloatLittleEndian, readInt, readInt, readIntBigEndian, readIntBigEndian, readIntLittleEndian, readIntLittleEndian, readNextWord, readNextWord, readShort, readShort, readShortBigEndian, readShortBigEndian, readShortLittleEndian, readShortLittleEndian, readUnsignedByte, readUnsignedByte, 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

ShapefileIO

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

Method Detail

readVector

public static VectorMap readVector(String fileName,
                                   GISFrame gisFrame,
                                   LSThread lsThread)
Reads the given shapefile (assumes file is called something.shp and that there are also files called something.shx and something.dbf in the same directory.

Parameters:
fileName - Name of .shp file to process.
gisFrame - GUI in which to report results.
lsThread - Thread that called this method (allows it to be interrupted). Can be null, in which case, method cannot be interrupted.
Returns:
Vector map containing shapefile object(s).

writeVector

public static boolean writeVector(VectorMap vectorMap,
                                  String fileName,
                                  GISFrame gisFrame,
                                  LSThread lsThread)
Writes a shapefile based on the supplied vector map. The given fileName can be supplied with or without an extension, but this method will write three files with the same base and extensions .shp, .shx and .dbf.

Parameters:
vectorMap - Vector map to write.
fileName - Name of core of the three files to create.
gisFrame - GUI in which to report progress.
lsThread - Thread that called this method (allows it to be interrupted). Can be null, in which case, method cannot be interrupted.
Returns:
True if written successfully.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009