Class TLcdDMEDModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
Input files
File | Required | Entry point | Description |
---|---|---|---|
dmed | x | x | DMED file referring to DTED files |
dted/[we]???/[sn]??.dt[012] | x | x | DTED files containing the actual elevations |
Supported file transfer protocols
- This model decoder supports all transfer protocols that are supported by
the
inputStreamFactory
of this decoder.
Model structure
- This model decoder creates a model per DMED file.
- 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 instances of
ILcdGeodeticReference
as model references. - The geodetic datum of this reference is an ellipsoidal datum WGS72 or
WGS84, or, if
supportGeoidDatums
is set totrue
, the more accurate geoid datum EGM96. Alternatively, ifapplyGeoidDatums
is set totrue
, the geoid height is already added to the elevations of the rasters, and the geodetic datum is WGS84.
Model elements
- Each decoded model contains one object: an
ALcdImage
(andILcdMultilevelRaster
) instance. The object by default contains the DMED level and 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 DMED level always contains area-sampled data, while all DTED levels
contain point-sampled data. This is however only exposed via the
ALcdImage
interface. Legacy rasters are assumed to be area-sampled.
Useful settings
- The property
colorModel
allows to override the default 16-bits index color that is attached to the decoded rasters, since DMED files and DTED files don't contain any color information. - 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
). - At each DTED level, the decoded raster contains the elevation values from
the corresponding DTED cells. By default, the rasters contain tiles with
piece-wise constant pixel values, without any interpolation (sometimes
referred to as "Pixel-is-Area"). However, the original DTED cells contain
discrete sample points (sometimes referred to as "Pixel-is-Point").
The way in which a tile value is derived from the DTED can be specified
by means of the
sampleStrategy
property. For instance, a tile value can be a corner value, or the minimum, maximum, or average of the four corner values. Furthermore, the raster values can be derived by means of bilinear interpolation. This yields better-looking results, at a higher computational cost. - The property
level0Extension
allows to specify which extension should be used for DTED level 0.
Sample code
TLcdDMEDModelDecoder decoder = new TLcdDMEDModelDecoder();
decoder.setIncludeDMEDLevel(false);
decoder.setMinLevel(0);
decoder.setMaxLevel(1);
decoder.setFallBackOnHigherResolution(true);
decoder.setFallBackOnLowerResolution(true);
ILcdModel model = decoder.decode("dmed");
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
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static 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 DMED files, with a globally shared buffer for caching tiles.TLcdDMEDModelDecoder
(ILcdBuffer aBuffer) Creates a model decoder to decode DMED files.TLcdDMEDModelDecoder
(ILcdBuffer aBuffer, boolean aShading) Creates a model decoder to decode DMED 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 source.decodeModelMetadata
(String aSourceName) Decodes metadata for the specified DMED file.Returns the color model that is attached to decoded rasters.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
boolean
boolean
boolean
boolean
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
setBuffer
(ILcdBuffer aBuffer) Sets the buffer in which decoded raster tiles will be cached.void
setCheckTilesImmediately
(boolean aCheckTilesImmediately) Specifies whether the DMED and DTED tiles should be checked immediately or lazily.void
setColorModel
(ColorModel aColorModel) Sets the color model that will be attached to decoded rasters.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
setIncludeDMEDLevel
(boolean aIncludeDMEDLevel) Specifies whether the DMED thumbnail level should be included in decoded multilevel rasters.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), instead of the default 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:
-
ALTERNATIVE_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
-
TLcdDMEDModelDecoder
public TLcdDMEDModelDecoder()Creates a model decoder to decode DMED files, with a globally shared buffer for caching tiles.- See Also:
-
TLcdDMEDModelDecoder
Creates a model decoder to decode DMED files.- Parameters:
aBuffer
- the buffer in which decoded raster tiles will be cached.
-
TLcdDMEDModelDecoder
Creates a model decoder to decode DMED files, 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.
-
-
Method Details
-
setBuffer
Sets the buffer in which decoded raster tiles will be cached. -
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 will be attached to decoded rasters.- Parameters:
aColorModel
- a 16-bit IndexColorModel.
-
getColorModel
Returns the color model that is attached to decoded rasters. -
setIncludeDMEDLevel
public void setIncludeDMEDLevel(boolean aIncludeDMEDLevel) Specifies whether the DMED thumbnail level should be included in decoded multilevel rasters. The default istrue
. -
isIncludeDMEDLevel
public boolean isIncludeDMEDLevel() -
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 DMED and DTED tiles should be checked immediately or lazily.If
true
, the decoded multi-level rasters will only contain the non-empty DMED levels and DTED levels that are actually present. In addition, the DTED 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 the DMED level and 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. The DMED level, if included, however, is always area-sampled, so the first level in the resulting multilevel image mosaic may have a different sampling mode than the others.- 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), instead of the default 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 is
false
. -
isSupportGeoidDatums
public boolean isSupportGeoidDatums() -
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 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.
The default is
false
. -
isApplyGeoidDatums
public boolean isApplyGeoidDatums() -
getDefaultExtension
-
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 "dmed" or "dmed.".- See Also:
-
decode
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
null
is allowed, implementors are advised to throw an error instead. - Throws:
IOException
- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decode( String aSourceName ) throws IOException { try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }
- See Also:
-
decodeModelMetadata
Decodes metadata for the specified DMED file. The resultingTLcdModelMetadata
will also offer an option to decode the model metadata of the source's DTED directory, by callingTLcdModelMetadata.discoverDataSeries()
. A call to that method will trigger an attempt to find the DTED directory next to the given source, and decode its metadata as described inTLcdDTEDDirectoryModelDecoder.decodeModelMetadata(String)
. Note that the discovery of this DTED directory directly accesses the file system, instead of using the decoder's inputstream factory. This also means that the discovery will not succeed for sources that are not located on the file system, such as sources served over HTTP.- Specified by:
decodeModelMetadata
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the DMED file 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:
-