Class TLcdDTEDDirectoryModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
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 tofalse
, a less accurate ellipsoidal datum WGS72 or WGS84 will be used.
Model elements
- Each decoded model contains one object: an
ALcdImage
(andILcdMultilevelRaster
) instance. The object by default contains DTED levels 0, 1, and 2. - The contained
ILcdRaster
instances that correspond to DTED levels in turn containTLcdDTEDTile
s that correspond to DTED cells and that point to additional information about the cells (only ifcheckTilesImmediately
istrue
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
andauto-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 totrue
). If that fails, the raster will try to find a corresponding lower resolution DTED file (unless thefallBackOnLowerResolution
property is set tofalse
). - 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
andmaxLevel
properly can help avoiding unnecessarily looking for DTED cells at levels that are not available. - Setting the property
checkTilesImmediately
totrue
may slow down the initial decoding, especially if many cells have to be accessed across a slow network connection. - Setting the property
fallBackOnHigherResolution
totrue
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 totrue
.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The sampling strategy that returns the average value of the corners of each DTED sample cell.static final int
The sampling strategy that returns a bilinear interpolation of the values of the corners of each DTED sample cell.static final String
static final String
static final int
The sampling strategy that returns the maximum value of the corners of each DTED sample cell.static final int
The sampling strategy that returns the minimum value of the corners of each DTED sample cell.static final int
The sampling strategy that returns the North-East corner of each DTED sample cell.static final int
The sampling strategy that returns the North-West corner of each DTED sample cell.static final String
static final int
The sampling strategy that returns the South-East corner of each DTED sample cell.static final int
The sampling strategy that returns the South-West corner of each DTED sample cell. -
Constructor Summary
ConstructorDescriptionCreates a model decoder to decode directories containing DTED files spanning the entire globe, with a globally shared buffer for caching tiles.TLcdDTEDDirectoryModelDecoder
(ILcdBuffer aBuffer) Creates a model decoder to decode directories containing DTED files spanning the entire globe.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.TLcdDTEDDirectoryModelDecoder
(ILcdBuffer aBuffer, ILcdBounds aBounds) Creates a model decoder to decode directories containing DTED files.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. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data by decoding the DTED files found in the given directory.decodeModelMetadata
(String aSourceName) Decodes metadata for the specified DTED directory.Returns the region of data that is decoded.Returns the color model that is attached to decodedILcdRaster
's.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the input stream factory that is used for creating input streams given source names.int
int
int
boolean
boolean
Returns whether the data bounds are automatically detected or not.boolean
boolean
boolean
boolean
Returns whether the geodetic datums of the model references may be geoid datums.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.void
setAutoDetectBounds
(boolean aAutoDetectBounds) Enables or disables auto-detection of the data bounds.void
setBounds
(ILcdBounds aBounds) Sets the bounds of the DTED raster to be decoded.void
setCheckTilesImmediately
(boolean aCheckTilesImmediately) Specifies whether the DTED tiles should be checked immediately or lazily.void
setColorModel
(ColorModel aColorModel) Sets the color model that is attached to decodedILcdRaster
's.void
setFallBackOnHigherResolution
(boolean aFallBackOnHigherResolution) Specifies whether to fall back on higher resolution DTED files if a file at some level cannot be found.void
setFallBackOnLowerResolution
(boolean aFallBackOnLowerResolution) Specifies whether to fall back on lower resolution DTED files if a file at some level cannot be found.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for creating input streams given source names.void
setLevel0Extension
(String aLevel0Extension) Sets the extension for DTED level 0 files.void
setMaxLevel
(int aMaxLevel) Sets the maximum DTED level that is decoded.void
setMinLevel
(int aMinLevel) Sets the minimum DTED level that is decoded.void
setSampleStrategy
(int aSampleStrategy) Sets the sampling strategy for retrieving elevation values.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).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
DEFAULT_DISPLAY_NAME
- See Also:
-
SHADING_DISPLAY_NAME
- See Also:
-
DEFAULT_EXTENSION
- See Also:
-
NORTH_WEST_CORNER
public static final int NORTH_WEST_CORNERThe sampling strategy that returns the North-West corner of each DTED sample cell.- See Also:
-
SOUTH_WEST_CORNER
public static final int SOUTH_WEST_CORNERThe sampling strategy that returns the South-West corner of each DTED sample cell.- See Also:
-
NORTH_EAST_CORNER
public static final int NORTH_EAST_CORNERThe sampling strategy that returns the North-East corner of each DTED sample cell.- See Also:
-
SOUTH_EAST_CORNER
public static final int SOUTH_EAST_CORNERThe sampling strategy that returns the South-East corner of each DTED sample cell.- See Also:
-
MINIMUM
public static final int MINIMUMThe sampling strategy that returns the minimum value of the corners of each DTED sample cell.- See Also:
-
MAXIMUM
public static final int MAXIMUMThe sampling strategy that returns the maximum value of the corners of each DTED sample cell.- See Also:
-
AVERAGE
public static final int AVERAGEThe sampling strategy that returns the average value of the corners of each DTED sample cell.- See Also:
-
BILINEAR
public static final int BILINEARThe 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
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
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
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
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
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 ifbounds auto-detection
is enabled.- Parameters:
aBounds
- the region to decode- See Also:
-
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 bygetBounds()
. 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
- 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
Sets the input stream factory that will be used for creating input streams given source names.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.
-
getInputStreamFactory
Returns the input stream factory that is used for creating input streams given source names.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is used.
-
setColorModel
Sets the color model that is attached to decodedILcdRaster
's.- Parameters:
aColorModel
- a 16-bit IndexColorModel
-
getColorModel
Returns the color model that is attached to decodedILcdRaster
'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 ofTLcdDTEDTile
, which contain instances ofTLcdDTEDModelDescriptor
. 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 isfalse
. -
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 istrue
. -
isFallBackOnLowerResolution
public boolean isFallBackOnLowerResolution() -
setLevel0Extension
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
-
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 theILcdRaster
API. TheALcdImage
API explicitly models DTED data as being point-sampled and will ignore this setting.- Parameters:
aSampleStrategy
- one ofNORTH_WEST_CORNER
,SOUTH_WEST_CORNER
,NORTH_EAST_CORNER
,SOUTH_EAST_CORNER
,MINIMUM
,MAXIMUM
,AVERAGE
, orBILINEAR
.
-
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
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
canDecodeSource
Description copied from interface:ILcdModelDecoder
Checks whether this model decoder can decode the specified data source. It is acceptable for this method to returntrue
for a source name whiledecode
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 interfaceILcdModelDecoder
- 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
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 interfaceILcdModelDecoder
- 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
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 withTLcdModelMetadata.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 interfaceILcdModelDecoder
- 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:
-