org.ka2ddo.yaac.srtm
Class SRTMTile

java.lang.Object
  extended by org.ka2ddo.yaac.srtm.SRTMTile

public class SRTMTile
extends java.lang.Object

This class defines the in-memory cache entry for one SRTM binary tile (1 arc-second or 3 arc-second variations).


Field Summary
 short maxGradient
          The maximum change in elevation between any two adjacent cells, in meters.
 short maxZ
          The highest elevation in this tile, in meters.
 int minLat
          The integer latitude (in whole degrees) of the southwest corner of the tile.
 int minLon
          The integer longitude (in whole degrees) of the southwest corner of the tile.
 short minZ
          The lowest elevation in this tile, in meters.
static short NO_CELL
          Reserved value indicating the elevation at the specified grid point is unknown.
 short numCellsPerAxis
          The number of grid cells + 1 in this tile.
 short[][] zCells
          The two-dimensional grid of regularly spaced elevation values (separated by 1 degree / (numCellsPerAxis - 1)), The first index is along the latitude axis, with index 0 at the southernmost latitude, and the second index is along the longitude axis, with index 0 at the westernmost longitude.
 
Constructor Summary
SRTMTile()
           
 
Method Summary
 int getSize()
          Report the amount of memory consumed by this tile.
 void loadGzip(java.io.File srtmFile, int lat, int lon)
          Read a tile file into this in-memory data structure
 void loadZip(java.io.File srtmFile, int lat, int lon)
          Read a zipped tile file into this in-memory data structure
 void setCoord(SRTMTileId id)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minLat

public int minLat
The integer latitude (in whole degrees) of the southwest corner of the tile.


minLon

public int minLon
The integer longitude (in whole degrees) of the southwest corner of the tile.


numCellsPerAxis

public short numCellsPerAxis
The number of grid cells + 1 in this tile. For 3-arc-second tiles, this will be 1201.


maxGradient

public short maxGradient
The maximum change in elevation between any two adjacent cells, in meters.


minZ

public short minZ
The lowest elevation in this tile, in meters.


maxZ

public short maxZ
The highest elevation in this tile, in meters.


zCells

public short[][] zCells
The two-dimensional grid of regularly spaced elevation values (separated by 1 degree / (numCellsPerAxis - 1)), The first index is along the latitude axis, with index 0 at the southernmost latitude, and the second index is along the longitude axis, with index 0 at the westernmost longitude.


NO_CELL

public static final short NO_CELL
Reserved value indicating the elevation at the specified grid point is unknown.

See Also:
Constant Field Values
Constructor Detail

SRTMTile

public SRTMTile()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setCoord

public void setCoord(SRTMTileId id)

loadZip

public void loadZip(java.io.File srtmFile,
                    int lat,
                    int lon)
             throws java.io.IOException
Read a zipped tile file into this in-memory data structure

Parameters:
srtmFile - File object describing the file to read
lat - latitude in whole degrees North for the tile
lon - longitude in whole degrees East for the tile
Throws:
java.io.IOException - if the file could not be successfully read for any reason

loadGzip

public void loadGzip(java.io.File srtmFile,
                     int lat,
                     int lon)
              throws java.io.IOException
Read a tile file into this in-memory data structure

Parameters:
srtmFile - File object describing the file to read
lat - latitude in whole degrees North for the tile
lon - longitude in whole degrees East for the tile
Throws:
java.io.IOException - if the file could not be successfully read for any reason

getSize

public int getSize()
Report the amount of memory consumed by this tile. Can be used to dynamically size the cache of SRTMTiles to prevent heap overload. This estimate is based on the behavior of 32-bit JVM memory management.

Returns:
estimated heap consumption of this SRTMTile and its sub-objects in bytes