jwo.landserf.process.io
Class XmlIO

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

public class XmlIO
extends FileIO

Contains a collection of static methods for reading and writing various XML format files.

Version:
2.3, 11th February, 2009.
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
XmlIO()
          There should be no need to call the constructor explicitly since all methods are static.
 
Method Summary
static VectorMap readGPX(String fileName, GISFrame gisFrame, LSThread lsThread)
          Reads a GPX (GPS interchange format) file and stores the contents as a vector map.
static VectorMap readKML(String fileName, GISFrame gisFrame, LSThread lsThread)
          Reads a KML (Keyhole/Google Earth) vector file and stores the contents as a vector map.
static VectorMap readMasterMapVector(String fileName, GISFrame gisFrame, LSThread lsThread)
          Attempts to read an Ordnance Survey MasterMap XML file (vector format).
static boolean writeGPX(VectorMap vectorMap, String fileName, GISFrame gisFrame, LSThread lsThread)
          Writes a GPX (GPS interchange format) file from the given vector map.
static boolean writeKML(VectorMap vectorMap, String fileName, GISFrame gisFrame, LSThread lsThread)
          Writes a KML vector file from the given vector map.
static boolean writeKMZ(String fileName, GISFrame gisFrame, LSThread lsThread)
          Writes the currently displayed image in gisFrame as a KMZ archive containing a hierarchy of sampled images.
 
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

XmlIO

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

Method Detail

readMasterMapVector

public static VectorMap readMasterMapVector(String fileName,
                                            GISFrame gisFrame,
                                            LSThread lsThread)
Attempts to read an Ordnance Survey MasterMap XML file (vector format).

Parameters:
fileName - Name of file to read.
gisFrame - Frame in which to report results.
lsThread - Thread which called this method (allows it to be interrupted). Can be null if no external interruption allowed.
Returns:
VectorMap holding contents of file, or null if problems reading.

writeGPX

public static boolean writeGPX(VectorMap vectorMap,
                               String fileName,
                               GISFrame gisFrame,
                               LSThread lsThread)
Writes a GPX (GPS interchange format) file from the given vector map. Line objects are are assumed to be tracks and point objects waypoints or trackpoints depending on the attribute in the GPSObject field. Note that if there is no attribute table, or if there is no table with a GPSObject field, all point data will be assumed to be waypoints and all line data assumed to be tracks. To write out a route, the vector map must include an attribute table with a GPSObject field and route points identified with the attribute routepoint. To write out only selected lines as tracks, make sure the vector map includes an attribute table with a GPSObject field and the selected linear objects have a track attribute in that field. See www.topografix.com/gpx_manual.asp and www.topografix.com/gpx.asp.

Parameters:
vectorMap - VectorMap to be written out as GPX file.
fileName - Name of file to create.
gisFrame - GUI in which to report results.
lsThread - Thread that called this method (allowing it to be interrupted). Can be null, in which case this method cannot be interrupted.
Returns:
True if written successfully.
See Also:
FileHandler

readGPX

public static VectorMap readGPX(String fileName,
                                GISFrame gisFrame,
                                LSThread lsThread)
Reads a GPX (GPS interchange format) file and stores the contents as a vector map. See www.topografix.com/gpx_manual.asp and www.topografix.com/gpx.asp.

Parameters:
fileName - Name of file to read.
gisFrame - Frame in which to report results.
lsThread - Thread which called this method (allows it to be interrupted). Can be null if no external interruption allowed.
Returns:
VectorMap holding contents of file, or null if problems reading.

writeKML

public static boolean writeKML(VectorMap vectorMap,
                               String fileName,
                               GISFrame gisFrame,
                               LSThread lsThread)
Writes a KML vector file from the given vector map. Vector map must be in a known projection as output coordinates will be in longitude/latitude (WGS84). Output can be read into Google Earth and used by Google Maps.

Parameters:
vectorMap - VectorMap to be written out as a KML file.
fileName - Name of file to create.
gisFrame - GUI in which to report results.
lsThread - Thread that called this method (allowing it to be interrupted). Can be null, in which case this method cannot be interrupted.
Returns:
True if written successfully.
See Also:
FileHandler

readKML

public static VectorMap readKML(String fileName,
                                GISFrame gisFrame,
                                LSThread lsThread)
Reads a KML (Keyhole/Google Earth) vector file and stores the contents as a vector map. Only point, line, and polygon files with numerical coordinates will be read (address locations will be ignored). 3D objects will only have their (x,y) coordinates read. NOTE: THIS METHOD IS CURRENTLY NOT IMPLEMENTED.

Parameters:
fileName - Name of file to read.
gisFrame - Frame in which to report results.
lsThread - Thread which called this method (allows it to be interrupted). Can be null if no external interruption allowed.
Returns:
VectorMap holding contents of file, or null if problems reading.

writeKMZ

public static boolean writeKMZ(String fileName,
                               GISFrame gisFrame,
                               LSThread lsThread)
Writes the currently displayed image in gisFrame as a KMZ archive containing a hierarchy of sampled images. This allows efficient streaming of raster imagery when displaying file in GoogleEarth. Note that spatial data must be in longitude/latitude (WGS84) to create KMZ file. If not, no file is written and an error message is reported.

Parameters:
fileName - Name of file to create.
gisFrame - GUI from which display is to be stored.
lsThread - Thread that called this method (allowing it to be interrupted). Can be null, in which case this method cannot be interrupted.
Returns:
True if written successfully.
See Also:
FileHandler


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