Package org.ka2ddo.yaac.srtm
Class SRTMTileManager
java.lang.Object
org.ka2ddo.yaac.srtm.SRTMTileManager
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 TypeMethodDescriptionvoid
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.static SRTMTileManager
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.
-
Method Details
-
getInstance
Get the reference to the singleton SRTMTileManager object.- Returns:
- SRTMTileManager instance
-
getTile
Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.- Parameters:
latitude
- int latitude in millionths of degrees Northlongitude
- int longitude in millionths of degrees East- Returns:
- SRTMTile object containing elevation data for the specified latitude/longitude
-
getTile
Get a SRTMTile object for the 1-degree by 1-degree region of the planet requested.- Parameters:
latitude
- double latitude in fractional degrees Northlongitude
- 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 Northlongitude
- 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 kilometerslat
- center latitude of region to download in fractional degrees Northlon
- center longitude of region to download in fractional degrees EasthiRes
- boolean true if 1-arc-second tiles should be downloaded where available (currently ignored)
-