Class SRTMTileManager

java.lang.Object
org.ka2ddo.yaac.srtm.SRTMTileManager

public class SRTMTileManager extends Object
This class manages an in-memory cache of SRTMTile objects, as well as providing I/O code to fetch new tiles from the USGS website.
Author:
Andrew Pavlin, KA2DDO
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear cached pointers to tile files.
    short
    getElevation(double latitude, double longitude)
    Get the SRTM elevation at the specified lat/lon coordinates.
    int
    Get an estimate of the amount of memory used by the SRTM tile cache.
    Get the reference to the singleton SRTMTileManager object.
    getTile(double latitude, double longitude)
    Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.
    getTile(int latitude, int longitude)
    Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.
    static void
    loadPrecompiledTiles(double radius, double lat, double lon, boolean hiRes)
    Download NASADEM tiles from the US Geological Survey's LP DAAC website to cover a specified region of the planet.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInstance

      public static SRTMTileManager getInstance()
      Get the reference to the singleton SRTMTileManager object.
      Returns:
      SRTMTileManager instance
    • getTile

      public SRTMTile getTile(int latitude, int longitude)
      Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.
      Parameters:
      latitude - int latitude in millionths of degrees North
      longitude - int longitude in millionths of degrees East
      Returns:
      SRTMTile object containing elevation data for the specified latitude/longitude
    • getTile

      public SRTMTile getTile(double latitude, double longitude)
      Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.
      Parameters:
      latitude - double latitude in fractional degrees North
      longitude - double longitude in fractional degrees East
      Returns:
      SRTMTile object containing elevation data for the specified latitude/longitude
    • getElevation

      public short getElevation(double latitude, double longitude)
      Get the SRTM elevation at the specified lat/lon coordinates.
      Parameters:
      latitude - double latitude in fractional degrees North
      longitude - double longitude in fractional degrees East
      Returns:
      elevation at the tile pixel for the specified coordinates, or NO_CELL if there is no tile for the specified coordinates
    • flushFileCache

      public void flushFileCache()
      Clear cached pointers to tile files. This is called when the configuration dialog changes the tile root directory path.
    • getEstimatedCacheSize

      public int getEstimatedCacheSize()
      Get an estimate of the amount of memory used by the SRTM tile cache.
      Returns:
      estimated byte count used by tiles in memory
    • loadPrecompiledTiles

      public static void loadPrecompiledTiles(double radius, double lat, double lon, boolean hiRes)
      Download NASADEM tiles from the US Geological Survey's LP DAAC website to cover a specified region of the planet. Note these are exactly the same format as SRTM1 tiles from the former unsecured USGS website.
      Parameters:
      radius - radius to cover in kilometers
      lat - center latitude of region to download in fractional degrees North
      lon - center longitude of region to download in fractional degrees East
      hiRes - boolean true if 1-arc-second tiles should be downloaded where available (currently ignored)