Package com.luciad.format.raster
Class TLcdDTEDModelDecoder
java.lang.Object
com.luciad.format.raster.TLcdDTEDModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
@LcdService(service=ILcdModelDecoder.class,
priority=20000)
public class TLcdDTEDModelDecoder
extends Object
implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This model decoder decodes individual DTED (Digital Terrain Elevation Data)
files.
Input files
File | Required | Entry point | Description |
---|---|---|---|
*.dt[012] | x | x | DTED file corresponding to a single cell of 1 degree by 1 degree |
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 DTED file.
- All models returned by this model decoder implement
ILcd2DBoundsIndexedModel
.
Model descriptor
- All models returned by this model decoder have a
TLcdDTEDModelDescriptor
. - 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 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
(andILcdRaster
) instance. - The
ILcdRaster
instance in turn contains a singleTLcdDTEDTile
instance that corresponds to the DTED cell and that points to additional information about the cell. - 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 property
colorModel
allows to override the default 16-bits index color that is attached to the decoded rasters, since DTED files don't contain any color information. - The decoded raster contains the elevation values from the corresponding
DTED cell. 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.
Sample code
TLcdDTEDModelDecoder decoder = new TLcdDTEDModelDecoder();
ILcdModel model = decoder.decode("dted/e011/n45.dt0");
Performance tips
- It is more efficient to use a single large (multilevel)
DMED/DTED raster decoded with
TLcdDMEDModelDecoder
orTLcdDTEDDirectoryModelDecoder
than to use several individual DTED rasters decoded with this decoder.
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
- 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 DTED files, with a globally shared buffer for caching tiles.TLcdDTEDModelDecoder
(ILcdBuffer aBuffer) Creates a model decoder to decode DTED files.TLcdDTEDModelDecoder
(ILcdBuffer aBuffer, boolean aShading) Creates a model decoder to decode DTED files, optionally producing shaded rasters instead of elevation rasters. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(String aString) 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 DTED 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
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
setColorModel
(ColorModel aColorModel) Sets the color model that will be attached to decoded rasters.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for creating input streams given source names.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_EXTENSIONS
-
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
-
TLcdDTEDModelDecoder
public TLcdDTEDModelDecoder()Creates a model decoder to decode DTED files, with a globally shared buffer for caching tiles.- See Also:
-
TLcdDTEDModelDecoder
Creates a model decoder to decode DTED files.- Parameters:
aBuffer
- the buffer in which decoded raster tiles are cached.
-
TLcdDTEDModelDecoder
Creates a model decoder to decode DTED 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
-
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. -
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.
The default is
false
. -
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:
aString
- the data source to be verified; typically a file name or a URL.- Returns:
true
if file name aString has extension "dt0", "dt1", "dt2", "dted", "avg", "min", or "max".- 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 DTED file. If the DTED file follows the standard DTED naming conventions, this method does not do any I/O, as all metadata can be extracted from the file's source name alone. If that is not the case, this method will attempt to read the file header in order to retrieve its metadata.- Specified by:
decodeModelMetadata
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the DTED file for which metadata will be decoded.- Returns:
- the model metadata for the given DTED file.
- Throws:
IOException
- if the metadata cannot be decoded for some reason.- See Also:
-