Class TLcdDTEDDirectoryModelDecoder

java.lang.Object
com.luciad.format.raster.TLcdDTEDDirectoryModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdDTEDDirectoryModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This model decoder decodes directories containing DTED (Digital Terrain Elevation Data) files.

Input files

File Required Entry point Description
dted/[we]???/[sn]??.dt[012] x x DTED files containing elevations

Supported file transfer protocols

  • This model decoder only decodes data from a file system.

Model structure

  • This model decoder creates a model per DTED directory structure.
  • All models returned by this model decoder implement ILcd2DBoundsIndexedModel.

Model descriptor

  • All models returned by this model decoder have a TLcdDMEDModelDescriptor.
  • The type name of the model descriptor is the display name of this decoder.

Model reference

  • All models returned by this model decoder have an ILcdGeodeticReference as a model reference.
  • The geodetic datum of this reference is geoid datum EGM96. if supportGeoidDatums is set to false, a less accurate ellipsoidal datum WGS72 or WGS84 will be used.

Model elements

  • Each decoded model contains one object: an ALcdImage (and ILcdMultilevelRaster) instance. The object by default contains DTED levels 0, 1, and 2.
  • The contained ILcdRaster instances that correspond to DTED levels in turn contain TLcdDTEDTiles that correspond to DTED cells and that point to additional information about the cells (only if checkTilesImmediately is true and for cells that are present).
  • The decoded elevation data is always point-sampled. This is however only exposed via the ALcdImage interface. Legacy rasters are assumed to be area-sampled.

Useful settings

  • The bounds and auto-detect bounds properties can be used to adjust the decoded region.
  • The checkTilesImmediately property allows to specify whether the presence of the DTED cells should be checked right away when the model is decoded. If so, only DTED levels that are present will be created. Otherwise, all levels will be created, even though their contents may be empty when the elevation data are accessed.
  • If a DTED file is missing at some level, the raster may try to find a corresponding higher resolution DTED file (if the fallBackOnHigherResolution property is set to true). If that fails, the raster will try to find a corresponding lower resolution DTED file (unless the fallBackOnLowerResolution property is set to false).
  • The property level0Extension allows to specify which extension should be used for DTED level 0.

Sample code

Consider to instance a data directory containing the following subdirectories and files:

 dted/e001/n52.dt0
 dted/e001/n53.dt0
 dted/e000/n52.dt0
 dted/e000/n53.dt0
 dted/w001/n52.dt0
 dted/w001/n53.dt0
 

This data set can be decoded with:


 TLcdDTEDDirectoryModelDecoder decoder =
   new TLcdDTEDDirectoryModelDecoder(TLcdSharedBuffer.getBufferInstance(),
                                     new TLcdLonLatBounds(-1.0, 52.0, 3.0, 2.0));

 ILcdModel model = decoder.decode("dted");
 

Performance tips

  • Setting the properties minLevel and maxLevel properly can help avoiding unnecessarily looking for DTED cells at levels that are not available.
  • Setting the property checkTilesImmediately to true may slow down the initial decoding, especially if many cells have to be accessed across a slow network connection.
  • Setting the property fallBackOnHigherResolution to true may introduce a significant overhead, since higher resolution cells are considerably larger than the lower resolution counterparts that they are replacing.

Thread safety

  • The decoding of models is thread-safe, as long as no properties are changed during the decoding.
  • The decoded models and elements are thread-safe for read access, on the condition that a thread-safe buffer is used.

Supported versions and specifications

  • MIL-D-89020B, Digital Terrain Elevation Data (DTED), NIMA, 23 May 2000

Known limitations

  • The use of the geodetic datum WGS 72 in DTED tiles is only detected when the property checkTilesImmediately is set to true.
See Also:
  • Field Details

    • DEFAULT_DISPLAY_NAME

      public static final String DEFAULT_DISPLAY_NAME
      See Also:
    • SHADING_DISPLAY_NAME

      public static final String SHADING_DISPLAY_NAME
      See Also:
    • DEFAULT_EXTENSION

      public static final String DEFAULT_EXTENSION
      See Also:
    • NORTH_WEST_CORNER

      public static final int NORTH_WEST_CORNER
      The sampling strategy that returns the North-West corner of each DTED sample cell.
      See Also:
    • SOUTH_WEST_CORNER

      public static final int SOUTH_WEST_CORNER
      The sampling strategy that returns the South-West corner of each DTED sample cell.
      See Also:
    • NORTH_EAST_CORNER

      public static final int NORTH_EAST_CORNER
      The sampling strategy that returns the North-East corner of each DTED sample cell.
      See Also:
    • SOUTH_EAST_CORNER

      public static final int SOUTH_EAST_CORNER
      The sampling strategy that returns the South-East corner of each DTED sample cell.
      See Also:
    • MINIMUM

      public static final int MINIMUM
      The sampling strategy that returns the minimum value of the corners of each DTED sample cell.
      See Also:
    • MAXIMUM

      public static final int MAXIMUM
      The sampling strategy that returns the maximum value of the corners of each DTED sample cell.
      See Also:
    • AVERAGE

      public static final int AVERAGE
      The sampling strategy that returns the average value of the corners of each DTED sample cell.
      See Also:
    • BILINEAR

      public static final int BILINEAR
      The sampling strategy that returns a bilinear interpolation of the values of the corners of each DTED sample cell.
      See Also:
  • Constructor Details

    • TLcdDTEDDirectoryModelDecoder

      public TLcdDTEDDirectoryModelDecoder()
      Creates a model decoder to decode directories containing DTED files spanning the entire globe, with a globally shared buffer for caching tiles.
      See Also:
    • TLcdDTEDDirectoryModelDecoder

      public TLcdDTEDDirectoryModelDecoder(ILcdBuffer aBuffer)
      Creates a model decoder to decode directories containing DTED files spanning the entire globe.
      Parameters:
      aBuffer - the buffer in which decoded raster tiles are cached.
    • TLcdDTEDDirectoryModelDecoder

      public TLcdDTEDDirectoryModelDecoder(ILcdBuffer aBuffer, ILcdBounds aBounds)
      Creates a model decoder to decode directories containing DTED files.
      Parameters:
      aBuffer - the buffer in which decoded raster tiles are cached.
      aBounds - the bounds within which DTED files are considered.
    • TLcdDTEDDirectoryModelDecoder

      public TLcdDTEDDirectoryModelDecoder(ILcdBuffer aBuffer, boolean aShading)
      Creates a model decoder to decode directories containing DTED files spanning the entire globe, optionally producing shaded rasters instead of elevation rasters.
      Parameters:
      aBuffer - the buffer in which decoded raster tiles are cached.
      aShading - specifies whether rasters should be shaded.
    • TLcdDTEDDirectoryModelDecoder

      public TLcdDTEDDirectoryModelDecoder(ILcdBuffer aBuffer, ILcdBounds aBounds, boolean aShading)
      Creates a model decoder to decode directories containing DTED files, optionally producing shaded rasters instead of elevation rasters.
      Parameters:
      aBuffer - the buffer in which decoded raster tiles are cached.
      aBounds - the bounds within which DTED files are considered.
      aShading - specifies whether rasters should be shaded.
  • Method Details

    • setBounds

      public void setBounds(ILcdBounds aBounds)
      Sets the bounds of the DTED raster to be decoded.

      If necessary, the bounds will be extended to integer values, as all DTED files are aligned on a grid with 1 degree by 1 degree cells.

      This can be used to limit the region of data that is decoded. The actually decoded region may be smaller if bounds auto-detection is enabled.

      Parameters:
      aBounds - the region to decode
      See Also:
    • getBounds

      public ILcdBounds getBounds()
      Returns the region of data that is decoded.

      The default value is the whole world.

      Returns:
      the region that is decoded
      See Also:
    • setAutoDetectBounds

      public void setAutoDetectBounds(boolean aAutoDetectBounds)
      Enables or disables auto-detection of the data bounds.

      If this feature is enabled, then the model decoder will attempt to detect the available data in the specified directory and adjust the domain object's bounds accordingly. The decoded data is still limited by getBounds().

      Typically auto-detection of bounds only succeeds if the source name is:

      • an absolute file path
      • a file path relative to the current directory
      • a file path relative to the class path

      Auto-detection is enabled by default.

      Parameters:
      aAutoDetectBounds - true if the bounds should be auto-detected
    • isAutoDetectBounds

      public boolean isAutoDetectBounds()
      Returns whether the data bounds are automatically detected or not.
      Returns:
      true if the data bounds are automatically detected
      See Also:
    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Sets the input stream factory that will be used for creating input streams given source names.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the input stream factory to be used.
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Returns the input stream factory that is used for creating input streams given source names.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the input stream factory that is used.
    • setColorModel

      public void setColorModel(ColorModel aColorModel)
      Sets the color model that is attached to decoded ILcdRaster's.
      Parameters:
      aColorModel - a 16-bit IndexColorModel
    • getColorModel

      public ColorModel getColorModel()
      Returns the color model that is attached to decoded ILcdRaster's.
    • setMinLevel

      public void setMinLevel(int aMinLevel)
      Sets the minimum DTED level that is decoded. The default is 0.
    • getMinLevel

      public int getMinLevel()
    • setMaxLevel

      public void setMaxLevel(int aMaxLevel)
      Sets the maximum DTED level that is decoded. The default is 2.
    • getMaxLevel

      public int getMaxLevel()
    • setCheckTilesImmediately

      public void setCheckTilesImmediately(boolean aCheckTilesImmediately)
      Specifies whether the DTED tiles should be checked immediately or lazily.

      If true, the decoded multi-level rasters will only contain the DTED levels that are actually present. In addition, the tiles will be instances of TLcdDTEDTile, which contain instances of TLcdDTEDModelDescriptor. If any DTED files cannot be found, the tiles may fall back on higher or lower levels.

      If false, the decoded multi-level rasters will contain all DTED levels (0, 1, and 2). If any DTED files cannot be found later on, when elevation data are actually requested, the tiles may still fall back on higher or lower levels.

      The default is false.

      See Also:
    • isCheckTilesImmediately

      public boolean isCheckTilesImmediately()
    • setFallBackOnHigherResolution

      public void setFallBackOnHigherResolution(boolean aFallBackOnHigherResolution)
      Specifies whether to fall back on higher resolution DTED files if a file at some level cannot be found. The default is false.
    • isFallBackOnHigherResolution

      public boolean isFallBackOnHigherResolution()
    • setFallBackOnLowerResolution

      public void setFallBackOnLowerResolution(boolean aFallBackOnLowerResolution)
      Specifies whether to fall back on lower resolution DTED files if a file at some level cannot be found. The default is true.
    • isFallBackOnLowerResolution

      public boolean isFallBackOnLowerResolution()
    • setLevel0Extension

      public void setLevel0Extension(String aLevel0Extension)
      Sets the extension for DTED level 0 files. The default is "dt0", but common alternatives are "avg", "min", and "max". The values contained in these files are generally computed from DTED level 1 data, so the results are different from (and more accurate than) the results from the corresponding sampling strategies, which are based on the "dt0" data.
      See Also:
    • getLevel0Extension

      public String getLevel0Extension()
    • setSampleStrategy

      public void setSampleStrategy(int aSampleStrategy)
      Sets the sampling strategy for retrieving elevation values. This setting is only relevant when accessing the DTED model via the ILcdRaster API. The ALcdImage API explicitly models DTED data as being point-sampled and will ignore this setting.
      Parameters:
      aSampleStrategy - one of NORTH_WEST_CORNER, SOUTH_WEST_CORNER, NORTH_EAST_CORNER, SOUTH_EAST_CORNER, MINIMUM, MAXIMUM, AVERAGE, or BILINEAR.
    • getSampleStrategy

      public int getSampleStrategy()
    • setSupportGeoidDatums

      public void setSupportGeoidDatums(boolean aSupportGeoidDatums)
      Specifies whether the decoded geodetic datum of the geodetic reference should be a geoid datum (EGM96), or an ellipsoid datum (WGS84 or WGS72). The geoid varies smoothly between -110m and +90m around the ellipsoid. The geoid datum is more accurate, but it requires more memory and more processing time when it is being used in transformation calculations.

      The default value is true.

    • isSupportGeoidDatums

      public boolean isSupportGeoidDatums()
      Returns whether the geodetic datums of the model references may be geoid datums.

      The default value is true.

    • setApplyGeoidDatums

      public void setApplyGeoidDatums(boolean aApplyGeoidDatums)
      Specifies whether the geoid heights of the geodetic datum (EGM96) should be added to the elevation data right away while decoding. The geoid varies smoothly between -110m and +90m around the ellipsoid. The geodetic datum of the geodetic reference will then be an ordinary ellipsoid datum (WGS84 or WGS72). Decoded rasters will be more accurate, but the operation requires more memory and more processing time while decoding the elevation data (which is still done lazily).

      This is an alternative to setSupportGeoidDatums(boolean). It has precedence if both options are set.

      Note that the 0m elevation (sea level) becomes the geoid height, which may be confusing when a raster is displayed with an elevation color model that assigns blue colors to negative elevations.

    • isApplyGeoidDatums

      public boolean isApplyGeoidDatums()
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return true for a source name while decode throws an exception for that same source name.

      For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be verified; typically a file name or a URL.
      Returns:
      true if the given path name ends with a directory named "dted".
      See Also:
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Creates a new model from the given data by decoding the DTED files found in the given directory. Only DTED files within the bounds of this decoder are considered.
      Specified by:
      decode in interface ILcdModelDecoder
      Parameters:
      aSourceName - the path to the main "dted" directory. For example, "ElevationData/dted" may be a valid source name.
      Returns:
      a model containing the decoded data.
      Throws:
      IOException - for any I/O errors.
      See Also:
    • decodeModelMetadata

      public TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
      Decodes metadata for the specified DTED directory. This method will traverse the given directory in order to find and decode metadata for all contained DTED files. These metadata instances can be obtained with TLcdModelMetadata.discoverDataSeries(), without triggering any additional I/O. Note that this method directly accesses the file system, instead of using the decoder's inputstream factory. This also means that the method will fail for sources that are not located on the file system, such as sources served over HTTP.
      Specified by:
      decodeModelMetadata in interface ILcdModelDecoder
      Parameters:
      aSourceName - the DTED directory for which the model metadata will be decoded.
      Returns:
      the model metadata for the data source, never null.
      Throws:
      IOException - if the metadata cannot be decoded for some reason.
      See Also: